@internal called when the cursor enters our area - prepare for a possible drop and track leaving
(e: MouseEvent)
| 82 | |
| 83 | /** @internal called when the cursor enters our area - prepare for a possible drop and track leaving */ |
| 84 | protected _mouseEnter(e: MouseEvent): void { |
| 85 | // console.log(`${count++} Enter ${this.el.id}`); // TEST |
| 86 | if (!DDManager.dragElement) return; |
| 87 | // During touch drag operations, ignore real browser-generated mouseenter events (isTrusted:true) vs our simulated ones (isTrusted:false). |
| 88 | // The browser can fire spurious mouseenter events when we dispatch simulated mousemove events. |
| 89 | if (DDTouch.touchHandled && e.isTrusted) return |
| 90 | |
| 91 | if (!this._canDrop(DDManager.dragElement.el)) return; |
| 92 | e.preventDefault(); |
| 93 | e.stopPropagation(); |
| 94 | DDManager.dragElement._stopScrolling(); |
| 95 | |
| 96 | // make sure when we enter this, that the last one gets a leave FIRST to correctly cleanup as we don't always do |
| 97 | if (DDManager.dropElement && DDManager.dropElement !== this) { |
| 98 | DDManager.dropElement._mouseLeave(e as DragEvent, true); // calledByEnter = true |
| 99 | } |
| 100 | DDManager.dropElement = this; |
| 101 | |
| 102 | const ev = Utils.initEvent<DragEvent>(e, { target: this.el, type: 'dropover' }); |
| 103 | if (this.option.over) { |
| 104 | this.option.over(ev, this._ui(DDManager.dragElement)) |
| 105 | } |
| 106 | this.triggerEvent('dropover', ev); |
| 107 | this.el.classList.add('ui-droppable-over'); |
| 108 | // console.log('tracking'); // TEST |
| 109 | } |
| 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 { |
no test coverage detected