Refine drag-and-drop behavior in LoggedInView: Update drop event handling to prevent event propagation and improve widget insertion logic. Adjust drop target determination to enhance user experience during widget rearrangement.
This commit is contained in:
@@ -68,7 +68,7 @@
|
|||||||
v-if="dragOverIndex === index && draggedIndex !== null && draggedIndex !== index"
|
v-if="dragOverIndex === index && draggedIndex !== null && draggedIndex !== index"
|
||||||
class="dashboard-grid-cell dashboard-drop-indicator"
|
class="dashboard-grid-cell dashboard-drop-indicator"
|
||||||
@dragover.prevent="setDropTarget(index)"
|
@dragover.prevent="setDropTarget(index)"
|
||||||
@drop.prevent="onDrop(index)"
|
@drop.prevent.stop="onDrop(index)"
|
||||||
>
|
>
|
||||||
<div class="drop-indicator-line"></div>
|
<div class="drop-indicator-line"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
v-if="dragOverIndex === widgets.length && draggedIndex !== null"
|
v-if="dragOverIndex === widgets.length && draggedIndex !== null"
|
||||||
class="dashboard-grid-cell dashboard-drop-indicator"
|
class="dashboard-grid-cell dashboard-drop-indicator"
|
||||||
@dragover.prevent="onGridDragover"
|
@dragover.prevent="onGridDragover"
|
||||||
@drop.prevent="onGridDrop"
|
@drop.prevent.stop="onGridDrop"
|
||||||
>
|
>
|
||||||
<div class="drop-indicator-line"></div>
|
<div class="drop-indicator-line"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -277,8 +277,9 @@ export default {
|
|||||||
async onGridDrop() {
|
async onGridDrop() {
|
||||||
if (this.draggedIndex == null) return;
|
if (this.draggedIndex == null) return;
|
||||||
const from = this.draggedIndex;
|
const from = this.draggedIndex;
|
||||||
const to = this.widgets.length;
|
// Wenn Drop auf Grid landet: zuletzt angezeigte Einfügeposition nutzen (sonst ans Ende)
|
||||||
if (from === to || from === to - 1) {
|
const to = this.dragOverIndex != null ? this.dragOverIndex : this.widgets.length;
|
||||||
|
if (from === to || to < 0 || to > this.widgets.length) {
|
||||||
this.draggedIndex = null;
|
this.draggedIndex = null;
|
||||||
this.dragOverIndex = null;
|
this.dragOverIndex = null;
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user