aboutsummaryrefslogtreecommitdiff
path: root/js/tools/PenTool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/PenTool.js')
-rwxr-xr-xjs/tools/PenTool.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index d18f371a..4d439dd3 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -240,7 +240,7 @@ exports.PenTool = Montage.create(ShapeTool, {
240 this._selectedSubpath.setStrokeWidth(strokeSize); 240 this._selectedSubpath.setStrokeWidth(strokeSize);
241 241
242 var colorArray=[]; 242 var colorArray=[];
243 var color = this.application.ninja.colorController.colorToolbar.stroke.color; 243 var color = this.options.stroke.color;
244 if (color){ 244 if (color){
245 colorArray = [color.r/255, color.g/255, color.b/255, color.a]; 245 colorArray = [color.r/255, color.g/255, color.b/255, color.a];
246 }else { 246 }else {
@@ -248,7 +248,7 @@ exports.PenTool = Montage.create(ShapeTool, {
248 } 248 }
249 this._selectedSubpath.setStrokeColor(colorArray); 249 this._selectedSubpath.setStrokeColor(colorArray);
250 250
251 color = this.application.ninja.colorController.colorToolbar.fill.color; 251 color = this.options.fill.color;
252 if (color){ 252 if (color){
253 colorArray = [color.r/255, color.g/255, color.b/255, color.a]; 253 colorArray = [color.r/255, color.g/255, color.b/255, color.a];
254 } else { 254 } else {
@@ -579,17 +579,16 @@ exports.PenTool = Montage.create(ShapeTool, {
579 return; 579 return;
580 } 580 }
581 581
582 w= Math.round(w); 582 w = Math.round(w);
583 h = Math.round(h); 583 h = Math.round(h);
584 var left = Math.round(midPt[0] - 0.5 * w); 584 var left = Math.round(midPt[0] - 0.5 * w);
585 var top = Math.round(midPt[1] - 0.5 * h); 585 var top = Math.round(midPt[1] - 0.5 * h);
586 586
587 if (!canvas) { 587 if (!canvas) {
588 var newCanvas = null; 588 var newCanvas = document.application.njUtils.make("canvas", {"data-RDGE-id": NJUtils.generateRandom()}, this.application.ninja.currentDocument);
589 newCanvas = NJUtils.makeNJElement("canvas", "Subpath", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); 589 document.application.njUtils.createModelWithShape(newCanvas, "Subpath");
590 var elementModel = TagTool.makeElement(parseInt(w), parseInt(h), planeMat, midPt, newCanvas, true); 590 var styles = document.application.njUtils.stylesFromDraw(newCanvas, parseInt(w), parseInt(h), {midPt: midPt, planeMat: planeMat});
591 //note that we set the notify event to false because we send the event separately at end of this code block 591 this.application.ninja.elementMediator.addElements(newCanvas, styles, false);
592 ElementMediator.addElements(newCanvas, elementModel.data, false);
593 592
594 // create all the GL stuff 593 // create all the GL stuff
595 var world = this.getGLWorld(newCanvas, this._useWebGL);//this.options.use3D);//this.CreateGLWorld(planeMat, midPt, newCanvas, this._useWebGL);//fillMaterial, strokeMaterial); 594 var world = this.getGLWorld(newCanvas, this._useWebGL);//this.options.use3D);//this.CreateGLWorld(planeMat, midPt, newCanvas, this._useWebGL);//fillMaterial, strokeMaterial);
@@ -615,7 +614,7 @@ exports.PenTool = Montage.create(ShapeTool, {
615 var strokeColor = subpath.getStrokeColor(); 614 var strokeColor = subpath.getStrokeColor();
616 newCanvas.elementModel.shapeModel.stroke = strokeColor; 615 newCanvas.elementModel.shapeModel.stroke = strokeColor;
617 if(strokeColor) { 616 if(strokeColor) {
618 newCanvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; 617 newCanvas.elementModel.shapeModel.border = this.options.stroke;
619 } 618 }
620 newCanvas.elementModel.shapeModel.GLGeomObj = subpath; 619 newCanvas.elementModel.shapeModel.GLGeomObj = subpath;
621 newCanvas.elementModel.shapeModel.useWebGl = false;//this.options.use3D; 620 newCanvas.elementModel.shapeModel.useWebGl = false;//this.options.use3D;