Merge pull request #3297 from thelounge/xpaw/better-disable-touch

A better way of disabling sorting on touch devices
This commit is contained in:
Pavel Djundik 2019-07-15 12:46:10 +03:00 committed by GitHub
commit 01347787b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@
<Draggable
v-else
:list="networks"
:disabled="isSortingEnabled"
:filter="isCurrentlyInTouch"
handle=".lobby"
draggable=".network"
ghost-class="ui-sortable-ghost"
@ -51,7 +51,7 @@
ghost-class="ui-sortable-ghost"
drag-class="ui-sortable-dragged"
:group="network.uuid"
:disabled="isSortingEnabled"
:filter="isCurrentlyInTouch"
:list="network.channels"
class="channels"
@change="onChannelSort"
@ -91,15 +91,11 @@ export default {
activeChannel: Object,
networks: Array,
},
computed: {
isSortingEnabled() {
const isTouch = !!("ontouchstart" in window || (window.DocumentTouch && document instanceof window.DocumentTouch));
// TODO: Implement a way to sort on touch devices
return isTouch;
},
},
methods: {
isCurrentlyInTouch(e) {
// TODO: Implement a way to sort on touch devices
return e.pointerType !== "mouse";
},
onDragStart(e) {
e.target.classList.add("ui-sortable-active");
},