aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-02-13 09:56:40 -0800
committerNivesh Rajbhandari2012-02-13 09:56:40 -0800
commit2edf68e0de786cdc92d5f41548fd61e6c77a57ec (patch)
tree036b7ea15a75dca9abb04b5d44a9b41b066087a6
parente142611e22718b1f1d1696902ad9161ec5f33f98 (diff)
downloadninja-2edf68e0de786cdc92d5f41548fd61e6c77a57ec.tar.gz
Updated ink bottle tool to use new setColor routine in the mediator and controllers.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
-rw-r--r--js/controllers/elements/element-controller.js13
-rw-r--r--js/controllers/elements/shapes-controller.js8
-rw-r--r--js/tools/FillTool.js3
-rw-r--r--js/tools/InkBottleTool.js35
4 files changed, 46 insertions, 13 deletions
diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js
index 65d26bdd..5eb75613 100644
--- a/js/controllers/elements/element-controller.js
+++ b/js/controllers/elements/element-controller.js
@@ -115,6 +115,7 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
115 } 115 }
116 else 116 else
117 { 117 {
118 // TODO - Need to update border style and width also
118 el.elementModel.stroke = colorObj; 119 el.elementModel.stroke = colorObj;
119 } 120 }
120 121
@@ -159,10 +160,22 @@ var ElementController = exports.ElementController = Montage.create(NJComponent,
159 case 'gradient': 160 case 'gradient':
160 this.setProperty(el, "border-image", color.color.css); 161 this.setProperty(el, "border-image", color.color.css);
161 this.setProperty(el, "border-color", "none"); 162 this.setProperty(el, "border-color", "none");
163 if(color.borderInfo)
164 {
165 this.setProperty(el, "border-width", color.borderInfo.borderWidth +
166 color.borderInfo.borderUnits);
167 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
168 }
162 break; 169 break;
163 default: 170 default:
164 this.setProperty(el, "border-image", "none"); 171 this.setProperty(el, "border-image", "none");
165 this.setProperty(el, "border-color", color.color.css); 172 this.setProperty(el, "border-color", color.color.css);
173 if(color.borderInfo)
174 {
175 this.setProperty(el, "border-width", color.borderInfo.borderWidth +
176 color.borderInfo.borderUnits);
177 this.setProperty(el, "border-style", color.borderInfo.borderStyle);
178 }
166 } 179 }
167 } 180 }
168 el.elementModel.stroke = color; 181 el.elementModel.stroke = color;
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 640119c4..42c2528f 100644
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -260,6 +260,14 @@ exports.ShapesController = Montage.create(CanvasController, {
260 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl); 260 el.elementModel.shapeModel.GLGeomObj.setStrokeColor(webGl);
261 this.setShapeProperty(el, "stroke", webGl); 261 this.setShapeProperty(el, "stroke", webGl);
262 this.setShapeProperty(el, "border", color); 262 this.setShapeProperty(el, "border", color);
263 if(color.strokeInfo)
264 {
265 var strokeWidth = this.GetValueInPixels(color.strokeInfo.strokeSize,
266 color.strokeInfo.strokeUnits);
267 el.elementModel.shapeModel.GLGeomObj.setStrokeWidth(strokeWidth);
268 this.setShapeProperty(el, "strokeSize", color.strokeInfo.strokeSize + " "
269 + color.strokeInfo.strokeUnits);
270 }
263 } 271 }
264 el.elementModel.shapeModel.GLWorld.render(); 272 el.elementModel.shapeModel.GLWorld.render();
265 } 273 }
diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js
index fabcec69..46d76a19 100644
--- a/js/tools/FillTool.js
+++ b/js/tools/FillTool.js
@@ -63,15 +63,14 @@ exports.FillTool = Montage.create(ModifierToolBase, {
63 colorInfo = { mode:color.colorMode, 63 colorInfo = { mode:color.colorMode,
64 color:color.color 64 color:color.color
65 }; 65 };
66 ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, true, "Change", "fillTool");
67 } 66 }
68 else 67 else
69 { 68 {
70 colorInfo = { mode:"nocolor", 69 colorInfo = { mode:"nocolor",
71 color:color.color 70 color:color.color
72 }; 71 };
73 ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, true, "Change", "fillTool");
74 } 72 }
73 ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, true, "Change", "fillTool");
75 } 74 }
76 } 75 }
77 } 76 }
diff --git a/js/tools/InkBottleTool.js b/js/tools/InkBottleTool.js
index cc20d94c..2be74ada 100644
--- a/js/tools/InkBottleTool.js
+++ b/js/tools/InkBottleTool.js
@@ -48,20 +48,33 @@ exports.InkBottleTool = Montage.create(ModifierToolBase, {
48 value: function(event) { 48 value: function(event) {
49 this.isDrawing = true; 49 this.isDrawing = true;
50 50
51 if(this._canColor) 51 if(this._canColor && this.application.ninja.selectedElements.length)
52 { 52 {
53// var color = this.application.ninja.colorController.colorToolbar.stroke; 53 var color = this.application.ninja.colorController.colorToolbar.stroke,
54// ElementsMediator.setColor(this.application.ninja.selectedElements, color, false, "Change", "inkBottleTool"); 54 colorInfo;
55 if(color && color.color)
56 {
57 colorInfo = { mode:color.colorMode,
58 color:color.color
59 };
60 }
61 else
62 {
63 colorInfo = { mode:"nocolor",
64 color:color.color
65 };
66 }
67
68 colorInfo.borderInfo = { borderStyle:this.options._borderStyle.value,
69 borderWidth:this.options._borderWidth.value,
70 borderUnits:this.options._borderWidth.units
71 };
55 72
56 var strokeInfo = { borderStyle:this.options._borderStyle.value, 73 colorInfo.strokeInfo = { strokeSize:this.options._strokeSize.value,
57 borderWidth:this.options._borderWidth.value, 74 strokeUnits:this.options._strokeSize.units
58 borderUnits:this.options._borderWidth.units, 75 };
59 strokeSize:this.options._strokeSize.value,
60 strokeUnits:this.options._strokeSize.units,
61 color:this.application.ninja.colorController.colorToolbar.stroke
62 };
63 76
64 ElementsMediator.setStroke(this.application.ninja.selectedElements, strokeInfo, "Change", "inkBottleTool"); 77 ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, false, "Change", "inkBottleTool");
65 } 78 }
66 } 79 }
67 } 80 }