handle edge drops for onWillShowOverlay

This commit is contained in:
mathuo 2024-02-25 16:09:48 +00:00
parent 60f49ce449
commit 5a635336b3
No known key found for this signature in database
GPG Key ID: C6EEDEFD6CA07281
2 changed files with 19 additions and 2 deletions

View File

@ -568,6 +568,19 @@ export class DockviewComponent
});
this.addDisposables(
this._rootDropTarget,
this._rootDropTarget.onWillShowOverlay((event) => {
if (this.gridview.length > 0 && event.position === 'center') {
// option only available when no panels in primary grid
return;
}
this._onWillShowOverlay.fire(
new WillShowOverlayLocationEvent(event, {
kind: 'edge',
})
);
}),
this._rootDropTarget.onDrop((event) => {
const willDropEvent = new DockviewWillDropEvent({
nativeEvent: event.nativeEvent,
@ -576,7 +589,7 @@ export class DockviewComponent
api: this._api,
group: undefined,
getData: getPanelData,
kind: 'content',
kind: 'edge',
});
this._onWillDrop.fire(willDropEvent);

View File

@ -125,7 +125,11 @@ export interface IHeader {
export type DockviewGroupPanelLocked = boolean | 'no-drop-target';
export type DockviewGroupDropLocation = 'tab' | 'header_space' | 'content';
export type DockviewGroupDropLocation =
| 'tab'
| 'header_space'
| 'content'
| 'edge';
export interface IDockviewGroupPanelModel extends IPanel {
readonly isActive: boolean;