mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 05:37:34 +02:00
Merge pull request #498 from overte-org/fix/create_app_perf
Fixed Create App performance when moving objects
This commit is contained in:
commit
6b8f460423
4 changed files with 31 additions and 14 deletions
|
@ -156,7 +156,7 @@
|
||||||
|
|
||||||
selectionManager.addEventListener(function () {
|
selectionManager.addEventListener(function () {
|
||||||
selectionDisplay.updateHandles();
|
selectionDisplay.updateHandles();
|
||||||
entityIconOverlayManager.updatePositions();
|
entityIconOverlayManager.updatePositions(selectionManager.selections);
|
||||||
entityShapeVisualizer.setEntities(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
|
// ignore events that we emitted from the entity list itself
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Otherwise this will emit tens of events every second when objects are moved.
|
||||||
|
if (!isSelectionUpdate) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
var selectedIDs = [];
|
var selectedIDs = [];
|
||||||
|
|
||||||
for (var i = 0; i < that.selectionManager.selections.length; i++) {
|
for (var i = 0; i < that.selectionManager.selections.length; i++) {
|
||||||
|
|
|
@ -1082,8 +1082,8 @@ SelectionDisplay = (function() {
|
||||||
text: "",
|
text: "",
|
||||||
textColor: { red: 0, green: 0, blue: 0 },
|
textColor: { red: 0, green: 0, blue: 0 },
|
||||||
backgroundColor: { red: 255, green: 255, blue: 255 },
|
backgroundColor: { red: 255, green: 255, blue: 255 },
|
||||||
textAlpha: 0.7,
|
textAlpha: 1.0,
|
||||||
backgroundAlpha: 0.7,
|
backgroundAlpha: 1.0,
|
||||||
visible: false,
|
visible: false,
|
||||||
billboardMode: "full",
|
billboardMode: "full",
|
||||||
renderLayer: "front",
|
renderLayer: "front",
|
||||||
|
|
|
@ -16,20 +16,33 @@ EntityIconOverlayManager = function(entityTypes, getOverlayPropertiesFunc) {
|
||||||
// Map from EntityItemID to EntityItemID object
|
// Map from EntityItemID to EntityItemID object
|
||||||
var entityIDs = {};
|
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) {
|
this.updatePositions = function(ids) {
|
||||||
for (var id in entityIDs) {
|
if (ids) {
|
||||||
var entityID = entityIDs[id];
|
for (var index in ids) {
|
||||||
var properties = Entities.getEntityProperties(entityID);
|
var id = ids[index];
|
||||||
var overlayProperties = {
|
if (entityIDs[id]) {
|
||||||
position: properties.position
|
updateEntity(entityIDs[id]);
|
||||||
};
|
|
||||||
if (getOverlayPropertiesFunc) {
|
|
||||||
var customProperties = getOverlayPropertiesFunc(entityID, properties);
|
|
||||||
for (var key in customProperties) {
|
|
||||||
overlayProperties[key] = customProperties[key];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Entities.editEntity(entityOverlays[entityID], overlayProperties);
|
} else {
|
||||||
|
for (var id in entityIDs) {
|
||||||
|
var entityID = entityIDs[id];
|
||||||
|
updateEntity(entityID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue