improv: torrent select behavior

This commit is contained in:
Daan Wijns 2021-02-09 08:53:42 +01:00
parent 51fbec1324
commit 058f57e8b2
3 changed files with 7 additions and 6 deletions

View file

@ -3,7 +3,7 @@
flat
class="pointer noselect"
:class="{ selected: isSelected}"
@click.native.prevent="selectMode && selectTorrent(torrent.hash)"
@click.native.exact.prevent="selectMode && selectTorrent(torrent.hash)"
@dblclick.prevent="showInfo(torrent.hash)"
@click.ctrl.exact.prevent="selectTorrent(torrent.hash)"
@click.shift.exact.prevent="selectUntil(torrent.hash, index)"
@ -27,7 +27,8 @@ export default {
},
mixins: [General, TorrentSelect],
props: {
torrent: Object
torrent: Object,
index: Number
},
computed: {
...mapState(['selected_torrents', 'selectMode']),
@ -41,4 +42,4 @@ export default {
}
}
}
</script>
</script>

View file

@ -4,7 +4,7 @@ export default {
return this.$store.getters.containsTorrent(hash)
},
selectTorrent(hash) {
if (!this.$store.state.selectMode) return
if (!this.$store.state.selectMode) this.$store.state.selectMode = true
if (this.isAlreadySelected(hash)) {
this.$store.commit('SET_SELECTED', { type: 'remove', hash })
} else {

View file

@ -128,7 +128,7 @@
</v-card>
</v-expand-x-transition>
<v-list-item-content class="pa-0">
<Torrent :torrent="torrent" />
<Torrent :torrent="torrent" :index="index" />
<v-divider
v-if="index < paginatedData.length - 1"
:key="index"
@ -309,4 +309,4 @@ export default {
padding: 0;
}
}
</style>
</style>