mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Fixed performance issues in Create App
This commit is contained in:
parent
acdeb549f8
commit
f33c270bab
3 changed files with 29 additions and 12 deletions
|
@ -156,7 +156,7 @@
|
|||
|
||||
selectionManager.addEventListener(function () {
|
||||
selectionDisplay.updateHandles();
|
||||
entityIconOverlayManager.updatePositions();
|
||||
entityIconOverlayManager.updatePositions(selectionManager.selections);
|
||||
entityShapeVisualizer.setEntities(selectionManager.selections);
|
||||
});
|
||||
|
||||
|
|
|
@ -109,6 +109,10 @@ var EntityListTool = function(shouldUseEditTabletApp, selectionManager) {
|
|||
// ignore events that we emitted from the entity list itself
|
||||
return;
|
||||
}
|
||||
// Otherwise this will emit tens of events every second when objects are moved.
|
||||
if (!isSelectionUpdate) {
|
||||
return;
|
||||
}
|
||||
var selectedIDs = [];
|
||||
|
||||
for (var i = 0; i < that.selectionManager.selections.length; i++) {
|
||||
|
|
|
@ -16,20 +16,33 @@ EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) {
|
|||
// Map from EntityItemID to EntityItemID object
|
||||
var entityIDs = {};
|
||||
|
||||
function updateEntity(entityID) {
|
||||
var properties = Entities.getEntityProperties(entityID);
|
||||
var overlayProperties = {
|
||||
position: properties.position
|
||||
};
|
||||
if (getOverlayPropertiesFunc) {
|
||||
var customProperties = getOverlayPropertiesFunc(entityID, properties);
|
||||
for (var key in customProperties) {
|
||||
overlayProperties[key] = customProperties[key];
|
||||
}
|
||||
}
|
||||
Entities.editEntity(entityOverlays[entityID], overlayProperties);
|
||||
}
|
||||
|
||||
this.updatePositions = function(ids) {
|
||||
for (var id in entityIDs) {
|
||||
var entityID = entityIDs[id];
|
||||
var properties = Entities.getEntityProperties(entityID);
|
||||
var overlayProperties = {
|
||||
position: properties.position
|
||||
};
|
||||
if (getOverlayPropertiesFunc) {
|
||||
var customProperties = getOverlayPropertiesFunc(entityID, properties);
|
||||
for (var key in customProperties) {
|
||||
overlayProperties[key] = customProperties[key];
|
||||
if (ids) {
|
||||
for (var index in ids) {
|
||||
var id = ids[index];
|
||||
if (entityIDs[id]) {
|
||||
updateEntity(entityIDs[id]);
|
||||
}
|
||||
}
|
||||
Entities.editEntity(entityOverlays[entityID], overlayProperties);
|
||||
} else {
|
||||
for (var id in entityIDs) {
|
||||
var entityID = entityIDs[id];
|
||||
updateEntity(entityID);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue