diff options
author | Nivesh Rajbhandari | 2012-04-18 12:08:46 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-04-18 12:08:46 -0700 |
commit | fb20a74856a8c272d09d106765eb2e44c883f0c3 (patch) | |
tree | d41468b2fff52d73c6308de9730c17be05a71394 /js/tools/modifier-tool-base.js | |
parent | e2510cba3b75bba78c587d784f39c137c1618369 (diff) | |
parent | 616a8532099fec2a15855eac97cd85cb60c4451c (diff) | |
download | ninja-fb20a74856a8c272d09d106765eb2e44c883f0c3.tar.gz |
Merge branch 'refs/heads/ninja-internal' into EricMerge
Conflicts:
js/tools/Rotate3DToolBase.js
js/tools/RotateStage3DTool.js
js/tools/Translate3DToolBase.js
js/tools/modifier-tool-base.js
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/tools/modifier-tool-base.js')
-rwxr-xr-x | js/tools/modifier-tool-base.js | 45 |
1 files changed, 12 insertions, 33 deletions
diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js index 03b100f2..2e006c35 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,8 +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.rotateStage || (this._inLocalMode && (this.application.ninja.selectedElements.length === 1)); |
408 | //console.log( "useViewPoint: " + useViewPoint ); | ||
409 | if (this._useQuadPt) | 406 | if (this._useQuadPt) |
410 | { | 407 | { |
411 | pt0 = this.GetQuadrantPoint(useViewPoint); | 408 | pt0 = this.GetQuadrantPoint(useViewPoint); |
@@ -694,25 +691,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
694 | }, | 691 | }, |
695 | 692 | ||
696 | _startMat: { value: Matrix.I(4) }, | 693 | _startMat: { value: Matrix.I(4) }, |
697 | |||
698 | _targets: { value: null }, | ||
699 | targets: | ||
700 | { | ||
701 | get: function () { | ||
702 | return this._targets; | ||
703 | }, | ||
704 | set: function (value) { | ||
705 | this._targets = value; | ||
706 | if (value !== null && value.length) | ||
707 | { | ||
708 | this.target = value[0]; | ||
709 | } | ||
710 | else | ||
711 | { | ||
712 | this.target = null; | ||
713 | } | ||
714 | } | ||
715 | }, | ||
716 | 694 | ||
717 | _undoArray: { value: [] }, | 695 | _undoArray: { value: [] }, |
718 | 696 | ||
@@ -755,7 +733,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
755 | } else { | 733 | } else { |
756 | this.eventManager.removeEventListener("selectionChange", this, true); | 734 | this.eventManager.removeEventListener("selectionChange", this, true); |
757 | this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this, false); | 735 | this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this, false); |
758 | this._targets = []; | ||
759 | 736 | ||
760 | // Clean up | 737 | // Clean up |
761 | NJevent("disableStageMove"); | 738 | NJevent("disableStageMove"); |
@@ -786,7 +763,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
786 | 763 | ||
787 | captureSelectionDrawn: { | 764 | captureSelectionDrawn: { |
788 | value: function(event){ | 765 | value: function(event){ |
789 | this._targets = []; | ||
790 | this._origin = null; | 766 | this._origin = null; |
791 | this._delta = null; | 767 | this._delta = null; |
792 | 768 | ||
@@ -835,7 +811,10 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
835 | if(!this._activateOriginHandle) | 811 | if(!this._activateOriginHandle) |
836 | { | 812 | { |
837 | this.application.ninja.stage.drawNow = true; | 813 | this.application.ninja.stage.drawNow = true; |
814 | var canSnap = this._canSnap; | ||
815 | this._canSnap = true; | ||
838 | this.doSelection(event); | 816 | this.doSelection(event); |
817 | this._canSnap = canSnap; | ||
839 | } | 818 | } |
840 | } | 819 | } |
841 | 820 | ||
@@ -862,9 +841,9 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
862 | } | 841 | } |
863 | 842 | ||
864 | if (!this._isDrawing || (this.application.ninja.selectedElements.length == 1)) | 843 | if (!this._isDrawing || (this.application.ninja.selectedElements.length == 1)) |
865 | this.DrawHandles(this._delta); | 844 | this.DrawHandles(this._delta); |
866 | 845 | ||
867 | if(this._canSnap) | 846 | if(this._canSnap) |
868 | { | 847 | { |
869 | snapManager.drawLastHit(); | 848 | snapManager.drawLastHit(); |
870 | } | 849 | } |
@@ -905,7 +884,7 @@ exports.ModifierToolBase = Montage.create(DrawingTool, { | |||
905 | this.endDraw(event); | 884 | this.endDraw(event); |
906 | 885 | ||
907 | this.application.ninja.stage.draw(); | 886 | this.application.ninja.stage.draw(); |
908 | if (this._targets && (this._targets.length > 1)) | 887 | if (this.application.ninja.selectedElements.length > 1) |
909 | { | 888 | { |
910 | //this._origin = null; | 889 | //this._origin = null; |
911 | this._updateHandlesOrigin(); | 890 | this._updateHandlesOrigin(); |