aboutsummaryrefslogtreecommitdiff
path: root/js/tools/SelectionTool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/SelectionTool.js')
-rwxr-xr-xjs/tools/SelectionTool.js47
1 files changed, 26 insertions, 21 deletions
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js
index f9411f48..e252e36b 100755
--- a/js/tools/SelectionTool.js
+++ b/js/tools/SelectionTool.js
@@ -318,18 +318,28 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
318 this._targets.push({elt:elt, mat:curMat, matInv:curMatInv}); 318 this._targets.push({elt:elt, mat:curMat, matInv:curMatInv});
319 if(addToUndoStack) 319 if(addToUndoStack)
320 { 320 {
321 var prevX,
322 prevY,
323 prevW,
324 prevH,
325 _x,
326 _y,
327 _w,
328 _h,
329 previousMat,
330 previousStyleStr,
331 newStyleStr;
321 332
322 if(!this._use3DMode) 333 if(!this._use3DMode)
323 { 334 {
324 var previousMat = this._undoArray[i].mat.slice(0); 335 prevX = this._undoArray[i]._x;
325 var prevX = this._undoArray[i]._x; 336 prevY = this._undoArray[i]._y;
326 var prevY = this._undoArray[i]._y; 337 prevW = this._undoArray[i]._w;
327 var prevW = this._undoArray[i]._w; 338 prevH = this._undoArray[i]._h;
328 var prevH = this._undoArray[i]._h; 339 _x = parseInt(ElementsMediator.getProperty(elt, "left"));
329 var _x = parseInt(ElementsMediator.getProperty(elt, "left")) + curMat[12] - previousMat[12]; 340 _y = parseInt(ElementsMediator.getProperty(elt, "top"));
330 var _y = parseInt(ElementsMediator.getProperty(elt, "top")) + curMat[13] - previousMat[13]; 341 _w = parseInt(ElementsMediator.getProperty(elt, "width"));
331 var _w = parseInt(ElementsMediator.getProperty(elt, "width")); 342 _h = parseInt(ElementsMediator.getProperty(elt, "height"));
332 var _h = parseInt(ElementsMediator.getProperty(elt, "height"));
333 343
334 previousLeft.push(prevX + "px"); 344 previousLeft.push(prevX + "px");
335 previousTop.push(prevY + "px"); 345 previousTop.push(prevY + "px");
@@ -339,27 +349,22 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
339 newTop.push(_y + "px"); 349 newTop.push(_y + "px");
340 newWidth.push(_w + "px"); 350 newWidth.push(_w + "px");
341 newHeight.push(_h + "px"); 351 newHeight.push(_h + "px");
342
343 viewUtils.setMatrixForElement(elt, previousMat);
344
345 this._targets[i].mat = previousMat;
346 this._targets[i].matInv = glmat4.inverse(previousMat, []);
347 } 352 }
348 else 353 else
349 { 354 {
350 var previousMat = this._undoArray[i].mat.slice(0); 355 previousMat = this._undoArray[i].mat.slice(0);
351 var prevW = this._undoArray[i]._w; 356 prevW = this._undoArray[i]._w;
352 var prevH = this._undoArray[i]._h; 357 prevH = this._undoArray[i]._h;
353 var _w = parseInt(ElementsMediator.getProperty(elt, "width")); 358 _w = parseInt(ElementsMediator.getProperty(elt, "width"));
354 var _h = parseInt(ElementsMediator.getProperty(elt, "height")); 359 _h = parseInt(ElementsMediator.getProperty(elt, "height"));
355 previousWidth.push(prevW + "px"); 360 previousWidth.push(prevW + "px");
356 previousHeight.push(prevH + "px"); 361 previousHeight.push(prevH + "px");
357 newWidth.push(_w + "px"); 362 newWidth.push(_w + "px");
358 newHeight.push(_h + "px"); 363 newHeight.push(_h + "px");
359 364
360 var previousStyleStr = {dist:this._undoArray[i].dist, 365 previousStyleStr = {dist:this._undoArray[i].dist,
361 mat:MathUtils.scientificToDecimal(previousMat, 5)}; 366 mat:MathUtils.scientificToDecimal(previousMat, 5)};
362 var newStyleStr = {dist:viewUtils.getPerspectiveDistFromElement(elt), 367 newStyleStr = {dist:viewUtils.getPerspectiveDistFromElement(elt),
363 mat:MathUtils.scientificToDecimal(curMat, 5)}; 368 mat:MathUtils.scientificToDecimal(curMat, 5)};
364 previousStyles.push(previousStyleStr); 369 previousStyles.push(previousStyleStr);
365 newStyles.push(newStyleStr); 370 newStyles.push(newStyleStr);