Disallow entity models to be reset to natural dimensions if unknown

This commit is contained in:
Ryan Huffman 2015-02-13 15:00:37 -08:00
parent 6c8a78a9a7
commit 0495833ca6

View file

@ -957,9 +957,18 @@ PropertiesTool = function(opts) {
selectionManager.saveProperties();
for (var i = 0; i < selectionManager.selections.length; i++) {
var properties = selectionManager.savedProperties[selectionManager.selections[i].id];
Entities.editEntity(selectionManager.selections[i], {
dimensions: properties.naturalDimensions,
});
var naturalDimensions = properties.naturalDimensions;
// If any of the natural dimensions are not 0, resize
if (properties.type == "Model" && naturalDimensions.x == 0
&& naturalDimensions.y == 0 || naturalDimensions.z == 0) {
Window.alert("Cannot reset entity to its natural dimensions: Model URL"
+ " is invalid or the model has not yet been loaded.");
} else {
Entities.editEntity(selectionManager.selections[i], {
dimensions: properties.naturalDimensions,
});
}
}
pushCommandForSelections();
selectionManager._update();