Fix entity list selection failing when selecting entities not in list

This commit is contained in:
Ryan Huffman 2018-09-18 11:08:40 -07:00
parent 3b1e0dc7d9
commit 72adfb7ff0

View file

@ -161,7 +161,10 @@ function loaded() {
selectedEntities.forEach(function(entityID) { selectedEntities.forEach(function(entityID) {
if (selection.indexOf(entityID) === -1) { if (selection.indexOf(entityID) === -1) {
entitiesByID[entityID].el.className = ''; let entity = entitiesByID[entityID];
if (entity !== undefined) {
entity.el.className = '';
}
} }
}); });
@ -385,15 +388,18 @@ function loaded() {
let notFound = false; let notFound = false;
selectedEntities.forEach(function(id) { selectedEntities.forEach(function(id) {
entitiesByID[id].el.className = ''; let entity = entitiesByID[id];
if (entity !== undefined) {
entity.el.className = '';
}
}); });
selectedEntities = []; selectedEntities = [];
for (let i = 0; i < selectedIDs.length; i++) { for (let i = 0; i < selectedIDs.length; i++) {
let id = selectedIDs[i]; let id = selectedIDs[i];
selectedEntities.push(id); selectedEntities.push(id);
if (id in entitiesByID) { let entity = entitiesByID[id];
let entity = entitiesByID[id]; if (entity !== undefined) {
entity.el.className = 'selected'; entity.el.className = 'selected';
} else { } else {
notFound = true; notFound = true;