From 1e2e0a8d04e55c0ecfb0b1b674792b69fb091415 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 5 Apr 2012 12:01:38 -0700 Subject: Fixing 3d tool reset to redraw handles. Signed-off-by: Nivesh Rajbhandari --- js/tools/Rotate3DToolBase.js | 15 ++++++++------- js/tools/Translate3DToolBase.js | 9 ++++----- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'js') diff --git a/js/tools/Rotate3DToolBase.js b/js/tools/Rotate3DToolBase.js index eb2cdba4..696408bf 100755 --- a/js/tools/Rotate3DToolBase.js +++ b/js/tools/Rotate3DToolBase.js @@ -438,24 +438,23 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, { value : function() { var item, - elt, mat, dist, newStyles = [], previousStyles = [], - len = this._targets.length, + len = this.application.ninja.selectedElements.length, iMat; for(var i = 0; i < len; i++) { // Reset to the identity matrix - item = this._targets[i]; + item = this.application.ninja.selectedElements[i]; iMat = Matrix.I(4); - mat = item.mat; + mat = ElementsMediator.getMatrix(item); // iMat[12] = mat[12]; // iMat[13] = mat[13]; // iMat[14] = mat[14]; - dist = this._undoArray[i].dist; + dist = ElementsMediator.getPerspectiveDist(item); var previousStyleStr = {dist:dist, mat:mat}; @@ -476,8 +475,10 @@ exports.Rotate3DToolBase = Montage.create(ModifierToolBase, { this.isDrawing = false; this.endDraw(event); -// this.UpdateSelection(true); - this.Configure(true); + // Need to force stage to draw immediately so the new selection center is calculated + this.application.ninja.stage.draw(); + // And captureSelectionDrawn to draw the transform handles + this.captureSelectionDrawn(null); } }, diff --git a/js/tools/Translate3DToolBase.js b/js/tools/Translate3DToolBase.js index 948383a3..e4f1fb99 100755 --- a/js/tools/Translate3DToolBase.js +++ b/js/tools/Translate3DToolBase.js @@ -90,22 +90,21 @@ exports.Translate3DToolBase = Montage.create(ModifierToolBase, value : function() { var item, - elt, mat, dist, newStyles = [], previousStyles = [], - len = this._targets.length; + len = this.application.ninja.selectedElements.length; for(var i = 0; i < len; i++) { // Reset to the identity matrix but retain the rotation values - item = this._targets[i]; - mat = item.mat.slice(0); + item = this.application.ninja.selectedElements[i]; + mat = ElementsMediator.getMatrix(item); mat[12] = 0; mat[13] = 0; mat[14] = 0; - dist = this._undoArray[i].dist; + dist = ElementsMediator.getPerspectiveDist(item); var previousStyleStr = {dist:dist, mat:item.mat}; -- cgit v1.2.3