diff options
Diffstat (limited to 'js/tools/BrushTool.js')
-rw-r--r-- | js/tools/BrushTool.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js index 1666d311..03edef79 100644 --- a/js/tools/BrushTool.js +++ b/js/tools/BrushTool.js | |||
@@ -132,7 +132,7 @@ exports.BrushTool = Montage.create(ShapeTool, { | |||
132 | if (this._selectedBrushStroke === null){ | 132 | if (this._selectedBrushStroke === null){ |
133 | this._selectedBrushStroke = new BrushStroke(); | 133 | this._selectedBrushStroke = new BrushStroke(); |
134 | var colorArray=[0,0,0,0]; | 134 | var colorArray=[0,0,0,0]; |
135 | var color = this.application.ninja.colorController.colorToolbar.fill.color; | 135 | var color = this.options.fill.color; |
136 | if (color){ | 136 | if (color){ |
137 | colorArray = [color.r/255, color.g/255, color.b/255, color.a]; | 137 | colorArray = [color.r/255, color.g/255, color.b/255, color.a]; |
138 | } else { | 138 | } else { |
@@ -376,13 +376,11 @@ exports.BrushTool = Montage.create(ShapeTool, { | |||
376 | return; | 376 | return; |
377 | } | 377 | } |
378 | 378 | ||
379 | var left = Math.round(midPt[0] - 0.5 * w); | ||
380 | var top = Math.round(midPt[1] - 0.5 * h); | ||
381 | |||
382 | if (!canvas) { | 379 | if (!canvas) { |
383 | var newCanvas = NJUtils.makeNJElement("canvas", "Brushstroke", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); | 380 | var newCanvas = document.application.njUtils.make("canvas", {"data-RDGE-id": NJUtils.generateRandom()}, this.application.ninja.currentDocument); |
384 | var elementModel = TagTool.makeElement(w, h, planeMat, midPt, newCanvas, true); | 381 | document.application.njUtils.createModelWithShape(newCanvas, "Brushstroke"); |
385 | ElementMediator.addElements(newCanvas, elementModel.data, false); | 382 | var styles = document.application.njUtils.stylesFromDraw(newCanvas, w, h, {midPt: midPt, planeMat: planeMat}); |
383 | this.application.ninja.elementMediator.addElements(newCanvas, styles, false); | ||
386 | 384 | ||
387 | // create all the GL stuff | 385 | // create all the GL stuff |
388 | var world = this.getGLWorld(newCanvas, this._useWebGL); | 386 | var world = this.getGLWorld(newCanvas, this._useWebGL); |