@internal call when the mouse gets released to drop the item at current location
(e: MouseEvent)
| 241 | |
| 242 | /** @internal call when the mouse gets released to drop the item at current location */ |
| 243 | protected _mouseUp(e: MouseEvent): void { |
| 244 | this._stopScrolling(); |
| 245 | document.removeEventListener('mousemove', this._mouseMove, true); |
| 246 | document.removeEventListener('mouseup', this._mouseUp, true); |
| 247 | if (isTouch && e.currentTarget) { // destroy() during nested grid call us again wit fake _mouseUp |
| 248 | e.currentTarget.removeEventListener('touchmove', touchmove, true); |
| 249 | e.currentTarget.removeEventListener('touchend', touchend, true); |
| 250 | } |
| 251 | if (this.dragging) { |
| 252 | delete this.dragging; |
| 253 | delete (this.el.gridstackNode as GridStackNodeRotate)?._origRotate; |
| 254 | document.removeEventListener('keydown', this._keyEvent); |
| 255 | |
| 256 | // reset the drop target if dragging over ourself (already parented, just moving during stop callback below) |
| 257 | if (DDManager.dropElement?.el === this.el.parentElement) { |
| 258 | delete DDManager.dropElement; |
| 259 | } |
| 260 | |
| 261 | this.helperContainment.style.position = this.parentOriginStylePosition || null; |
| 262 | if (this.helper !== this.el) this.helper.remove(); // hide now |
| 263 | this._removeHelperStyle(); |
| 264 | |
| 265 | const ev = Utils.initEvent<DragEvent>(e, { target: this.el, type: 'dragstop' }); |
| 266 | if (this.option.stop) { |
| 267 | this.option.stop(ev); // NOTE: destroy() will be called when removing item, so expect NULL ptr after! |
| 268 | } |
| 269 | this.triggerEvent('dragstop', ev); |
| 270 | |
| 271 | // call the droppable method to receive the item |
| 272 | if (DDManager.dropElement) { |
| 273 | DDManager.dropElement.drop(e); |
| 274 | } |
| 275 | } |
| 276 | delete this.helper; |
| 277 | delete this.mouseDownEvent; |
| 278 | delete DDManager.dragElement; |
| 279 | delete DDManager.dropElement; |
| 280 | delete DDManager.mouseHandled; |
| 281 | e.preventDefault(); |
| 282 | } |
| 283 | |
| 284 | /** @internal call when keys are being pressed - use Esc to cancel, R to rotate */ |
| 285 | protected _keyEvent(e: KeyboardEvent): void { |
no test coverage detected