Merge pull request #14041 from huffman/fix/entity-list-no-highlight-74

Fix entity list selection failing when selecting entities not in list
This commit is contained in:
John Conklin II 2018-09-24 11:02:36 -07:00 committed by GitHub
commit 9916496118
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -164,7 +164,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 = '';
}
} }
}); });
@ -388,15 +391,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;