From 1a759361b82127f9d5c1428dc889fffdf2daaf86 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Thu, 3 May 2012 15:11:56 -0700 Subject: First round of moving color chips into the sub tools. Shape and Pen tool now have chips in the sub tool bar. Still need to complete adding chips to the Brush tool and finalizing the subtool bar layout to our spec for all of the subtools. --- js/tools/PenTool.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'js/tools/PenTool.js') diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js index 8ecc9f79..83d0c8d2 100755 --- a/js/tools/PenTool.js +++ b/js/tools/PenTool.js @@ -240,7 +240,7 @@ exports.PenTool = Montage.create(ShapeTool, { this._selectedSubpath.setStrokeWidth(strokeSize); var colorArray=[]; - var color = this.application.ninja.colorController.colorToolbar.stroke.color; + var color = this.options.stroke.color; if (color){ colorArray = [color.r/255, color.g/255, color.b/255, color.a]; }else { @@ -248,7 +248,7 @@ exports.PenTool = Montage.create(ShapeTool, { } this._selectedSubpath.setStrokeColor(colorArray); - color = this.application.ninja.colorController.colorToolbar.fill.color; + color = this.options.fill.color; if (color){ colorArray = [color.r/255, color.g/255, color.b/255, color.a]; } else { -- cgit v1.2.3 From 2078bfa96afaef40acb4edac99848ba55e808ef1 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 3 May 2012 15:15:21 -0700 Subject: Refactor creating elements. Removed makeNJElement and separated the model creation Signed-off-by: Valerio Virgillito --- js/tools/PenTool.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'js/tools/PenTool.js') diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js index 8ecc9f79..16990ca7 100755 --- a/js/tools/PenTool.js +++ b/js/tools/PenTool.js @@ -557,17 +557,16 @@ exports.PenTool = Montage.create(ShapeTool, { return; } - w= Math.round(w); + w = Math.round(w); h = Math.round(h); var left = Math.round(midPt[0] - 0.5 * w); var top = Math.round(midPt[1] - 0.5 * h); if (!canvas) { - var newCanvas = null; - newCanvas = NJUtils.makeNJElement("canvas", "Subpath", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); - var elementModel = TagTool.makeElement(parseInt(w), parseInt(h), planeMat, midPt, newCanvas, true); - //note that we set the notify event to false because we send the event separately at end of this code block - ElementMediator.addElements(newCanvas, elementModel.data, false); + var newCanvas = document.application.njUtils.make("canvas", {"data-RDGE-id": NJUtils.generateRandom()}, this.application.ninja.currentDocument); + document.application.njUtils.createModelWithShape(newCanvas, "Subpath"); + var styles = document.application.njUtils.stylesFromDraw(newCanvas, parseInt(w), parseInt(h), {midPt: midPt, planeMat: planeMat}); + this.application.ninja.elementMediator.addElements(newCanvas, styles, false); // create all the GL stuff var world = this.getGLWorld(newCanvas, this._useWebGL);//this.options.use3D);//this.CreateGLWorld(planeMat, midPt, newCanvas, this._useWebGL);//fillMaterial, strokeMaterial); -- cgit v1.2.3 From ba64dfa1d64969e290f15459a826171468fe3550 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Thu, 10 May 2012 15:10:58 -0700 Subject: put color chips in the inkbottle and fill tool --- js/tools/PenTool.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/tools/PenTool.js') diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js index e70bed27..10eb03c9 100755 --- a/js/tools/PenTool.js +++ b/js/tools/PenTool.js @@ -592,7 +592,7 @@ exports.PenTool = Montage.create(ShapeTool, { var strokeColor = subpath.getStrokeColor(); newCanvas.elementModel.shapeModel.stroke = strokeColor; if(strokeColor) { - newCanvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; + newCanvas.elementModel.shapeModel.border = this.options.stroke; } newCanvas.elementModel.shapeModel.GLGeomObj = subpath; newCanvas.elementModel.shapeModel.useWebGl = false;//this.options.use3D; -- cgit v1.2.3