drag events correctly emiting to server.

This commit is contained in:
Miroslav Šedivý 2021-01-08 22:15:49 +01:00
parent dc5699e425
commit 6bd3352a5f

View File

@ -11,9 +11,9 @@
@mouseup.stop.prevent="onMouseUp" @mouseup.stop.prevent="onMouseUp"
@mouseenter.stop.prevent="onMouseEnter" @mouseenter.stop.prevent="onMouseEnter"
@mouseleave.stop.prevent="onMouseLeave" @mouseleave.stop.prevent="onMouseLeave"
@dragenter.stop.prevent="onDrag" @dragenter.stop.prevent="onDragEnter"
@dragleave.stop.prevent="onDrag" @dragleave.stop.prevent="onDragLeave"
@dragover.stop.prevent="onDrag" @dragover.stop.prevent="onDragOver"
@drop.stop.prevent="onDrop" @drop.stop.prevent="onDrop"
/> />
</template> </template>
@ -194,15 +194,20 @@
} }
} }
onDrag(e: DragEvent) { onDragEnter(e: DragEvent) {
e.preventDefault() this.onMouseEnter(e as MouseEvent)
e.stopPropagation() }
onDragLeave(e: DragEvent) {
this.onMouseLeave(e as MouseEvent)
}
onDragOver(e: DragEvent) {
this.onMouseMove(e as MouseEvent)
} }
onDrop(e: DragEvent) { onDrop(e: DragEvent) {
e.preventDefault() if (this.isControling || this.implicitControl) {
e.stopPropagation()
let dt = e.dataTransfer let dt = e.dataTransfer
if (!dt) return if (!dt) return
@ -211,6 +216,7 @@
this.$emit('drop-files', { ...this.getMousePos(e.clientX, e.clientY), files }) this.$emit('drop-files', { ...this.getMousePos(e.clientX, e.clientY), files })
} }
}
isRequesting = false isRequesting = false
@Watch('isControling') @Watch('isControling')