mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 04:44:11 +02:00
fix deselecting entity when re-clicking row, fix ctrl/shift selections
This commit is contained in:
parent
046a4e4041
commit
4204adf60f
1 changed files with 9 additions and 4 deletions
|
@ -191,7 +191,8 @@ function loaded() {
|
|||
if (clickEvent.ctrlKey) {
|
||||
let selectedIndex = selectedEntities.indexOf(entityID);
|
||||
if (selectedIndex >= 0) {
|
||||
selection = selectedEntities;
|
||||
selection = [];
|
||||
selection = selection.concat(selectedEntities);
|
||||
selection.splice(selectedIndex, 1)
|
||||
} else {
|
||||
selection = selection.concat(selectedEntities);
|
||||
|
@ -210,15 +211,19 @@ function loaded() {
|
|||
if (previousItemFound !== -1 && clickedItemFound !== -1) {
|
||||
let betweenItems = [];
|
||||
let toItem = Math.max(previousItemFound, clickedItemFound);
|
||||
// skip first and last item in this loop, we add them to selection after the loop
|
||||
for (let i = (Math.min(previousItemFound, clickedItemFound) + 1); i < toItem; i++) {
|
||||
for (let i = Math.min(previousItemFound, clickedItemFound); i <= toItem; i++) {
|
||||
betweenItems.push(visibleEntities[i].id);
|
||||
}
|
||||
if (previousItemFound > clickedItemFound) {
|
||||
// always make sure that we add the items in the right order
|
||||
betweenItems.reverse();
|
||||
}
|
||||
selection = selection.concat(betweenItems, selectedEntities);
|
||||
selection = betweenItems;
|
||||
}
|
||||
} else if (!clickEvent.ctrlKey && !clickEvent.shiftKey && selectedEntities.length === 1) {
|
||||
// if reselecting the same entity then deselect it
|
||||
if (selectedEntities[0] === entityID) {
|
||||
selection = [];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue