From 4bec28fbd8371deceffd1563190cb5e399d554d3 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 16 Mar 2012 16:36:04 -0700 Subject: Squashed commit of SnapManagerFixes Signed-off-by: Valerio Virgillito --- js/tools/modifier-tool-base.js | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'js/tools/modifier-tool-base.js') diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js index 80f7d758..94b806fd 100755 --- a/js/tools/modifier-tool-base.js +++ b/js/tools/modifier-tool-base.js @@ -134,7 +134,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { var hitRec = snapManager.snap(point.x, point.y, do3DSnap); // TODO - Check that hitRec's element matches element that browser says we clicked on - var elt = this.application.ninja.stage.GetElement(event); + var elt = this.application.ninja.stage.GetSelectableElement(event); if(elt !== hitRec.getElement()) { hitRec = snapManager.findHitRecordForElement(elt); @@ -552,6 +552,9 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { // update the target this._mouseUpHitRec = hitRec; + var pt = hitRec.getScreenPoint(); + this.upPoint.x = pt[0]; + this.upPoint.y = pt[1]; } } } @@ -579,12 +582,15 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { this.downPoint.x = null; this.downPoint.y = null; + this.upPoint.x = null; + this.upPoint.y = null; // this.isDrawing = false; if(this._canSnap) { this.cleanupSnap(); } + this._mode = 0; } }, @@ -764,6 +770,8 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { captureSelectionDrawn: { value: function(event){ this._targets = []; + this._origin = null; + this._delta = null; var len = this.application.ninja.selectedElements.length; if(len) @@ -866,7 +874,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { this._updateTargets(true); } - this.endDraw(event); this._hasDraw = false; } if(this._handleMode !== null) @@ -874,6 +881,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { this._handleMode = null; this._delta = null; } + this.endDraw(event); this.DrawHandles(); } }, @@ -998,19 +1006,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { } }, - _updateDelta: { - value: function(delta, handleMode){ - if(this._clickedObject !== this.application.ninja.currentDocument.documentRoot) - { - this._delta += ~~(delta[handleMode]); - } - else - { - this._delta = ~~(delta[handleMode]); - } - } - }, - modifyElements: { value: function(data, event) { // override in subclasses. -- cgit v1.2.3