mirror of
https://github.com/mathuo/dockview
synced 2025-03-12 17:02:04 +00:00
remove drop-target overlays when not needed
This commit is contained in:
parent
47fb99a06f
commit
c1bf5deaf9
@ -95,6 +95,11 @@ export class Droptarget extends CompositeDisposable {
|
|||||||
new DragAndDropObserver(this.element, {
|
new DragAndDropObserver(this.element, {
|
||||||
onDragEnter: () => undefined,
|
onDragEnter: () => undefined,
|
||||||
onDragOver: (e) => {
|
onDragOver: (e) => {
|
||||||
|
if (this._acceptedTargetZonesSet.size === 0) {
|
||||||
|
this.removeDropTarget();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const width = this.element.clientWidth;
|
const width = this.element.clientWidth;
|
||||||
const height = this.element.clientHeight;
|
const height = this.element.clientHeight;
|
||||||
|
|
||||||
@ -129,9 +134,11 @@ export class Droptarget extends CompositeDisposable {
|
|||||||
|
|
||||||
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
if (typeof this.options.canDisplayOverlay === 'boolean') {
|
||||||
if (!this.options.canDisplayOverlay) {
|
if (!this.options.canDisplayOverlay) {
|
||||||
|
this.removeDropTarget();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!this.options.canDisplayOverlay(e, quadrant)) {
|
} else if (!this.options.canDisplayOverlay(e, quadrant)) {
|
||||||
|
this.removeDropTarget();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,14 +156,6 @@ export class Droptarget extends CompositeDisposable {
|
|||||||
this.element.append(this.targetElement);
|
this.element.append(this.targetElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.options.acceptedTargetZones.length === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.targetElement || !this.overlayElement) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.toggleClasses(quadrant, width, height);
|
this.toggleClasses(quadrant, width, height);
|
||||||
|
|
||||||
this.setState(quadrant);
|
this.setState(quadrant);
|
||||||
|
Loading…
Reference in New Issue
Block a user