From a0d18963d746e410511c29edd32bc1775d2d5851 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 19 Jun 2012 15:42:31 -0700 Subject: IKNINJA-1519 - Transform tool does not transform objects correctly in 3D space or in Top/Side view. Signed-off-by: Nivesh Rajbhandari --- js/tools/SelectionTool.js | 7 ++----- js/tools/ToolBase.js | 2 ++ js/tools/drawing-tool-base.js | 11 +++++++++-- js/tools/modifier-tool-base.js | 17 ++++++++--------- 4 files changed, 21 insertions(+), 16 deletions(-) (limited to 'js') diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js index 8b644d4a..9bd885a4 100755 --- a/js/tools/SelectionTool.js +++ b/js/tools/SelectionTool.js @@ -583,11 +583,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { this.mouseUpHitRec = DrawingToolBase.getUpdatedSnapPoint(point.x, point.y, do3DSnap, this.mouseDownHitRec); if (this._mouseDownHitRec && this._mouseUpHitRec) { - data = this.getDrawingData(event); - if(data) - { - this.modifyElements({pt0:data.mouseDownPos, pt1:data.mouseUpPos}, event); - } + this.modifyElements({pt0:this._mouseDownHitRec.calculateElementScreenPoint(), + pt1:this._mouseUpHitRec.calculateElementScreenPoint()}, event); } } } diff --git a/js/tools/ToolBase.js b/js/tools/ToolBase.js index f43b1b58..88333c74 100755 --- a/js/tools/ToolBase.js +++ b/js/tools/ToolBase.js @@ -35,6 +35,8 @@ exports.toolBase = Montage.create(Component, { _currentX: {value: 0, writable: true}, _currentY: {value: 0, writable: true}, + _dragPlane: { value: null }, + /** * This function is for specifying custom feedback routine * upon mouse over. diff --git a/js/tools/drawing-tool-base.js b/js/tools/drawing-tool-base.js index a752ad65..b5416a65 100755 --- a/js/tools/drawing-tool-base.js +++ b/js/tools/drawing-tool-base.js @@ -14,9 +14,16 @@ var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils; exports.DrawingToolBase = Montage.create(Component, { - dragPlane: { - value: null + dragPlane: + { + get: function () { + return this.application.ninja.toolsData.selectedToolInstance._dragPlane; + }, + set: function (value) { + this.application.ninja.toolsData.selectedToolInstance._dragPlane = value; + } }, + /** * Used on the initial MouseDown for Drawing Tools * diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js index 6c569f0a..14a7e619 100755 --- a/js/tools/modifier-tool-base.js +++ b/js/tools/modifier-tool-base.js @@ -21,7 +21,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { //------------------------------------------------------------------------- // Snapping-specific properties _canSnap: { value: true }, - _dragPlane: { value: null }, _snapParam: { value: null }, _snapIndex: { value: -1 }, _useQuadPt: { value: false }, @@ -163,15 +162,15 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { if(!this._dragPlane) { -// if( this._inLocalMode && (this._startMatArray.length === 1) ) -// { -// this._dragPlane = viewUtils.getUnprojectedElementPlane(this._clickedObject); -// snapManager.setupDragPlaneFromPlane(this._dragPlane); -// } -// else -// { + if((this._handleMode !== null) && (this.application.ninja.toolsData.selectedTool.action === "SelectionTool")) + { + this._dragPlane = viewUtils.getUnprojectedElementPlane(this.application.ninja.selectedElements[0]); + snapManager.setupDragPlaneFromPlane(this._dragPlane); + } + else + { this._dragPlane = snapManager.setupDragPlanes( hitRec, true ); -// } + } } // only do quadrant snapping if the 4 corners of the element are in the drag plane -- cgit v1.2.3