mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 12:14:00 +02:00
Remove entity from list when it deletes; handle multiple deletions
This commit is contained in:
parent
5a064d3499
commit
f27e363b68
2 changed files with 27 additions and 1 deletions
|
@ -471,8 +471,23 @@ var toolBar = (function () {
|
|||
}
|
||||
}
|
||||
|
||||
var entitiesToDelete = [];
|
||||
var deletedEntityTimer = null;
|
||||
var DELETE_ENTITY_TIMER_TIMEOUT = 100;
|
||||
|
||||
function checkDeletedEntityAndUpdate(entityID) {
|
||||
selectionManager.removeEntity(entityID);
|
||||
// Allow for multiple entity deletes before updating the entity list.
|
||||
entitiesToDelete.push(entityID);
|
||||
if (deletedEntityTimer !== null) {
|
||||
Script.clearTimeout(deletedEntityTimer);
|
||||
}
|
||||
deletedEntityTimer = Script.setTimeout(function () {
|
||||
selectionManager.removeEntities(entitiesToDelete);
|
||||
entityListTool.clearEntityList();
|
||||
entityListTool.sendUpdate();
|
||||
entitiesToDelete = [];
|
||||
deletedEntityTimer = null;
|
||||
}, DELETE_ENTITY_TIMER_TIMEOUT);
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
|
|
|
@ -149,6 +149,17 @@ SelectionManager = (function() {
|
|||
that._update(true);
|
||||
};
|
||||
|
||||
that.removeEntities = function (entityIDs) {
|
||||
for (var i = 0, length = entityIDs.length; i < length; i++) {
|
||||
var idx = that.selections.indexOf(entityIDs[i]);
|
||||
if (idx >= 0) {
|
||||
that.selections.splice(idx, 1);
|
||||
Selection.removeFromSelectedItemsList(HIGHLIGHT_LIST_NAME, "entity", entityIDs[i]);
|
||||
}
|
||||
}
|
||||
that._update(true);
|
||||
};
|
||||
|
||||
that.clearSelections = function() {
|
||||
that.selections = [];
|
||||
that._update(true);
|
||||
|
|
Loading…
Reference in a new issue