diff options
author | Nivesh Rajbhandari | 2012-04-17 11:10:10 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-04-17 11:10:10 -0700 |
commit | 6d3af6cb9dc8223102854ad95a5c4c501fc62c8b (patch) | |
tree | 07afdbeacd26f01414933d5b3318786cec30f4a8 /js/tools/modifier-tool-base.js | |
parent | 2a87a750f06003fc62e8e0e73983e14ce24fc7a7 (diff) | |
parent | cacb4a21825818af392c2949967b0f3c1df509c5 (diff) | |
download | ninja-6d3af6cb9dc8223102854ad95a5c4c501fc62c8b.tar.gz |
Merge branch 'refs/heads/ninja-internal' into WebGLFixes
Diffstat (limited to 'js/tools/modifier-tool-base.js')
-rwxr-xr-x | js/tools/modifier-tool-base.js | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js index de73c861..8cd21a29 100755 --- a/js/tools/modifier-tool-base.js +++ b/js/tools/modifier-tool-base.js | |||
@@ -125,8 +125,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
125 | // } | 125 | // } |
126 | // } | 126 | // } |
127 | 127 | ||
128 | 128 | if(this.application.ninja.selectedElements.length) | |
129 | if(this._targets) | ||
130 | { | 129 | { |
131 | var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, | 130 | var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, |
132 | new WebKitPoint(event.pageX, event.pageY)); | 131 | new WebKitPoint(event.pageX, event.pageY)); |
@@ -142,11 +141,10 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
142 | } | 141 | } |
143 | 142 | ||
144 | // we don't want to snap to selected objects during the drag | 143 | // we don't want to snap to selected objects during the drag |
145 | var len = this._targets.length; | 144 | this.application.ninja.selectedElements.forEach(function(element) { |
146 | for(var i=0; i<len; i++) | 145 | snapManager.addToAvoidList(element); |
147 | { | 146 | }); |
148 | snapManager.addToAvoidList( this._targets[i].elt ); | 147 | |
149 | } | ||
150 | if (hitRec) | 148 | if (hitRec) |
151 | { | 149 | { |
152 | // disable snap attributes | 150 | // disable snap attributes |
@@ -404,7 +402,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
404 | { | 402 | { |
405 | var index = this._snapIndex; | 403 | var index = this._snapIndex; |
406 | var pt0; | 404 | var pt0; |
407 | var useViewPoint = (this._inLocalMode && (this._targets.length === 1)); | 405 | var useViewPoint = (this._inLocalMode && (this.application.ninja.selectedElements.length === 1)); |
408 | if (this._useQuadPt) | 406 | if (this._useQuadPt) |
409 | { | 407 | { |
410 | pt0 = this.GetQuadrantPoint(useViewPoint); | 408 | pt0 = this.GetQuadrantPoint(useViewPoint); |
@@ -691,25 +689,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
691 | }, | 689 | }, |
692 | 690 | ||
693 | _startMat: { value: Matrix.I(4) }, | 691 | _startMat: { value: Matrix.I(4) }, |
694 | |||
695 | _targets: { value: null }, | ||
696 | targets: | ||
697 | { | ||
698 | get: function () { | ||
699 | return this._targets; | ||
700 | }, | ||
701 | set: function (value) { | ||
702 | this._targets = value; | ||
703 | if (value !== null && value.length) | ||
704 | { | ||
705 | this.target = value[0]; | ||
706 | } | ||
707 | else | ||
708 | { | ||
709 | this.target = null; | ||
710 | } | ||
711 | } | ||
712 | }, | ||
713 | 692 | ||
714 | _undoArray: { value: [] }, | 693 | _undoArray: { value: [] }, |
715 | 694 | ||
@@ -752,7 +731,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
752 | } else { | 731 | } else { |
753 | this.eventManager.removeEventListener("selectionChange", this, true); | 732 | this.eventManager.removeEventListener("selectionChange", this, true); |
754 | this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this, false); | 733 | this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this, false); |
755 | this._targets = []; | ||
756 | 734 | ||
757 | // Clean up | 735 | // Clean up |
758 | NJevent("disableStageMove"); | 736 | NJevent("disableStageMove"); |
@@ -783,7 +761,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
783 | 761 | ||
784 | captureSelectionDrawn: { | 762 | captureSelectionDrawn: { |
785 | value: function(event){ | 763 | value: function(event){ |
786 | this._targets = []; | ||
787 | this._origin = null; | 764 | this._origin = null; |
788 | this._delta = null; | 765 | this._delta = null; |
789 | 766 | ||
@@ -832,7 +809,10 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
832 | if(!this._activateOriginHandle) | 809 | if(!this._activateOriginHandle) |
833 | { | 810 | { |
834 | this.application.ninja.stage.drawNow = true; | 811 | this.application.ninja.stage.drawNow = true; |
812 | var canSnap = this._canSnap; | ||
813 | this._canSnap = true; | ||
835 | this.doSelection(event); | 814 | this.doSelection(event); |
815 | this._canSnap = canSnap; | ||
836 | } | 816 | } |
837 | } | 817 | } |
838 | 818 | ||