diff options
author | hwc487 | 2012-04-23 17:04:48 -0700 |
---|---|---|
committer | hwc487 | 2012-04-23 17:04:48 -0700 |
commit | 27c1ba250a7db26cf24dd456d20af9ff1649e638 (patch) | |
tree | ee178314a5e5ff13128ebfd8b3f0add4dd2ae8e3 /js/tools/ShapeTool.js | |
parent | 0f2b7cf2e1aae16e3cf4e699ab7e3ca83deb1529 (diff) | |
download | ninja-27c1ba250a7db26cf24dd456d20af9ff1649e638.tar.gz |
canvas interaction
Diffstat (limited to 'js/tools/ShapeTool.js')
-rwxr-xr-x | js/tools/ShapeTool.js | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js index f3b5e92d..b2948fe7 100755 --- a/js/tools/ShapeTool.js +++ b/js/tools/ShapeTool.js | |||
@@ -54,9 +54,9 @@ exports.ShapeTool = Montage.create(DrawingTool, { | |||
54 | }, | 54 | }, |
55 | 55 | ||
56 | HandleLeftButtonUp: | 56 | HandleLeftButtonUp: |
57 | { | 57 | { |
58 | value: function (event) | 58 | value: function (event) |
59 | { | 59 | { |
60 | var drawData; | 60 | var drawData; |
61 | 61 | ||
62 | drawData = this.getDrawingData(); | 62 | drawData = this.getDrawingData(); |
@@ -69,24 +69,26 @@ 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); | ||
73 | } else { | 72 | } else { |
74 | canvas = this._targetedElement; | 73 | canvas = this._targetedElement; |
74 | if (!canvas.getAttribute( "data-RDGE-id" )) | ||
75 | canvas.setAttribute( "data-RDGE-id", NJUtils.generateRandom() ); | ||
75 | canvas.elementModel.controller = ShapesController; | 76 | canvas.elementModel.controller = ShapesController; |
76 | if(!canvas.elementModel.shapeModel) { | 77 | if(!canvas.elementModel.shapeModel) { |
77 | canvas.elementModel.shapeModel = Montage.create(ShapeModel); | 78 | canvas.elementModel.shapeModel = Montage.create(ShapeModel); |
78 | } | 79 | } |
79 | } | 80 | } |
81 | this.application.ninja.elementMediator.addElements(canvas, canvas.elementModel.data); | ||
80 | } | 82 | } |
81 | 83 | ||
82 | this.endDraw(event); | 84 | this.endDraw(event); |
83 | 85 | ||
84 | this._isDrawing = false; | 86 | this._isDrawing = false; |
85 | this._hasDraw=false; | 87 | this._hasDraw=false; |
86 | 88 | ||
87 | this.DrawHandles(); | 89 | this.DrawHandles(); |
88 | } | 90 | } |
89 | }, | 91 | }, |
90 | 92 | ||
91 | onAddElements: { | 93 | onAddElements: { |
92 | value: function(el) { | 94 | value: function(el) { |