@internal restore back the original style before dragging
()
| 352 | |
| 353 | /** @internal restore back the original style before dragging */ |
| 354 | protected _removeHelperStyle(): DDDraggable { |
| 355 | this.helper.classList.remove('ui-draggable-dragging'); |
| 356 | this.el.gridstackNode?.grid?.el.classList.remove('grid-stack-dragging'); |
| 357 | const node = (this.helper as GridItemHTMLElement)?.gridstackNode; |
| 358 | // don't bother restoring styles if we're gonna remove anyway... |
| 359 | if (!node?._isAboutToRemove && this.dragElementOriginStyle) { |
| 360 | const helper = this.helper; |
| 361 | // don't animate, otherwise we animate offseted when switching back to 'absolute' from 'fixed'. |
| 362 | // TODO: this also removes resizing animation which doesn't have this issue, but others. |
| 363 | // Ideally both would animate ('move' would immediately restore 'absolute' and adjust coordinate to match, |
| 364 | // then trigger a delay (repaint) to restore to final dest with animate) but then we need to make sure 'resizestop' |
| 365 | // is called AFTER 'transitionend' event is received (see https://github.com/gridstack/gridstack.js/issues/2033) |
| 366 | const transition = this.dragElementOriginStyle['transition'] || null; |
| 367 | helper.style.transition = this.dragElementOriginStyle['transition'] = 'none'; // can't be NULL #1973 |
| 368 | DDDraggable.originStyleProp.forEach(prop => helper.style[prop] = this.dragElementOriginStyle[prop] || null); |
| 369 | setTimeout(() => helper.style.transition = transition, 50); // recover animation from saved vars after a pause (0 isn't enough #1973) |
| 370 | } |
| 371 | delete this.dragElementOriginStyle; |
| 372 | return this; |
| 373 | } |
| 374 | |
| 375 | /** @internal updates the top/left position to follow the mouse */ |
| 376 | public _dragFollow(e: DragEvent): void { |