Keep track of drag targets, avoids flickering and performance issues

This commit is contained in:
guerler
2022-09-23 03:21:40 +02:00
committed by Alireza Heidari
parent 7ad3d685c3
commit 8efb39a723
@@ -30,7 +30,8 @@
<section
class="history-layout d-flex flex-column w-100"
@drop.prevent="onDrop"
@dragover.prevent="onDragOver"
@dragenter.prevent="onDragEnter"
@dragover.prevent
@dragleave.prevent="onDragLeave">
<slot name="navigation" :history="history" />
<HistoryFilters
@@ -323,12 +324,15 @@ export default {
this.highlights = {};
this.highlightsKey = null;
},
onDragLeave() {
this.showDropZone = false;
},
onDragOver() {
onDragEnter(e) {
this.dragTarget = e.target;
this.showDropZone = true;
},
onDragLeave(e) {
if (this.dragTarget == e.target) {
this.showDropZone = false;
}
},
onDrop(evt) {
this.showDropZone = false;
const data = JSON.parse(evt.dataTransfer.getData("text"))[0];