forked from platypush/platypush
[UI] Improved Draggable
component events.
`Draggable` components should emit `dragend`, not `drop` events. `drop` should only be emitted by `Droppable` components, or the receiver of a component that uses both won't be able to tell if a `drop` event came from a component being dragged, or from an element where a dragged element was dropped.
This commit is contained in:
parent
471ec1370c
commit
daa030ff4c
1 changed files with 5 additions and 13 deletions
|
@ -13,6 +13,7 @@ export default {
|
|||
emits: [
|
||||
'contextmenu',
|
||||
'drag',
|
||||
'dragend',
|
||||
'drop',
|
||||
],
|
||||
|
||||
|
@ -37,7 +38,7 @@ export default {
|
|||
},
|
||||
|
||||
value: {
|
||||
type: Object,
|
||||
type: [Object, String, Number, Boolean, Array],
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
|
@ -51,8 +52,8 @@ export default {
|
|||
drag: this.onDrag,
|
||||
dragend: this.onDragEnd,
|
||||
dragstart: this.onDragStart,
|
||||
drop: this.onDrop,
|
||||
touchcancel: this.onDrop,
|
||||
drop: this.onDragEnd,
|
||||
touchcancel: this.onDragEnd,
|
||||
touchend: this.onTouchEnd,
|
||||
touchmove: this.onTouchMove,
|
||||
touchstart: this.onTouchStart,
|
||||
|
@ -121,7 +122,7 @@ export default {
|
|||
}
|
||||
|
||||
this.reset()
|
||||
this.$emit('drop', event)
|
||||
this.$emit('dragend', event)
|
||||
},
|
||||
|
||||
onTouchStart(event) {
|
||||
|
@ -242,15 +243,6 @@ export default {
|
|||
this.onDragEnd(event)
|
||||
},
|
||||
|
||||
onDrop(event) {
|
||||
if (this.disabled) {
|
||||
return
|
||||
}
|
||||
|
||||
this.reset()
|
||||
this.$emit('drop', event)
|
||||
},
|
||||
|
||||
handleTouchScroll(value, parent) {
|
||||
this.touchScrollDirection = value
|
||||
if (!(value[0] || value[1])) {
|
||||
|
|
Loading…
Reference in a new issue