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 flat
class="pointer noselect" class="pointer noselect"
:class="{ selected: isSelected}" :class="{ selected: isSelected}"
@click.native.prevent="selectMode && selectTorrent(torrent.hash)" @click.native.exact.prevent="selectMode && selectTorrent(torrent.hash)"
@dblclick.prevent="showInfo(torrent.hash)" @dblclick.prevent="showInfo(torrent.hash)"
@click.ctrl.exact.prevent="selectTorrent(torrent.hash)" @click.ctrl.exact.prevent="selectTorrent(torrent.hash)"
@click.shift.exact.prevent="selectUntil(torrent.hash, index)" @click.shift.exact.prevent="selectUntil(torrent.hash, index)"
@ -27,7 +27,8 @@ export default {
}, },
mixins: [General, TorrentSelect], mixins: [General, TorrentSelect],
props: { props: {
torrent: Object torrent: Object,
index: Number
}, },
computed: { computed: {
...mapState(['selected_torrents', 'selectMode']), ...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) return this.$store.getters.containsTorrent(hash)
}, },
selectTorrent(hash) { selectTorrent(hash) {
if (!this.$store.state.selectMode) return if (!this.$store.state.selectMode) this.$store.state.selectMode = true
if (this.isAlreadySelected(hash)) { if (this.isAlreadySelected(hash)) {
this.$store.commit('SET_SELECTED', { type: 'remove', hash }) this.$store.commit('SET_SELECTED', { type: 'remove', hash })
} else { } else {

View file

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