Skip to content

Commit

Permalink
fix: inconsistent double click on listing item
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiresviana committed Apr 14, 2021
1 parent 8973c45 commit ba7e71a
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions frontend/src/components/files/ListingItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
@dragover="dragOver"
@drop="drop"
@click="itemClick"
@dblclick="dblclick"
@touchstart="touchstart"
:data-dir="isDir"
:aria-label="name"
:aria-selected="isSelected"
Expand Down Expand Up @@ -200,6 +198,16 @@ export default {
},
click: function (event) {
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) {
this.removeSelected(this.index);
return;
Expand Down Expand Up @@ -235,19 +243,6 @@ export default {
this.resetSelected();
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 () {
this.$router.push({ path: this.url });
},
Expand Down

0 comments on commit ba7e71a

Please sign in to comment.