diff options
Diffstat (limited to 'js/tools/SelectionTool.js')
-rwxr-xr-x | js/tools/SelectionTool.js | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js index 3db51501..ea2379bb 100755 --- a/js/tools/SelectionTool.js +++ b/js/tools/SelectionTool.js | |||
@@ -223,8 +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.breadCrumbClick = true; | 226 | this.application.ninja.currentSelectedContainer = this.application.ninja.selectedElements[0]; |
227 | this.application.ninja.currentSelectedContainer = this.application.ninja.selectedElements[0]._element; | ||
228 | } else { | 227 | } else { |
229 | this.application.ninja.breadCrumbClick = true; | 228 | this.application.ninja.breadCrumbClick = true; |
230 | this.application.ninja.currentSelectedContainer = this.application.ninja.currentDocument.documentRoot; | 229 | this.application.ninja.currentSelectedContainer = this.application.ninja.currentDocument.documentRoot; |
@@ -244,8 +243,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
244 | case Keyboard.LEFT: | 243 | case Keyboard.LEFT: |
245 | var newLeft = []; | 244 | var newLeft = []; |
246 | var leftArr = this.application.ninja.selectedElements.map(function(item) { | 245 | var leftArr = this.application.ninja.selectedElements.map(function(item) { |
247 | newLeft.push( (parseInt(ElementsMediator.getProperty(item._element, "left")) - inc) + "px" ); | 246 | newLeft.push( (parseInt(ElementsMediator.getProperty(item, "left")) - inc) + "px" ); |
248 | return ElementsMediator.getProperty(item._element, "left"); | 247 | return ElementsMediator.getProperty(item, "left"); |
249 | }); | 248 | }); |
250 | 249 | ||
251 | ElementsMediator.setProperty(this.application.ninja.selectedElements, "left", newLeft , "Change", "selectionTool", leftArr); | 250 | ElementsMediator.setProperty(this.application.ninja.selectedElements, "left", newLeft , "Change", "selectionTool", leftArr); |
@@ -253,8 +252,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
253 | case Keyboard.UP: | 252 | case Keyboard.UP: |
254 | var newTop = []; | 253 | var newTop = []; |
255 | var topArr = this.application.ninja.selectedElements.map(function(item) { | 254 | var topArr = this.application.ninja.selectedElements.map(function(item) { |
256 | newTop.push( (parseInt(ElementsMediator.getProperty(item._element, "top")) - inc) + "px" ); | 255 | newTop.push( (parseInt(ElementsMediator.getProperty(item, "top")) - inc) + "px" ); |
257 | return ElementsMediator.getProperty(item._element, "top"); | 256 | return ElementsMediator.getProperty(item, "top"); |
258 | }); | 257 | }); |
259 | 258 | ||
260 | ElementsMediator.setProperty(this.application.ninja.selectedElements, "top", newTop , "Change", "selectionTool", topArr); | 259 | ElementsMediator.setProperty(this.application.ninja.selectedElements, "top", newTop , "Change", "selectionTool", topArr); |
@@ -262,8 +261,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
262 | case Keyboard.RIGHT: | 261 | case Keyboard.RIGHT: |
263 | var newLeft = []; | 262 | var newLeft = []; |
264 | var leftArr = this.application.ninja.selectedElements.map(function(item) { | 263 | var leftArr = this.application.ninja.selectedElements.map(function(item) { |
265 | newLeft.push( (parseInt(ElementsMediator.getProperty(item._element, "left")) + inc) + "px" ); | 264 | newLeft.push( (parseInt(ElementsMediator.getProperty(item, "left")) + inc) + "px" ); |
266 | return ElementsMediator.getProperty(item._element, "left"); | 265 | return ElementsMediator.getProperty(item, "left"); |
267 | }); | 266 | }); |
268 | 267 | ||
269 | ElementsMediator.setProperty(this.application.ninja.selectedElements, "left", newLeft , "Change", "selectionTool", leftArr); | 268 | ElementsMediator.setProperty(this.application.ninja.selectedElements, "left", newLeft , "Change", "selectionTool", leftArr); |
@@ -271,8 +270,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
271 | case Keyboard.DOWN: | 270 | case Keyboard.DOWN: |
272 | var newTop = []; | 271 | var newTop = []; |
273 | var topArr = this.application.ninja.selectedElements.map(function(item) { | 272 | var topArr = this.application.ninja.selectedElements.map(function(item) { |
274 | newTop.push( (parseInt(ElementsMediator.getProperty(item._element, "top")) + inc) + "px" ); | 273 | newTop.push( (parseInt(ElementsMediator.getProperty(item, "top")) + inc) + "px" ); |
275 | return ElementsMediator.getProperty(item._element, "top"); | 274 | return ElementsMediator.getProperty(item, "top"); |
276 | }); | 275 | }); |
277 | 276 | ||
278 | ElementsMediator.setProperty(this.application.ninja.selectedElements, "top", newTop , "Change", "selectionTool", topArr); | 277 | ElementsMediator.setProperty(this.application.ninja.selectedElements, "top", newTop , "Change", "selectionTool", topArr); |
@@ -310,19 +309,15 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
310 | previousStyles = []; | 309 | previousStyles = []; |
311 | var len = this.application.ninja.selectedElements.length; | 310 | var len = this.application.ninja.selectedElements.length; |
312 | this._targets = []; | 311 | this._targets = []; |
313 | for(var i = 0; i < len; i++) | 312 | for(var i = 0; i < len; i++) { |
314 | { | 313 | var elt = this.application.ninja.selectedElements[i]; |
315 | var elt = this.application.ninja.selectedElements[i]._element; | ||
316 | 314 | ||
317 | var curMat = viewUtils.getMatrixFromElement(elt); | 315 | var curMat = viewUtils.getMatrixFromElement(elt); |
318 | var curMatInv = glmat4.inverse(curMat, []); | 316 | var curMatInv = glmat4.inverse(curMat, []); |
319 | 317 | ||
320 | this._targets.push({elt:elt, mat:curMat, matInv:curMatInv}); | 318 | this._targets.push({elt:elt, mat:curMat, matInv:curMatInv}); |
321 | if(addToUndoStack) | 319 | if(addToUndoStack) { |
322 | { | 320 | if(!this._use3DMode) { |
323 | |||
324 | if(!this._use3DMode) | ||
325 | { | ||
326 | var previousMat = this._undoArray[i].mat.slice(0); | 321 | var previousMat = this._undoArray[i].mat.slice(0); |
327 | var prevX = this._undoArray[i]._x; | 322 | var prevX = this._undoArray[i]._x; |
328 | var prevY = this._undoArray[i]._y; | 323 | var prevY = this._undoArray[i]._y; |
@@ -346,9 +341,7 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
346 | 341 | ||
347 | this._targets[i].mat = previousMat; | 342 | this._targets[i].mat = previousMat; |
348 | this._targets[i].matInv = glmat4.inverse(previousMat, []); | 343 | this._targets[i].matInv = glmat4.inverse(previousMat, []); |
349 | } | 344 | } else { |
350 | else | ||
351 | { | ||
352 | var previousMat = this._undoArray[i].mat.slice(0); | 345 | var previousMat = this._undoArray[i].mat.slice(0); |
353 | var prevW = this._undoArray[i]._w; | 346 | var prevW = this._undoArray[i]._w; |
354 | var prevH = this._undoArray[i]._h; | 347 | var prevH = this._undoArray[i]._h; |