aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorhwc4872012-04-26 12:50:57 -0700
committerhwc4872012-04-26 12:50:57 -0700
commit4b83774cdbfbf30add9a8fa2f11b1c4ff35179fa (patch)
treec8bdc04b07d9b1193ae8a553cf8d570d19a852ca /js/tools
parent34e6aa5a76fb49c3d9251cedf128c6ed971abb5c (diff)
downloadninja-4b83774cdbfbf30add9a8fa2f11b1c4ff35179fa.tar.gz
canvas interaction
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/ShapeTool.js18
1 files changed, 16 insertions, 2 deletions
diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js
index b2948fe7..74e692b6 100755
--- a/js/tools/ShapeTool.js
+++ b/js/tools/ShapeTool.js
@@ -69,6 +69,7 @@ exports.ShapeTool = Montage.create(DrawingTool, {
69 drawData.planeMat, drawData.midPt, canvas, true); 69 drawData.planeMat, drawData.midPt, canvas, true);
70 70
71 canvas.elementModel.isShape = true; 71 canvas.elementModel.isShape = true;
72 this.application.ninja.elementMediator.addElements(canvas, elementModel.data);
72 } else { 73 } else {
73 canvas = this._targetedElement; 74 canvas = this._targetedElement;
74 if (!canvas.getAttribute( "data-RDGE-id" )) 75 if (!canvas.getAttribute( "data-RDGE-id" ))
@@ -77,8 +78,8 @@ exports.ShapeTool = Montage.create(DrawingTool, {
77 if(!canvas.elementModel.shapeModel) { 78 if(!canvas.elementModel.shapeModel) {
78 canvas.elementModel.shapeModel = Montage.create(ShapeModel); 79 canvas.elementModel.shapeModel = Montage.create(ShapeModel);
79 } 80 }
81 this.application.ninja.elementMediator.addElements(canvas, canvas.elementModel.data);
80 } 82 }
81 this.application.ninja.elementMediator.addElements(canvas, canvas.elementModel.data);
82 } 83 }
83 84
84 this.endDraw(event); 85 this.endDraw(event);
@@ -213,7 +214,20 @@ exports.ShapeTool = Montage.create(DrawingTool, {
213 _useExistingCanvas: { 214 _useExistingCanvas: {
214 value: function() 215 value: function()
215 { 216 {
216 return (this._targetedElement && !ShapesController.isElementAShape(this._targetedElement)); 217 var target;
218 if (this._targetedElement && (this._targetedElement.nodeName === "CANVAS") && !ShapesController.isElementAShape(this._targetedElement))
219 target = this._targetedElement;
220 else
221 {
222 var container = this.application.ninja.currentSelectedContainer;
223 if (container && (container.nodeName === "CANVAS"))
224 {
225 target = container;
226 this._targetedElement = target;
227 }
228 }
229
230 return target;
217 } 231 }
218 } 232 }
219 233