aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools')
-rw-r--r--js/tools/BrushTool.js2
-rwxr-xr-xjs/tools/FillTool.js7
-rwxr-xr-xjs/tools/InkBottleTool.js2
-rwxr-xr-xjs/tools/LineTool.js9
-rwxr-xr-xjs/tools/OvalTool.js6
-rwxr-xr-xjs/tools/PenTool.js6
-rwxr-xr-xjs/tools/PencilTool.js32
-rwxr-xr-xjs/tools/RectTool.js6
-rwxr-xr-xjs/tools/TagTool.js5
9 files changed, 24 insertions, 51 deletions
diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js
index 5d4e8288..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 {
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, {
72 value: function(event) { 72 value: function(event) {
73 this.isDrawing = true; 73 this.isDrawing = true;
74 74
75 if(this._canColor && this.application.ninja.selectedElements.length) 75 if(this._canColor && this.application.ninja.selectedElements.length) {
76 { 76
77 var color = this.application.ninja.colorController.colorToolbar.fill, 77 var color = this.options.fill,
78 colorInfo; 78 colorInfo;
79 if(color && color.color) 79 if(color && color.color)
80 { 80 {
@@ -92,5 +92,4 @@ exports.FillTool = Montage.create(ModifierToolBase, {
92 } 92 }
93 } 93 }
94 } 94 }
95
96}); \ No newline at end of file 95}); \ 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, {
69 69
70 if(this._canColor && this.application.ninja.selectedElements.length) 70 if(this._canColor && this.application.ninja.selectedElements.length)
71 { 71 {
72 var color = this.application.ninja.colorController.colorToolbar.stroke, 72 var color = this.options.stroke,
73 colorInfo; 73 colorInfo;
74 if(color && color.color) 74 if(color && color.color)
75 { 75 {
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js
index 5941b464..b2b48383 100755
--- a/js/tools/LineTool.js
+++ b/js/tools/LineTool.js
@@ -44,8 +44,8 @@ exports.LineTool = Montage.create(ShapeTool, {
44 } 44 }
45 45
46 this._strokeSize = ShapesController.GetValueInPixels(this.options.strokeSize.value, this.options.strokeSize.units, null); 46 this._strokeSize = ShapesController.GetValueInPixels(this.options.strokeSize.value, this.options.strokeSize.units, null);
47 if (this.application.ninja.colorController.colorToolbar.stroke.color) 47 if (this.options.stroke.color)
48 this._strokeColor = this.application.ninja.colorController.colorToolbar.stroke.color.css; 48 this._strokeColor = this.options.stroke.color.css;
49 else 49 else
50 this._strokeColor = [0,0,0,1]; 50 this._strokeColor = [0,0,0,1];
51 this.startDraw(event); 51 this.startDraw(event);
@@ -215,7 +215,7 @@ exports.LineTool = Montage.create(ShapeTool, {
215 var left = Math.round(midPt[0] - 0.5*w); 215 var left = Math.round(midPt[0] - 0.5*w);
216 var top = Math.round(midPt[1] - 0.5*h); 216 var top = Math.round(midPt[1] - 0.5*h);
217 217
218 var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor; 218 var strokeColor = this.options.stroke.webGlColor;
219 // for default stroke and fill/no materials 219 // for default stroke and fill/no materials
220 var strokeMaterial = null; 220 var strokeMaterial = null;
221 221
@@ -234,7 +234,8 @@ exports.LineTool = Montage.create(ShapeTool, {
234 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); 234 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2);
235 var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); 235 var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2));
236 236
237 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);
238 239
239 world.addObject(line); 240 world.addObject(line);
240 world.render(); 241 world.render();
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js
index 6edec811..ce812398 100755
--- a/js/tools/OvalTool.js
+++ b/js/tools/OvalTool.js
@@ -39,8 +39,8 @@ exports.OvalTool = Montage.create(ShapeTool, {
39 39
40 var innerRadius = this.options.innerRadius.value / 100; 40 var innerRadius = this.options.innerRadius.value / 100;
41 41
42 var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor; 42 var strokeColor = this.options.stroke.webGlColor;
43 var fillColor = this.application.ninja.colorController.colorToolbar.fill.webGlColor; 43 var fillColor = this.options.fill.webGlColor;
44 44
45 // for default stroke and fill/no materials 45 // for default stroke and fill/no materials
46 var strokeMaterial = null; 46 var strokeMaterial = null;
@@ -68,7 +68,7 @@ exports.OvalTool = Montage.create(ShapeTool, {
68 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); 68 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2);
69 var yOffset = -(canvas.height/2 - (top - canvas.offsetTop + h/2)); 69 var yOffset = -(canvas.height/2 - (top - canvas.offsetTop + h/2));
70 70
71 var oval = new Circle(); //GLCircle(); 71 var oval = Object.create(Circle, {});
72 oval.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle); 72 oval.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle);
73 73
74 world.addObject(oval); 74 world.addObject(oval);
diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js
index 0cfc9331..cc8ec394 100755
--- a/js/tools/PenTool.js
+++ b/js/tools/PenTool.js
@@ -315,7 +315,7 @@ exports.PenTool = Montage.create(ShapeTool, {
315 this._selectedSubpath.setStrokeWidth(strokeSize); 315 this._selectedSubpath.setStrokeWidth(strokeSize);
316 316
317 var colorArray=[]; 317 var colorArray=[];
318 var color = this.application.ninja.colorController.colorToolbar.stroke.color; 318 var color = this.options.stroke.color;
319 if (color){ 319 if (color){
320 colorArray = [color.r/255, color.g/255, color.b/255, color.a]; 320 colorArray = [color.r/255, color.g/255, color.b/255, color.a];
321 }else { 321 }else {
@@ -323,7 +323,7 @@ exports.PenTool = Montage.create(ShapeTool, {
323 } 323 }
324 this._selectedSubpath.setStrokeColor(colorArray); 324 this._selectedSubpath.setStrokeColor(colorArray);
325 325
326 color = this.application.ninja.colorController.colorToolbar.fill.color; 326 color = this.options.fill.color;
327 if (color){ 327 if (color){
328 colorArray = [color.r/255, color.g/255, color.b/255, color.a]; 328 colorArray = [color.r/255, color.g/255, color.b/255, color.a];
329 } else { 329 } else {
@@ -701,7 +701,7 @@ exports.PenTool = Montage.create(ShapeTool, {
701 var strokeColor = subpath.getStrokeColor(); 701 var strokeColor = subpath.getStrokeColor();
702 newCanvas.elementModel.shapeModel.stroke = strokeColor; 702 newCanvas.elementModel.shapeModel.stroke = strokeColor;
703 if(strokeColor) { 703 if(strokeColor) {
704 newCanvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; 704 newCanvas.elementModel.shapeModel.border = this.options.stroke;
705 } 705 }
706 newCanvas.elementModel.shapeModel.GLGeomObj = subpath; 706 newCanvas.elementModel.shapeModel.GLGeomObj = subpath;
707 newCanvas.elementModel.shapeModel.useWebGl = false;//this.options.use3D; 707 newCanvas.elementModel.shapeModel.useWebGl = false;//this.options.use3D;
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 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var Montage = require("montage/core/core").Montage,
8 DrawingTool = require("js/tools/drawing-tool").DrawingTool;
9
10exports.PencilTool = Montage.create(DrawingTool, {
11 drawingFeedback: { value: { mode: "Draw2D", type: "" } },
12
13 HandleLeftButtonDown: {
14 value: function(event) {
15 NJevent("enableStageMove");
16
17 }
18 },
19
20 HandleMouseMove: {
21 value: function(event) {
22 this.doDraw(event);
23 }
24 },
25
26 HandleLeftButtonUp: {
27 value: function(event) {
28 this.endDraw(event);
29 NJevent("disableStageMove");
30 }
31 }
32}); \ No newline at end of file
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js
index 0c14a559..b35a101a 100755
--- a/js/tools/RectTool.js
+++ b/js/tools/RectTool.js
@@ -59,8 +59,8 @@ exports.RectTool = Montage.create(ShapeTool, {
59 var blRadius = ShapesController.GetValueInPixels(this.options.BLRadiusControl.value, this.options.BLRadiusControl.units, h); 59 var blRadius = ShapesController.GetValueInPixels(this.options.BLRadiusControl.value, this.options.BLRadiusControl.units, h);
60 var brRadius = ShapesController.GetValueInPixels(this.options.BRRadiusControl.value, this.options.BRRadiusControl.units, h); 60 var brRadius = ShapesController.GetValueInPixels(this.options.BRRadiusControl.value, this.options.BRRadiusControl.units, h);
61 61
62 var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor; 62 var strokeColor = this.options.stroke.webGlColor;
63 var fillColor = this.application.ninja.colorController.colorToolbar.fill.webGlColor; 63 var fillColor = this.options.fill.webGlColor;
64 // for default stroke and fill/no materials 64 // for default stroke and fill/no materials
65 var strokeMaterial = null; 65 var strokeMaterial = null;
66 var fillMaterial = null; 66 var fillMaterial = null;
@@ -87,7 +87,7 @@ exports.RectTool = Montage.create(ShapeTool, {
87 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); 87 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2);
88 var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); 88 var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2));
89 89
90 var rect = new Rectangle(); 90 var rect = Object.create(Rectangle, {});
91 rect.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, 91 rect.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor,
92 tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle); 92 tlRadius, trRadius, blRadius, brRadius, strokeMaterial, fillMaterial, strokeStyle);
93 93
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, {
92 // Create the styles 92 // Create the styles
93 styles = document.application.njUtils.stylesFromDraw(element, ~~drawData.width, ~~drawData.height, drawData); 93 styles = document.application.njUtils.stylesFromDraw(element, ~~drawData.width, ~~drawData.height, drawData);
94 94
95 // Add color