From ac044016eeb64aa0c51fefa67700c1867dd836ed Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 24 Aug 2017 09:14:26 +0100 Subject: [PATCH] Implement SHIFT+Click to select range of files. #206 Former-commit-id: 15da15e0588d5977b42f71b8c96980248db73889 [formerly 95e464410bb619f4ff70b21d846e937bf9355e8a] [formerly cae63a6f6de24229ff04392fe16260c0d9045e8c [formerly 297a52e606afd39e9f544b359fefba405fe4b01b]] Former-commit-id: de9d291dba6c2e2d750c519f1fcbd59c34538ab1 [formerly 4fb3fcf8ba5726f6dde56fcbd8c1457799539a8e] Former-commit-id: ad1568f33fa927dc750515856950b95b588d9f68 --- assets/src/components/files/ListingItem.vue | 17 +++++++++++------ rice-box.go.REMOVED.git-id | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/assets/src/components/files/ListingItem.vue b/assets/src/components/files/ListingItem.vue index 4ec15c61..c92c91d1 100644 --- a/assets/src/components/files/ListingItem.vue +++ b/assets/src/components/files/ListingItem.vue @@ -115,15 +115,20 @@ export default { }, click: function (event) { if (this.selectedCount !== 0) event.preventDefault() - if (this.$store.state.selected.indexOf(this.index) === -1) { - if (!event.ctrlKey && !this.$store.state.multiple) this.resetSelected() - - this.addSelected(this.index) - } else { + if (this.$store.state.selected.indexOf(this.index) !== -1) { this.removeSelected(this.index) + return } - return false + if (event.shiftKey && this.selected.length === 1) { + let fi = (this.index > this.selected[0]) ? this.selected[0] : this.index + let la = (this.index > this.selected[0]) ? this.index : this.selected[0] + for (; fi <= la; fi++) this.addSelected(fi) + return + } + + if (!event.ctrlKey && !this.$store.state.multiple) this.resetSelected() + this.addSelected(this.index) }, touchstart (event) { setTimeout(() => { diff --git a/rice-box.go.REMOVED.git-id b/rice-box.go.REMOVED.git-id index 47752e45..cfc9b1c3 100644 --- a/rice-box.go.REMOVED.git-id +++ b/rice-box.go.REMOVED.git-id @@ -1 +1 @@ -01a4cd8827c117228f6518fd0080cd522cd6bea8 \ No newline at end of file +60f3c5fb4e901be9b2920d60643c26ad4d414706 \ No newline at end of file