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"
|
||||
class="dashboard-grid-cell dashboard-drop-indicator"
|
||||
@dragover.prevent="setDropTarget(index)"
|
||||
@drop.prevent="onDrop(index)"
|
||||
@drop.prevent.stop="onDrop(index)"
|
||||
>
|
||||
<div class="drop-indicator-line"></div>
|
||||
</div>
|
||||
@@ -115,7 +115,7 @@
|
||||
v-if="dragOverIndex === widgets.length && draggedIndex !== null"
|
||||
class="dashboard-grid-cell dashboard-drop-indicator"
|
||||
@dragover.prevent="onGridDragover"
|
||||
@drop.prevent="onGridDrop"
|
||||
@drop.prevent.stop="onGridDrop"
|
||||
>
|
||||
<div class="drop-indicator-line"></div>
|
||||
</div>
|
||||
@@ -277,8 +277,9 @@ export default {
|
||||
async onGridDrop() {
|
||||
if (this.draggedIndex == null) return;
|
||||
const from = this.draggedIndex;
|
||||
const to = this.widgets.length;
|
||||
if (from === to || from === to - 1) {
|
||||
// Wenn Drop auf Grid landet: zuletzt angezeigte Einfügeposition nutzen (sonst ans Ende)
|
||||
const to = this.dragOverIndex != null ? this.dragOverIndex : this.widgets.length;
|
||||
if (from === to || to < 0 || to > this.widgets.length) {
|
||||
this.draggedIndex = null;
|
||||
this.dragOverIndex = null;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user