Skip to content

Commit

Permalink
Close selection mode if another section opens theirs
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Dec 10, 2024
1 parent 1462755 commit 20a9fc0
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions panel/src/components/Sections/ModelsSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ export default {
this.reload();
}
},
created() {
this.$events.on("selecting", this.stopSelectingCollision);
},
destroyed() {
this.$events.off("selecting", this.stopSelectingCollision);
},
mounted() {
this.search = debounce(this.search, 200);
this.load();
Expand Down Expand Up @@ -313,14 +319,23 @@ export default {
}
},
onSelectToggle() {
this.isSelecting = !this.isSelecting;
// start new selection with a fresh list
if (this.isSelecting) {
this.selected = [];
}
this.isSelecting ? this.stopSelecting() : this.startSelecting();
},
onSort() {},
startSelecting() {
this.isSelecting = true;
this.selected = [];
this.$events.emit("selecting", this.name);
},
stopSelecting() {
this.isSelecting = false;
this.selected = [];
},
stopSelectingCollision(name) {
if (name !== this.name) {
this.stopSelecting();
}
},
async reload() {
await this.load(true);
},
Expand Down

0 comments on commit 20a9fc0

Please sign in to comment.