diff options
author | Ananya Sen | 2012-04-17 18:11:55 -0700 |
---|---|---|
committer | Ananya Sen | 2012-04-17 18:11:55 -0700 |
commit | 35abad196cc9feb76ef50c1b63032a38233a6d51 (patch) | |
tree | 914689c66d4ab6c6e088b571eade0a0e35082916 /js/tools/ShapeTool.js | |
parent | 1f891c58bad0b7746659aa4138001b5ee76d9a0e (diff) | |
parent | 616a8532099fec2a15855eac97cd85cb60c4451c (diff) | |
download | ninja-35abad196cc9feb76ef50c1b63032a38233a6d51.tar.gz |
Merge branch 'refs/heads/ninja-internal-master' into Codeview-improvements
Diffstat (limited to 'js/tools/ShapeTool.js')
-rwxr-xr-x | js/tools/ShapeTool.js | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js index 34b3615b..f3b5e92d 100755 --- a/js/tools/ShapeTool.js +++ b/js/tools/ShapeTool.js | |||
@@ -6,8 +6,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
6 | 6 | ||
7 | var Montage = require("montage/core/core").Montage, | 7 | var Montage = require("montage/core/core").Montage, |
8 | DrawingTool = require("js/tools/drawing-tool").DrawingTool, | 8 | DrawingTool = require("js/tools/drawing-tool").DrawingTool, |
9 | viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils, | ||
10 | drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils, | ||
11 | NJUtils = require("js/lib/NJUtils").NJUtils, | 9 | NJUtils = require("js/lib/NJUtils").NJUtils, |
12 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, | 10 | ShapesController = require("js/controllers/elements/shapes-controller").ShapesController, |
13 | ShapeModel = require("js/models/shape-model").ShapeModel, | 11 | ShapeModel = require("js/models/shape-model").ShapeModel, |
@@ -67,7 +65,8 @@ exports.ShapeTool = Montage.create(DrawingTool, { | |||
67 | var canvas; | 65 | var canvas; |
68 | if(!this._useExistingCanvas()) { | 66 | if(!this._useExistingCanvas()) { |
69 | canvas = NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); | 67 | canvas = NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); |
70 | var elementModel = TagTool.makeElement(~~drawData.width, ~~drawData.height, drawData.planeMat, drawData.midPt, canvas); | 68 | var elementModel = TagTool.makeElement(~~drawData.width, ~~drawData.height, |
69 | drawData.planeMat, drawData.midPt, canvas, true); | ||
71 | 70 | ||
72 | canvas.elementModel.isShape = true; | 71 | canvas.elementModel.isShape = true; |
73 | this.application.ninja.elementMediator.addElements(canvas, elementModel.data); | 72 | this.application.ninja.elementMediator.addElements(canvas, elementModel.data); |
@@ -122,7 +121,7 @@ exports.ShapeTool = Montage.create(DrawingTool, { | |||
122 | RemoveCustomFeedback: { | 121 | RemoveCustomFeedback: { |
123 | value: function (event) { | 122 | value: function (event) { |
124 | if (this._targetedElement) { | 123 | if (this._targetedElement) { |
125 | this._targetedElement.classList.remove("elem-red-outline"); | 124 | this._targetedElement.classList.remove("active-element-outline"); |
126 | this._targetedElement = null; | 125 | this._targetedElement = null; |
127 | } | 126 | } |
128 | 127 | ||
@@ -139,23 +138,22 @@ exports.ShapeTool = Montage.create(DrawingTool, { | |||
139 | _showFeedbackOnMouseMove: { | 138 | _showFeedbackOnMouseMove: { |
140 | value: function (event) { | 139 | value: function (event) { |
141 | // TODO - This call is causing the canvas to redraw 3 times per mouse move | 140 | // TODO - This call is causing the canvas to redraw 3 times per mouse move |
142 | var targetedObject = this.application.ninja.stage.GetElement(event); | 141 | var targetedObject = this.application.ninja.stage.GetSelectableElement(event); |
143 | 142 | ||
144 | if (targetedObject) { | 143 | if (targetedObject) { |
145 | // TODO - Clean this up | ||
146 | if((targetedObject.nodeName === "CANVAS") && !ShapesController.isElementAShape(targetedObject)) | 144 | if((targetedObject.nodeName === "CANVAS") && !ShapesController.isElementAShape(targetedObject)) |
147 | { | 145 | { |
148 | if (targetedObject !== this._targetedElement) { | 146 | if (targetedObject !== this._targetedElement) { |
149 | if(this._targetedElement) | 147 | if(this._targetedElement) |
150 | { | 148 | { |
151 | this._targetedElement.classList.remove("elem-red-outline"); | 149 | this._targetedElement.classList.remove("active-element-outline"); |
152 | } | 150 | } |
153 | this._targetedElement = targetedObject; | 151 | this._targetedElement = targetedObject; |
154 | this._targetedElement.classList.add("elem-red-outline"); | 152 | this._targetedElement.classList.add("active-element-outline"); |
155 | } | 153 | } |
156 | } | 154 | } |
157 | else if (this._targetedElement) { | 155 | else if (this._targetedElement) { |
158 | this._targetedElement.classList.remove("elem-red-outline"); | 156 | this._targetedElement.classList.remove("active-element-outline"); |
159 | this._targetedElement = null; | 157 | this._targetedElement = null; |
160 | } | 158 | } |
161 | } | 159 | } |
@@ -199,7 +197,7 @@ exports.ShapeTool = Montage.create(DrawingTool, { | |||
199 | 'top' : top + 'px', | 197 | 'top' : top + 'px', |
200 | 'left' : left + 'px', | 198 | 'left' : left + 'px', |
201 | '-webkit-transform-style' : 'preserve-3d', | 199 | '-webkit-transform-style' : 'preserve-3d', |
202 | '-webkit-transform' : 'perspective(1400) matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)' | 200 | '-webkit-transform' : 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)' |
203 | }; | 201 | }; |
204 | 202 | ||
205 | tmpDiv.width = w; | 203 | tmpDiv.width = w; |
@@ -209,8 +207,6 @@ exports.ShapeTool = Montage.create(DrawingTool, { | |||
209 | } | 207 | } |
210 | }, | 208 | }, |
211 | 209 | ||
212 | |||
213 | |||
214 | // We can draw on an existing canvas unless it has only a single shape object | 210 | // We can draw on an existing canvas unless it has only a single shape object |
215 | _useExistingCanvas: { | 211 | _useExistingCanvas: { |
216 | value: function() | 212 | value: function() |