mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-13 04:49:02 +02:00
Fix Create app using naturalDimensions for all entity types.
This commit is contained in:
parent
41c961198c
commit
3c21a4d3f6
1 changed files with 11 additions and 3 deletions
|
@ -578,8 +578,8 @@ var toolBar = (function () {
|
|||
|
||||
entityID = Entities.addEntity(properties);
|
||||
|
||||
var POST_ADJUST_ENTITY_TYPES = ["Model"];
|
||||
var dimensionsCheckCallback = function(){
|
||||
var POST_ADJUST_ENTITY_TYPES = ["Model"];
|
||||
if (POST_ADJUST_ENTITY_TYPES.indexOf(properties.type) !== -1) {
|
||||
// Adjust position of entity per bounding box after it has been created and auto-resized.
|
||||
var initialDimensions = Entities.getEntityProperties(entityID, ["dimensions"]).dimensions;
|
||||
|
@ -613,10 +613,18 @@ var toolBar = (function () {
|
|||
var entityIsLoadedCheck = function() {
|
||||
isLoadedCheckCount++;
|
||||
if (isLoadedCheckCount === MAX_LOADED_CHECKS || Entities.isLoaded(entityID)) {
|
||||
var naturalDimensions = Entities.getEntityProperties(entityID, "naturalDimensions").naturalDimensions
|
||||
var dimensionsToUse;
|
||||
if (POST_ADJUST_ENTITY_TYPES.indexOf(properties.type) !== -1) {
|
||||
// If it is a "Model", use natural dimensions...
|
||||
dimensionsToUse = Entities.getEntityProperties(entityID, "naturalDimensions").naturalDimensions;
|
||||
} else {
|
||||
// If it is not a "Model", use local dimensions...
|
||||
dimensionsToUse = Entities.getEntityProperties(entityID, "localDimensions").localDimensions;
|
||||
}
|
||||
|
||||
Entities.editEntity(entityID, {
|
||||
visible: true,
|
||||
dimensions: naturalDimensions
|
||||
dimensions: dimensionsToUse
|
||||
})
|
||||
dimensionsCheckCallback();
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue