Reorganize selectionManager selection checking

This commit is contained in:
Ryan Huffman 2014-12-12 15:35:39 -08:00
parent dde9b92dbd
commit 2fab404f7f

View file

@ -1024,9 +1024,7 @@ PropertiesTool = function(opts) {
selectionManager._update();
} else if (data.type == "action") {
if (data.action == "moveSelectionToGrid") {
if (!selectionManager.hasSelection()) {
return;
}
if (selectionManager.hasSelection()) {
selectionManager.saveProperties();
var dY = grid.getOrigin().y - (selectionManager.worldPosition.y - selectionManager.worldDimensions.y / 2),
var diff = { x: 0, y: dY, z: 0 };
@ -1039,10 +1037,9 @@ PropertiesTool = function(opts) {
}
pushCommandForSelections();
selectionManager._update();
} else if (data.action == "moveAllToGrid") {
if (!selectionManager.hasSelection()) {
return;
}
} else if (data.action == "moveAllToGrid") {
if (selectionManager.hasSelection()) {
selectionManager.saveProperties();
for (var i = 0; i < selectionManager.selections.length; i++) {
var properties = selectionManager.savedProperties[selectionManager.selections[i].id];
@ -1056,10 +1053,9 @@ PropertiesTool = function(opts) {
}
pushCommandForSelections();
selectionManager._update();
} else if (data.action == "resetToNaturalDimensions") {
if (!selectionManager.hasSelection()) {
return;
}
} else if (data.action == "resetToNaturalDimensions") {
if (selectionManager.hasSelection()) {
selectionManager.saveProperties();
for (var i = 0; i < selectionManager.selections.length; i++) {
var properties = selectionManager.savedProperties[selectionManager.selections[i].id];
@ -1071,6 +1067,7 @@ PropertiesTool = function(opts) {
selectionManager._update();
}
}
}
});
return that;