From 218f434e01a27b4370f2ee88b1e94c6a01c09945 Mon Sep 17 00:00:00 2001 From: chfhtw Date: Mon, 30 Mar 2026 16:49:21 +0200 Subject: [PATCH] stabilize workaround for chrome by adding more code into the workaround and get rid of updateCursorOnMouseMove in the process --- public/js/components/Drop/Grid.js | 36 ++++++++++++++++--------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/public/js/components/Drop/Grid.js b/public/js/components/Drop/Grid.js index 75fdefda6..d766492ad 100644 --- a/public/js/components/Drop/Grid.js +++ b/public/js/components/Drop/Grid.js @@ -386,13 +386,14 @@ export default { if (!this.active) return; - this.mode = MODE_MOVE; - - this.draggedItem = item; - - this.$emit('draggedItem', item); // workaround for chrome fireing event dragend when styles are manipulated during dragging setTimeout(() => { + this.mode = MODE_MOVE; + this.updateCursor(evt); + this.draggedItem = item; + + this.$emit('draggedItem', item); + this.draggedNode = evt.target.closest(".drop-grid-item"); //clones the widget for the drag Image @@ -402,19 +403,26 @@ export default { clone.classList.add("widgetClone"); this.$refs.container.appendChild(clone); const hiddenWidget = clone.querySelector("[style='display: none;']"); - hiddenWidget.style.removeProperty("display"); + if (hiddenWidget) + hiddenWidget.style.removeProperty("display"); this.clonedWidget = clone; + + this.draggedOffset = [item.x - this.x, item.y - this.y]; }, 0); - this.draggedOffset = [item.x - this.x, item.y - this.y]; this._dragStart(evt, item); }, startResize(evt, item) { if (!this.active) return; - this.mode = MODE_RESIZE; - this.draggedItem = item; - this.$emit('draggedItem', item); + + // workaround for chrome fireing event dragend when styles are manipulated during dragging + setTimeout(() => { + this.mode = MODE_RESIZE; + this.draggedItem = item; + this.$emit('draggedItem', item); + }, 0); + this._dragStart(evt); }, dragOver(evt) { @@ -515,11 +523,6 @@ export default { } return updated; }, - updateCursorOnMouseMove(evt) { - if (this.mode == MODE_IDLE) { - this.updateCursor(evt); - } - }, checkPinnedWidgetAnimation() { let itemAtPosition = []; switch (this.mode) { @@ -599,7 +602,6 @@ export default { @touchend="dragCancel" @dragover.prevent="dragOver" @drop="dragEnd" - @mousemove="updateCursorOnMouseMove" >