aboutsummaryrefslogtreecommitdiff
path: root/js/tools/LineTool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/LineTool.js')
-rwxr-xr-xjs/tools/LineTool.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js
index 61971c33..6621d18b 100755
--- a/js/tools/LineTool.js
+++ b/js/tools/LineTool.js
@@ -77,10 +77,11 @@ exports.LineTool = Montage.create(ShapeTool, {
77 h += ~~(yAdj*2); 77 h += ~~(yAdj*2);
78 } 78 }
79 79
80 canvas = NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); 80 canvas = document.application.njUtils.make("canvas", {"data-RDGE-id": NJUtils.generateRandom()}, this.application.ninja.currentDocument);
81 var elementModel = TagTool.makeElement(w, h, drawData.planeMat, drawData.midPt, canvas, true); 81 document.application.njUtils.createModelWithShape(canvas, "Line");
82 canvas.elementModel.isShape = true; 82
83 this.application.ninja.elementMediator.addElements(canvas, elementModel.data); 83 var styles = document.application.njUtils.stylesFromDraw(canvas, w, h, drawData);
84 this.application.ninja.elementMediator.addElements(canvas, styles);
84 } else { 85 } else {
85 canvas = this._targetedElement; 86 canvas = this._targetedElement;
86 canvas.elementModel.controller = ShapesController; 87 canvas.elementModel.controller = ShapesController;
@@ -233,7 +234,8 @@ exports.LineTool = Montage.create(ShapeTool, {
233 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); 234 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2);
234 var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); 235 var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2));
235 236
236 var line = new Line(world, xOffset, yOffset, w, h, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj); 237 var line = Object.create(Line, {});
238 line.init(world, xOffset, yOffset, w, h, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj);
237 239
238 world.addObject(line); 240 world.addObject(line);
239 world.render(); 241 world.render();
@@ -241,7 +243,7 @@ exports.LineTool = Montage.create(ShapeTool, {
241 canvas.elementModel.shapeModel.shapeCount++; 243 canvas.elementModel.shapeModel.shapeCount++;
242 if(canvas.elementModel.shapeModel.shapeCount === 1) 244 if(canvas.elementModel.shapeModel.shapeCount === 1)
243 { 245 {
244 canvas.elementModel.selection = "Line"; 246// canvas.elementModel.selection = "Line";
245 canvas.elementModel.pi = "LinePi"; 247 canvas.elementModel.pi = "LinePi";
246 canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; 248 canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units;
247 249