diff options
author | Jose Antonio Marquez | 2012-06-20 16:47:37 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-06-20 16:47:37 -0700 |
commit | 313a62245400e6c8cfa6d2f02c603cc7f01ddfc6 (patch) | |
tree | c207d1290be0e894a57b03098bbb7bbe5f2aee86 /js/tools/SelectionTool.js | |
parent | 2496e0d0b0ac5f8c53b12de77f0feda69ce4a2f4 (diff) | |
parent | 392a559e90357d48c910a07617261483b2b45476 (diff) | |
download | ninja-313a62245400e6c8cfa6d2f02c603cc7f01ddfc6.tar.gz |
Merge branch 'refs/heads/Ninja-Internal' into Document
Diffstat (limited to 'js/tools/SelectionTool.js')
-rwxr-xr-x | js/tools/SelectionTool.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js index 8b644d4a..a0d5bc26 100755 --- a/js/tools/SelectionTool.js +++ b/js/tools/SelectionTool.js | |||
@@ -47,6 +47,20 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
47 | } | 47 | } |
48 | }, | 48 | }, |
49 | 49 | ||
50 | _areElementsIn2D : { | ||
51 | value: function () { | ||
52 | if(this.application.ninja.selectedElements.length) { | ||
53 | var len = this.application.ninja.selectedElements.length; | ||
54 | for(var i = 0; i < len; i++) { | ||
55 | if(!MathUtils.isIdentityMatrix(this.application.ninja.selectedElements[i].elementModel.getProperty("mat"))) { | ||
56 | return false; | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | return true; | ||
61 | } | ||
62 | }, | ||
63 | |||
50 | startDraw: { | 64 | startDraw: { |
51 | value: function(event) { | 65 | value: function(event) { |
52 | this.drawData = null; | 66 | this.drawData = null; |
@@ -70,7 +84,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
70 | if(this._canSnap) | 84 | if(this._canSnap) |
71 | { | 85 | { |
72 | this.initializeSnapping(event); | 86 | this.initializeSnapping(event); |
73 | this._use3DMode = !this._areElementsOnSamePlane(); | 87 | // this._use3DMode = !this._areElementsOnSamePlane(); |
88 | this._use3DMode = !this._areElementsIn2D(); | ||
74 | // console.log("use3DMode = " + this._use3DMode); | 89 | // console.log("use3DMode = " + this._use3DMode); |
75 | } | 90 | } |
76 | else | 91 | else |
@@ -583,11 +598,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
583 | this.mouseUpHitRec = DrawingToolBase.getUpdatedSnapPoint(point.x, point.y, do3DSnap, this.mouseDownHitRec); | 598 | this.mouseUpHitRec = DrawingToolBase.getUpdatedSnapPoint(point.x, point.y, do3DSnap, this.mouseDownHitRec); |
584 | if (this._mouseDownHitRec && this._mouseUpHitRec) | 599 | if (this._mouseDownHitRec && this._mouseUpHitRec) |
585 | { | 600 | { |
586 | data = this.getDrawingData(event); | 601 | this.modifyElements({pt0:this._mouseDownHitRec.calculateElementScreenPoint(), |
587 | if(data) | 602 | pt1:this._mouseUpHitRec.calculateElementScreenPoint()}, event); |
588 | { | ||
589 | this.modifyElements({pt0:data.mouseDownPos, pt1:data.mouseUpPos}, event); | ||
590 | } | ||
591 | } | 603 | } |
592 | } | 604 | } |
593 | } | 605 | } |