From 12c873c7cfb1e27f10a2a1b5b7c172169b9e6455 Mon Sep 17 00:00:00 2001 From: mathuo <6710312+mathuo@users.noreply.github.com> Date: Sun, 25 Feb 2024 16:12:49 +0000 Subject: [PATCH] replace DockviewDropTragets with DockviewGroupDropLocation --- .../dockview-core/src/dockview/components/panel/content.ts | 2 +- .../src/dockview/components/titlebar/voidContainer.ts | 6 +++++- .../dockview-core/src/dockview/dockviewGroupPanelModel.ts | 6 +++--- packages/dockview-core/src/dockview/options.ts | 5 ++--- packages/dockview-core/src/dockview/types.ts | 2 -- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/dockview-core/src/dockview/components/panel/content.ts b/packages/dockview-core/src/dockview/components/panel/content.ts index 1bf35fb84..1d5b8912d 100644 --- a/packages/dockview-core/src/dockview/components/panel/content.ts +++ b/packages/dockview-core/src/dockview/components/panel/content.ts @@ -94,7 +94,7 @@ export class ContentContainer return !groupHasOnePanelAndIsActiveDragElement; } - return this.group.canDisplayOverlay(event, position, 'panel'); + return this.group.canDisplayOverlay(event, position, 'content'); }, }); diff --git a/packages/dockview-core/src/dockview/components/titlebar/voidContainer.ts b/packages/dockview-core/src/dockview/components/titlebar/voidContainer.ts index 3ab3652f4..5709273a8 100644 --- a/packages/dockview-core/src/dockview/components/titlebar/voidContainer.ts +++ b/packages/dockview-core/src/dockview/components/titlebar/voidContainer.ts @@ -67,7 +67,11 @@ export class VoidContainer extends CompositeDisposable { return last(this.group.panels)?.id !== data.panelId; } - return group.model.canDisplayOverlay(event, position, 'panel'); + return group.model.canDisplayOverlay( + event, + position, + 'header_space' + ); }, }); diff --git a/packages/dockview-core/src/dockview/dockviewGroupPanelModel.ts b/packages/dockview-core/src/dockview/dockviewGroupPanelModel.ts index 6cad9ce71..d690d0f4c 100644 --- a/packages/dockview-core/src/dockview/dockviewGroupPanelModel.ts +++ b/packages/dockview-core/src/dockview/dockviewGroupPanelModel.ts @@ -23,7 +23,7 @@ import { TabDragEvent, TabsContainer, } from './components/titlebar/tabsContainer'; -import { DockviewDropTargets, IWatermarkRenderer } from './types'; +import { IWatermarkRenderer } from './types'; import { DockviewGroupPanel } from './dockviewGroupPanel'; import { IDockviewPanel } from './dockviewPanel'; import { IHeaderActionsRenderer } from './options'; @@ -175,7 +175,7 @@ export interface IDockviewGroupPanelModel extends IPanel { canDisplayOverlay( event: DragEvent, position: Position, - target: DockviewDropTargets + target: DockviewGroupDropLocation ): boolean; } @@ -924,7 +924,7 @@ export class DockviewGroupPanelModel canDisplayOverlay( event: DragEvent, position: Position, - target: DockviewDropTargets + target: DockviewGroupDropLocation ): boolean { // custom overlay handler if (this.accessor.options.showDndOverlay) { diff --git a/packages/dockview-core/src/dockview/options.ts b/packages/dockview-core/src/dockview/options.ts index ee24ae6ce..016eff890 100644 --- a/packages/dockview-core/src/dockview/options.ts +++ b/packages/dockview-core/src/dockview/options.ts @@ -6,7 +6,6 @@ import { ITabRenderer, WatermarkConstructor, IWatermarkRenderer, - DockviewDropTargets, } from './types'; import { Parameters } from '../panel/types'; import { DockviewGroupPanel } from './dockviewGroupPanel'; @@ -14,7 +13,7 @@ import { ISplitviewStyles, Orientation } from '../splitview/splitview'; import { PanelTransfer } from '../dnd/dataTransfer'; import { IDisposable } from '../lifecycle'; import { DroptargetOverlayModel, Position } from '../dnd/droptarget'; -import { GroupOptions } from './dockviewGroupPanelModel'; +import { DockviewGroupDropLocation, GroupOptions } from './dockviewGroupPanelModel'; import { IDockviewPanel } from './dockviewPanel'; import { ComponentConstructor, @@ -65,7 +64,7 @@ export interface ViewFactoryData { export interface DockviewDndOverlayEvent { nativeEvent: DragEvent; - target: DockviewDropTargets; + target: DockviewGroupDropLocation; position: Position; group?: DockviewGroupPanel; getData: () => PanelTransfer | undefined; diff --git a/packages/dockview-core/src/dockview/types.ts b/packages/dockview-core/src/dockview/types.ts index 581d46ee8..08cb7ab4b 100644 --- a/packages/dockview-core/src/dockview/types.ts +++ b/packages/dockview-core/src/dockview/types.ts @@ -7,8 +7,6 @@ import { Optional } from '../types'; import { DockviewGroupPanel, IDockviewGroupPanel } from './dockviewGroupPanel'; import { DockviewPanelRenderer } from '../overlayRenderContainer'; -export type DockviewDropTargets = 'tab' | 'panel' | 'tabContainer' | 'edge'; - export interface HeaderPartInitParameters { title: string; }