aboutsummaryrefslogtreecommitdiff
path: root/js/tools/ShapeTool.js
diff options
context:
space:
mode:
authorJonathan Duran2012-04-10 08:13:00 -0700
committerJonathan Duran2012-04-10 08:13:00 -0700
commit58e049b68e03abbacde93206d2666361022c0858 (patch)
treef1ce6b8a378674d4abcac68acd0bcca93b838a39 /js/tools/ShapeTool.js
parenta9050f96d814469f420bcf3630d16d576b62258e (diff)
parentbd43ce383b050d03b0f92cc923c517febc66ca28 (diff)
downloadninja-58e049b68e03abbacde93206d2666361022c0858.tar.gz
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Diffstat (limited to 'js/tools/ShapeTool.js')
-rwxr-xr-xjs/tools/ShapeTool.js18
1 files changed, 7 insertions, 11 deletions
diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js
index 34b3615b..a8da7921 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
7var Montage = require("montage/core/core").Montage, 7var 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 }
@@ -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()