aboutsummaryrefslogtreecommitdiff
path: root/js/tools/SelectionTool.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-04-04 11:50:54 -0700
committerJose Antonio Marquez2012-04-04 11:50:54 -0700
commit0a469a14757b8cea262c21f652e75c85c9903f4b (patch)
treec388fdc93e9707e7d66f51ef41eb1d9b366716c7 /js/tools/SelectionTool.js
parent6034e3aa1d033149ba9ca8f0578e0a95889a7e46 (diff)
parent8482e23cd9b8c4700b5130f2588e5eb24d376536 (diff)
downloadninja-0a469a14757b8cea262c21f652e75c85c9903f4b.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into FileIO
Diffstat (limited to 'js/tools/SelectionTool.js')
-rwxr-xr-xjs/tools/SelectionTool.js34
1 files changed, 14 insertions, 20 deletions
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js
index f9411f48..cff14226 100755
--- a/js/tools/SelectionTool.js
+++ b/js/tools/SelectionTool.js
@@ -223,7 +223,7 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
223 HandleDoubleClick: { 223 HandleDoubleClick: {
224 value: function(event) { 224 value: function(event) {
225 if(this.application.ninja.selectedElements.length > 0) { 225 if(this.application.ninja.selectedElements.length > 0) {
226 this.application.ninja.currentSelectedContainer = this.application.ninja.selectedElements[0]._element; 226 this.application.ninja.currentSelectedContainer = this.application.ninja.selectedElements[0];
227 } else { 227 } else {
228 this.application.ninja.currentSelectedContainer = this.application.ninja.currentDocument.documentRoot; 228 this.application.ninja.currentSelectedContainer = this.application.ninja.currentDocument.documentRoot;
229 } 229 }
@@ -242,8 +242,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
242 case Keyboard.LEFT: 242 case Keyboard.LEFT:
243 var newLeft = []; 243 var newLeft = [];
244 var leftArr = this.application.ninja.selectedElements.map(function(item) { 244 var leftArr = this.application.ninja.selectedElements.map(function(item) {
245 newLeft.push( (parseInt(ElementsMediator.getProperty(item._element, "left")) - inc) + "px" ); 245 newLeft.push( (parseInt(ElementsMediator.getProperty(item, "left")) - inc) + "px" );
246 return ElementsMediator.getProperty(item._element, "left"); 246 return ElementsMediator.getProperty(item, "left");
247 }); 247 });
248 248
249 ElementsMediator.setProperty(this.application.ninja.selectedElements, "left", newLeft , "Change", "selectionTool", leftArr); 249 ElementsMediator.setProperty(this.application.ninja.selectedElements, "left", newLeft , "Change", "selectionTool", leftArr);
@@ -251,8 +251,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
251 case Keyboard.UP: 251 case Keyboard.UP:
252 var newTop = []; 252 var newTop = [];
253 var topArr = this.application.ninja.selectedElements.map(function(item) { 253 var topArr = this.application.ninja.selectedElements.map(function(item) {
254 newTop.push( (parseInt(ElementsMediator.getProperty(item._element, "top")) - inc) + "px" ); 254 newTop.push( (parseInt(ElementsMediator.getProperty(item, "top")) - inc) + "px" );
255 return ElementsMediator.getProperty(item._element, "top"); 255 return ElementsMediator.getProperty(item, "top");
256 }); 256 });
257 257
258 ElementsMediator.setProperty(this.application.ninja.selectedElements, "top", newTop , "Change", "selectionTool", topArr); 258 ElementsMediator.setProperty(this.application.ninja.selectedElements, "top", newTop , "Change", "selectionTool", topArr);
@@ -260,8 +260,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
260 case Keyboard.RIGHT: 260 case Keyboard.RIGHT:
261 var newLeft = []; 261 var newLeft = [];
262 var leftArr = this.application.ninja.selectedElements.map(function(item) { 262 var leftArr = this.application.ninja.selectedElements.map(function(item) {
263 newLeft.push( (parseInt(ElementsMediator.getProperty(item._element, "left")) + inc) + "px" ); 263 newLeft.push( (parseInt(ElementsMediator.getProperty(item, "left")) + inc) + "px" );
264 return ElementsMediator.getProperty(item._element, "left"); 264 return ElementsMediator.getProperty(item, "left");
265 }); 265 });
266 266
267 ElementsMediator.setProperty(this.application.ninja.selectedElements, "left", newLeft , "Change", "selectionTool", leftArr); 267 ElementsMediator.setProperty(this.application.ninja.selectedElements, "left", newLeft , "Change", "selectionTool", leftArr);
@@ -269,8 +269,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
269 case Keyboard.DOWN: 269 case Keyboard.DOWN:
270 var newTop = []; 270 var newTop = [];
271 var topArr = this.application.ninja.selectedElements.map(function(item) { 271 var topArr = this.application.ninja.selectedElements.map(function(item) {
272 newTop.push( (parseInt(ElementsMediator.getProperty(item._element, "top")) + inc) + "px" ); 272 newTop.push( (parseInt(ElementsMediator.getProperty(item, "top")) + inc) + "px" );
273 return ElementsMediator.getProperty(item._element, "top"); 273 return ElementsMediator.getProperty(item, "top");
274 }); 274 });
275 275
276 ElementsMediator.setProperty(this.application.ninja.selectedElements, "top", newTop , "Change", "selectionTool", topArr); 276 ElementsMediator.setProperty(this.application.ninja.selectedElements, "top", newTop , "Change", "selectionTool", topArr);
@@ -308,19 +308,15 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
308 previousStyles = []; 308 previousStyles = [];
309 var len = this.application.ninja.selectedElements.length; 309 var len = this.application.ninja.selectedElements.length;
310 this._targets = []; 310 this._targets = [];
311 for(var i = 0; i < len; i++) 311 for(var i = 0; i < len; i++) {
312 { 312 var elt = this.application.ninja.selectedElements[i];
313 var elt = this.application.ninja.selectedElements[i]._element;
314 313
315 var curMat = viewUtils.getMatrixFromElement(elt); 314 var curMat = viewUtils.getMatrixFromElement(elt);
316 var curMatInv = glmat4.inverse(curMat, []); 315 var curMatInv = glmat4.inverse(curMat, []);
317 316
318 this._targets.push({elt:elt, mat:curMat, matInv:curMatInv}); 317 this._targets.push({elt:elt, mat:curMat, matInv:curMatInv});
319 if(addToUndoStack) 318 if(addToUndoStack) {
320 { 319 if(!this._use3DMode) {
321
322 if(!this._use3DMode)
323 {
324 var previousMat = this._undoArray[i].mat.slice(0); 320 var previousMat = this._undoArray[i].mat.slice(0);
325 var prevX = this._undoArray[i]._x; 321 var prevX = this._undoArray[i]._x;
326 var prevY = this._undoArray[i]._y; 322 var prevY = this._undoArray[i]._y;
@@ -344,9 +340,7 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
344 340
345 this._targets[i].mat = previousMat; 341 this._targets[i].mat = previousMat;
346 this._targets[i].matInv = glmat4.inverse(previousMat, []); 342 this._targets[i].matInv = glmat4.inverse(previousMat, []);
347 } 343 } else {
348 else
349 {
350 var previousMat = this._undoArray[i].mat.slice(0); 344 var previousMat = this._undoArray[i].mat.slice(0);
351 var prevW = this._undoArray[i]._w; 345 var prevW = this._undoArray[i]._w;
352 var prevH = this._undoArray[i]._h; 346 var prevH = this._undoArray[i]._h;