fix: inconsistent double click on listing item

pull/1373/head
Ramires Viana 2021-04-14 15:29:06 +00:00
parent 8973c4598f
commit ba7e71a7c3
1 changed files with 10 additions and 15 deletions

View File

@ -8,8 +8,6 @@
@dragover="dragOver" @dragover="dragOver"
@drop="drop" @drop="drop"
@click="itemClick" @click="itemClick"
@dblclick="dblclick"
@touchstart="touchstart"
:data-dir="isDir" :data-dir="isDir"
:aria-label="name" :aria-label="name"
:aria-selected="isSelected" :aria-selected="isSelected"
@ -200,6 +198,16 @@ export default {
}, },
click: function (event) { click: function (event) {
if (!this.singleClick && this.selectedCount !== 0) event.preventDefault(); if (!this.singleClick && this.selectedCount !== 0) event.preventDefault();
setTimeout(() => {
this.touches = 0;
}, 300);
this.touches++;
if (this.touches > 1) {
this.open();
}
if (this.$store.state.selected.indexOf(this.index) !== -1) { if (this.$store.state.selected.indexOf(this.index) !== -1) {
this.removeSelected(this.index); this.removeSelected(this.index);
return; return;
@ -235,19 +243,6 @@ export default {
this.resetSelected(); this.resetSelected();
this.addSelected(this.index); this.addSelected(this.index);
}, },
dblclick: function () {
if (!this.singleClick) this.open();
},
touchstart() {
setTimeout(() => {
this.touches = 0;
}, 300);
this.touches++;
if (this.touches > 1) {
this.open();
}
},
open: function () { open: function () {
this.$router.push({ path: this.url }); this.$router.push({ path: this.url });
}, },