aboutsummaryrefslogtreecommitdiff
path: root/js/tools/modifier-tool-base.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/modifier-tool-base.js')
-rwxr-xr-xjs/tools/modifier-tool-base.js37
1 files changed, 16 insertions, 21 deletions
diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js
index 7892d015..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, {
134 var hitRec = snapManager.snap(point.x, point.y, do3DSnap); 134 var hitRec = snapManager.snap(point.x, point.y, do3DSnap);
135 135
136 // TODO - Check that hitRec's element matches element that browser says we clicked on 136 // TODO - Check that hitRec's element matches element that browser says we clicked on
137 var elt = this.application.ninja.stage.GetElement(event); 137 var elt = this.application.ninja.stage.GetSelectableElement(event);
138 if(elt !== hitRec.getElement()) 138 if(elt !== hitRec.getElement())
139 { 139 {
140 hitRec = snapManager.findHitRecordForElement(elt); 140 hitRec = snapManager.findHitRecordForElement(elt);
@@ -171,7 +171,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, {
171// } 171// }
172// else 172// else
173// { 173// {
174 this._dragPlane = snapManager.setupDragPlanes( hitRec ); 174 this._dragPlane = snapManager.setupDragPlanes( hitRec, true );
175// } 175// }
176 } 176 }
177 177
@@ -552,6 +552,9 @@ exports.ModifierToolBase = Montage.create(DrawingTool, {
552 552
553 // update the target 553 // update the target
554 this._mouseUpHitRec = hitRec; 554 this._mouseUpHitRec = hitRec;
555 var pt = hitRec.getScreenPoint();
556 this.upPoint.x = pt[0];
557 this.upPoint.y = pt[1];
555 } 558 }
556 } 559 }
557 } 560 }
@@ -579,12 +582,15 @@ exports.ModifierToolBase = Montage.create(DrawingTool, {
579 582
580 this.downPoint.x = null; 583 this.downPoint.x = null;
581 this.downPoint.y = null; 584 this.downPoint.y = null;
585 this.upPoint.x = null;
586 this.upPoint.y = null;
582// this.isDrawing = false; 587// this.isDrawing = false;
583 588
584 if(this._canSnap) 589 if(this._canSnap)
585 { 590 {
586 this.cleanupSnap(); 591 this.cleanupSnap();
587 } 592 }
593 this._mode = 0;
588 } 594 }
589 }, 595 },
590 596
@@ -764,6 +770,8 @@ exports.ModifierToolBase = Montage.create(DrawingTool, {
764 captureSelectionDrawn: { 770 captureSelectionDrawn: {
765 value: function(event){ 771 value: function(event){
766 this._targets = []; 772 this._targets = [];
773 this._origin = null;
774 this._delta = null;
767 775
768 var len = this.application.ninja.selectedElements.length; 776 var len = this.application.ninja.selectedElements.length;
769 if(len) 777 if(len)
@@ -828,14 +836,14 @@ exports.ModifierToolBase = Montage.create(DrawingTool, {
828 this.doDraw(event); 836 this.doDraw(event);
829 } else { 837 } else {
830 this._showFeedbackOnMouseMove(event); 838 this._showFeedbackOnMouseMove(event);
831// if(this._canSnap) 839 if(this._canSnap)
832// { 840 {
833// this.doSnap(event); 841 this.doSnap(event);
834// } 842 }
835 } 843 }
836 844
837 this.DrawHandles(this._delta); 845 this.DrawHandles(this._delta);
838 if(this._canSnap && this._isDrawing) 846 if(this._canSnap)
839 { 847 {
840 snapManager.drawLastHit(); 848 snapManager.drawLastHit();
841 } 849 }
@@ -866,7 +874,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, {
866 this._updateTargets(true); 874 this._updateTargets(true);
867 } 875 }
868 876
869 this.endDraw(event);
870 this._hasDraw = false; 877 this._hasDraw = false;
871 } 878 }
872 if(this._handleMode !== null) 879 if(this._handleMode !== null)
@@ -874,6 +881,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, {
874 this._handleMode = null; 881 this._handleMode = null;
875 this._delta = null; 882 this._delta = null;
876 } 883 }
884 this.endDraw(event);
877 this.DrawHandles(); 885 this.DrawHandles();
878 } 886 }
879 }, 887 },
@@ -998,19 +1006,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, {
998 } 1006 }
999 }, 1007 },
1000 1008
1001 _updateDelta: {
1002 value: function(delta, handleMode){
1003 if(this._clickedObject !== this.application.ninja.currentDocument.documentRoot)
1004 {
1005 this._delta += ~~(delta[handleMode]);
1006 }
1007 else
1008 {
1009 this._delta = ~~(delta[handleMode]);
1010 }
1011 }
1012 },
1013
1014 modifyElements: { 1009 modifyElements: {
1015 value: function(data, event) { 1010 value: function(data, event) {
1016 // override in subclasses. 1011 // override in subclasses.