Implement SHIFT+Click to select range of files. #206

Former-commit-id: 15da15e0588d5977b42f71b8c96980248db73889 [formerly 95e464410bb619f4ff70b21d846e937bf9355e8a] [formerly cae63a6f6de24229ff04392fe16260c0d9045e8c [formerly 297a52e606]]
Former-commit-id: de9d291dba6c2e2d750c519f1fcbd59c34538ab1 [formerly 4fb3fcf8ba5726f6dde56fcbd8c1457799539a8e]
Former-commit-id: ad1568f33fa927dc750515856950b95b588d9f68
This commit is contained in:
Henrique Dias 2017-08-24 09:14:26 +01:00
parent 58af3461a8
commit ac044016ee
2 changed files with 12 additions and 7 deletions

View File

@ -115,15 +115,20 @@ export default {
}, },
click: function (event) { click: function (event) {
if (this.selectedCount !== 0) event.preventDefault() if (this.selectedCount !== 0) event.preventDefault()
if (this.$store.state.selected.indexOf(this.index) === -1) { if (this.$store.state.selected.indexOf(this.index) !== -1) {
if (!event.ctrlKey && !this.$store.state.multiple) this.resetSelected()
this.addSelected(this.index)
} else {
this.removeSelected(this.index) 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) { touchstart (event) {
setTimeout(() => { setTimeout(() => {

View File

@ -1 +1 @@
01a4cd8827c117228f6518fd0080cd522cd6bea8 60f3c5fb4e901be9b2920d60643c26ad4d414706