From a809c6b3ba6f024922dd3f10bbc4ab456de2407e Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 2 May 2012 15:45:43 -0700 Subject: Converting line, circle and rectangle shapes to object literal notation. Signed-off-by: Nivesh Rajbhandari --- js/tools/LineTool.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'js/tools') diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index 3e9167fd..9c4ba892 100755 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js @@ -233,7 +233,8 @@ exports.LineTool = Montage.create(ShapeTool, { var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); - var line = new Line(world, xOffset, yOffset, w, h, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj); + var line = new Line(); + line.init(world, xOffset, yOffset, w, h, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj); world.addObject(line); world.render(); -- cgit v1.2.3 From 7c77aa914eb96c2b5b797e37c16aa786c05f38e8 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 2 May 2012 16:50:38 -0700 Subject: Converting geom-obj to object literal notation. Signed-off-by: Nivesh Rajbhandari --- js/tools/LineTool.js | 2 +- js/tools/OvalTool.js | 2 +- js/tools/RectTool.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'js/tools') diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index 9c4ba892..a32fbdc8 100755 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js @@ -233,7 +233,7 @@ exports.LineTool = Montage.create(ShapeTool, { var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); - var line = new Line(); + var line = Object.create(Line, {}); line.init(world, xOffset, yOffset, w, h, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj); world.addObject(line); diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js index 6edec811..e9dc66bb 100755 --- a/js/tools/OvalTool.js +++ b/js/tools/OvalTool.js @@ -68,7 +68,7 @@ exports.OvalTool = Montage.create(ShapeTool, { var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); var yOffset = -(canvas.height/2 - (top - canvas.offsetTop + h/2)); - var oval = new Circle(); //GLCircle(); + var oval = Object.create(Circle, {}); oval.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle); world.addObject(oval); diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js index 0c14a559..0a3c8200 100755 --- a/js/tools/RectTool.js +++ b/js/tools/RectTool.js @@ -87,7 +87,7 @@ exports.RectTool = Montage.create(ShapeTool, { var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); - var rect = new Rectangle(); + var rect = Object.create(Rectangle, {}); rect.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle); -- cgit v1.2.3 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/BrushTool.js | 2 +- js/tools/LineTool.js | 6 +++--- js/tools/OvalTool.js | 4 ++-- js/tools/PenTool.js | 4 ++-- js/tools/RectTool.js | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'js/tools') diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js index ded56ecc..7e5e0630 100644 --- a/js/tools/BrushTool.js +++ b/js/tools/BrushTool.js @@ -132,7 +132,7 @@ exports.BrushTool = Montage.create(ShapeTool, { if (this._selectedBrushStroke === null){ this._selectedBrushStroke = new BrushStroke(); var colorArray=[0,0,0,0]; - var color = this.application.ninja.colorController.colorToolbar.fill.color; + var color = this.options.fill.color; if (color){ colorArray = [color.r/255, color.g/255, color.b/255, color.a]; } else { diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index 3e9167fd..92352880 100755 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js @@ -44,8 +44,8 @@ exports.LineTool = Montage.create(ShapeTool, { } this._strokeSize = ShapesController.GetValueInPixels(this.options.strokeSize.value, this.options.strokeSize.units, null); - if (this.application.ninja.colorController.colorToolbar.stroke.color) - this._strokeColor = this.application.ninja.colorController.colorToolbar.stroke.color.css; + if (this.options.stroke.color) + this._strokeColor = this.options.stroke.color.css; else this._strokeColor = [0,0,0,1]; this.startDraw(event); @@ -214,7 +214,7 @@ exports.LineTool = Montage.create(ShapeTool, { var left = Math.round(midPt[0] - 0.5*w); var top = Math.round(midPt[1] - 0.5*h); - var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor; + var strokeColor = this.options.stroke.webGlColor; // for default stroke and fill/no materials var strokeMaterial = null; diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js index 6edec811..f1da3a46 100755 --- a/js/tools/OvalTool.js +++ b/js/tools/OvalTool.js @@ -39,8 +39,8 @@ exports.OvalTool = Montage.create(ShapeTool, { var innerRadius = this.options.innerRadius.value / 100; - var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor; - var fillColor = this.application.ninja.colorController.colorToolbar.fill.webGlColor; + var strokeColor = this.options.stroke.webGlColor; + var fillColor = this.options.fill.webGlColor; // for default stroke and fill/no materials var strokeMaterial = null; 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 { diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js index 0c14a559..d4951db8 100755 --- a/js/tools/RectTool.js +++ b/js/tools/RectTool.js @@ -59,8 +59,8 @@ exports.RectTool = Montage.create(ShapeTool, { var blRadius = ShapesController.GetValueInPixels(this.options.BLRadiusControl.value, this.options.BLRadiusControl.units, h); var brRadius = ShapesController.GetValueInPixels(this.options.BRRadiusControl.value, this.options.BRRadiusControl.units, h); - var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor; - var fillColor = this.application.ninja.colorController.colorToolbar.fill.webGlColor; + var strokeColor = this.options.stroke.webGlColor; + var fillColor = this.options.fill.webGlColor; // for default stroke and fill/no materials var strokeMaterial = null; var fillMaterial = null; -- cgit v1.2.3 From 29ad6355ef60cfb3b3fc7f780504f3ed30845883 Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Mon, 7 May 2012 14:30:47 -0700 Subject: More implementation of moving color chips to the individual subtools. Removed the tool color bar Added new icons for inkbottle Removed Pencil tool Removed Inkbottle tool Added chips to the pen, brush and tag tools Aligned controls in several subtools --- js/tools/PencilTool.js | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100755 js/tools/PencilTool.js (limited to 'js/tools') diff --git a/js/tools/PencilTool.js b/js/tools/PencilTool.js deleted file mode 100755 index 349eb1e8..00000000 --- a/js/tools/PencilTool.js +++ /dev/null @@ -1,32 +0,0 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ - -var Montage = require("montage/core/core").Montage, - DrawingTool = require("js/tools/drawing-tool").DrawingTool; - -exports.PencilTool = Montage.create(DrawingTool, { - drawingFeedback: { value: { mode: "Draw2D", type: "" } }, - - HandleLeftButtonDown: { - value: function(event) { - NJevent("enableStageMove"); - - } - }, - - HandleMouseMove: { - value: function(event) { - this.doDraw(event); - } - }, - - HandleLeftButtonUp: { - value: function(event) { - this.endDraw(event); - NJevent("disableStageMove"); - } - } -}); \ No newline at end of file -- 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/FillTool.js | 7 +++---- js/tools/InkBottleTool.js | 2 +- js/tools/PenTool.js | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) (limited to 'js/tools') diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js index 87a093ff..66dd9305 100755 --- a/js/tools/FillTool.js +++ b/js/tools/FillTool.js @@ -72,9 +72,9 @@ exports.FillTool = Montage.create(ModifierToolBase, { value: function(event) { this.isDrawing = true; - if(this._canColor && this.application.ninja.selectedElements.length) - { - var color = this.application.ninja.colorController.colorToolbar.fill, + if(this._canColor && this.application.ninja.selectedElements.length) { + + var color = this.options.fill, colorInfo; if(color && color.color) { @@ -92,5 +92,4 @@ exports.FillTool = Montage.create(ModifierToolBase, { } } } - }); \ No newline at end of file diff --git a/js/tools/InkBottleTool.js b/js/tools/InkBottleTool.js index fd17f4d6..2c03d133 100755 --- a/js/tools/InkBottleTool.js +++ b/js/tools/InkBottleTool.js @@ -69,7 +69,7 @@ exports.InkBottleTool = Montage.create(ModifierToolBase, { if(this._canColor && this.application.ninja.selectedElements.length) { - var color = this.application.ninja.colorController.colorToolbar.stroke, + var color = this.options.stroke, colorInfo; if(color && color.color) { 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 From dcbdd4d4be9a02e792bce445ab360b72d66fa326 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 15 May 2012 15:41:16 -0700 Subject: Add color to tag tool Signed-off-by: Valerio Virgillito --- js/tools/TagTool.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'js/tools') diff --git a/js/tools/TagTool.js b/js/tools/TagTool.js index 5e9c792b..5520fa89 100755 --- a/js/tools/TagTool.js +++ b/js/tools/TagTool.js @@ -92,6 +92,11 @@ exports.TagTool = Montage.create(DrawingTool, { // Create the styles styles = document.application.njUtils.stylesFromDraw(element, ~~drawData.width, ~~drawData.height, drawData); + // Add color + if(this.options.getProperty("fill.colorMode") !== "nocolor") { + styles['background-color'] = this.options.getProperty("fill.color.css"); + } + // Add the element and styles this.application.ninja.elementMediator.addElements(element, styles); } -- cgit v1.2.3