diff options
author | Valerio Virgillito | 2012-03-13 11:16:47 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-03-13 11:16:47 -0700 |
commit | 9f3307810541ca6f95d7ca6d1febe8afdcd2c101 (patch) | |
tree | dac91cf9c9f65b33886160db3aae364873a4352b /js/tools/SelectionTool.js | |
parent | 91335d6572a611ecde7a71dbbfdb82bdb40f7e2b (diff) | |
parent | 2ac9a855724cc4ccf147ce4130a733a84cc647c3 (diff) | |
download | ninja-9f3307810541ca6f95d7ca6d1febe8afdcd2c101.tar.gz |
Merge pull request #110 from mqg734/WebGLFixes
Gradient Support for Shapes and Eyedropper support for gradients. Also fixed 3d bug when moving multiple selections in 3d using the Selection Tool
Diffstat (limited to 'js/tools/SelectionTool.js')
-rwxr-xr-x | js/tools/SelectionTool.js | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js index 6d8ff175..5f48f74d 100755 --- a/js/tools/SelectionTool.js +++ b/js/tools/SelectionTool.js | |||
@@ -16,6 +16,7 @@ var Montage = require("montage/core/core").Montage, | |||
16 | var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | 16 | var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { |
17 | drawingFeedback: { value: { mode: "Draw2D", type: "" } }, | 17 | drawingFeedback: { value: { mode: "Draw2D", type: "" } }, |
18 | 18 | ||
19 | _inLocalMode: { value: false}, // This tool should always use global mode for translations | ||
19 | _canOperateOnStage: { value: true}, | 20 | _canOperateOnStage: { value: true}, |
20 | _isSelecting: {value: false, writable:true}, | 21 | _isSelecting: {value: false, writable:true}, |
21 | _shiftMove: { value: 10}, | 22 | _shiftMove: { value: 10}, |
@@ -34,14 +35,12 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
34 | value: function () { | 35 | value: function () { |
35 | if(this._targets && this._targets.length) | 36 | if(this._targets && this._targets.length) |
36 | { | 37 | { |
37 | // TODO - drawUtils's elementPlanes check in drawSelectionBounds doesn't seem to work, | ||
38 | // so temporary workaround to simply check if all elements have identity matrix | ||
39 | // TODO - Eventually, this should instead check if all the selected items are on the view plane | ||
40 | var len = this._targets.length; | 38 | var len = this._targets.length; |
39 | var plane = this.application.ninja.stage.stageDeps.snapManager.getDragPlane(); | ||
41 | for(var i = 0; i < len; i++) | 40 | for(var i = 0; i < len; i++) |
42 | { | 41 | { |
43 | var mat = this._targets[i].mat; | 42 | var elt = this._targets[i].elt; |
44 | if(!MathUtils.isIdentityMatrix(mat)) | 43 | if(!this.application.ninja.stage.stageDeps.snapManager.elementIsOnPlane(elt, plane)) |
45 | { | 44 | { |
46 | return false; | 45 | return false; |
47 | } | 46 | } |
@@ -123,14 +122,14 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
123 | this.doDraw(event); | 122 | this.doDraw(event); |
124 | } else { | 123 | } else { |
125 | this._showFeedbackOnMouseMove(event); | 124 | this._showFeedbackOnMouseMove(event); |
126 | // if(this._canSnap) | 125 | if(this._canSnap) |
127 | // { | 126 | { |
128 | // this.doSnap(event); | 127 | this.doSnap(event); |
129 | // } | 128 | } |
130 | } | 129 | } |
131 | 130 | ||
132 | this.DrawHandles(this._delta); | 131 | this.DrawHandles(this._delta); |
133 | if(this._canSnap && this._isDrawing) | 132 | if(this._canSnap) |
134 | { | 133 | { |
135 | this.application.ninja.stage.stageDeps.snapManager.drawLastHit(); | 134 | this.application.ninja.stage.stageDeps.snapManager.drawLastHit(); |
136 | } | 135 | } |
@@ -452,7 +451,10 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
452 | if(this._use3DMode) | 451 | if(this._use3DMode) |
453 | { | 452 | { |
454 | curMat = item.mat; | 453 | curMat = item.mat; |
455 | glmat4.multiply(curMat, qMat, curMat); | 454 | |
455 | curMat[12] += transMat[12]; | ||
456 | curMat[13] += transMat[13]; | ||
457 | curMat[14] += transMat[14]; | ||
456 | viewUtils.setMatrixForElement( elt, curMat, true); | 458 | viewUtils.setMatrixForElement( elt, curMat, true); |
457 | this._targets[i].mat = curMat; | 459 | this._targets[i].mat = curMat; |
458 | } | 460 | } |
@@ -704,6 +706,10 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, { | |||
704 | */ | 706 | */ |
705 | _showFeedbackOnMouseMove : { | 707 | _showFeedbackOnMouseMove : { |
706 | value: function (event) { | 708 | value: function (event) { |
709 | if(!this._showTransformHandles) | ||
710 | { | ||
711 | return; | ||
712 | } | ||
707 | if(this._target && this._handles) | 713 | if(this._target && this._handles) |
708 | { | 714 | { |
709 | var len = this._handles.length; | 715 | var len = this._handles.length; |