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

This commit is contained in:
Henrique Dias 2017-08-24 09:14:26 +01:00
parent 9301966eb7
commit 297a52e606
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
2 changed files with 305 additions and 300 deletions

View File

@ -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(() => {

File diff suppressed because one or more lines are too long