MCPcopy Index your code
hub / github.com/gridstack/gridstack.js / _mouseLeave

Method _mouseLeave

src/dd-droppable.ts:112–143  ·  view source on GitHub ↗

@internal called when the item is leaving our area, stop tracking if we had moving item

(e: MouseEvent, calledByEnter = false)

Source from the content-addressed store, hash-verified

110
111 /** @internal called when the item is leaving our area, stop tracking if we had moving item */
112 protected _mouseLeave(e: MouseEvent, calledByEnter = false): void {
113 // console.log(`${count++} Leave ${this.el.id}`); // TEST
114 if (!DDManager.dragElement || DDManager.dropElement !== this) return;
115 e.preventDefault();
116 e.stopPropagation();
117 // stop the old grid's auto-scroll only when entering a new grid; if leaving to empty space keep scrolling until mouseup
118 if (calledByEnter) DDManager.dragElement._stopScrolling();
119
120 const ev = Utils.initEvent<DragEvent>(e, { target: this.el, type: 'dropout' });
121 if (this.option.out) {
122 this.option.out(ev, this._ui(DDManager.dragElement))
123 }
124 this.triggerEvent('dropout', ev);
125
126 if (DDManager.dropElement === this) {
127 delete DDManager.dropElement;
128 // console.log('not tracking'); // TEST
129
130 // if we're still over a parent droppable, send it an enter as we don't get one from leaving nested children
131 if (!calledByEnter) {
132 let parentDrop: DDDroppable;
133 let parent: DDElementHost = this.el.parentElement;
134 while (!parentDrop && parent) {
135 parentDrop = parent.ddElement?.ddDroppable;
136 parent = parent.parentElement;
137 }
138 if (parentDrop) {
139 parentDrop._mouseEnter(e);
140 }
141 }
142 }
143 }
144
145 /** item is being dropped on us - called by the drag mouseup handler - this calls the client drop event */
146 public drop(e: MouseEvent): void {

Callers 2

_mouseEnterMethod · 0.80

Calls 5

_uiMethod · 0.95
_stopScrollingMethod · 0.80
initEventMethod · 0.80
triggerEventMethod · 0.80
_mouseEnterMethod · 0.80

Tested by

no test coverage detected