aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-03-30 13:53:47 -0700
committerNivesh Rajbhandari2012-03-30 13:53:47 -0700
commiteae317815e15a7ffc2dd1bd1e39b208eaa02fd2b (patch)
treecae3e2d74529061a04b817ae216c2dbecbb5c5bb
parent80782d5d0721463f716f0a7241afd09a38543199 (diff)
downloadninja-eae317815e15a7ffc2dd1bd1e39b208eaa02fd2b.tar.gz
Update PI and Color Panel to reflect default LinearGradient and RadialGradient materials' colors.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
-rwxr-xr-xjs/lib/geom/circle.js4
-rwxr-xr-xjs/lib/geom/line.js2
-rwxr-xr-xjs/tools/LineTool.js1
-rwxr-xr-xjs/tools/OvalTool.js2
-rwxr-xr-xjs/tools/RectTool.js2
-rwxr-xr-xjs/tools/ShapeTool.js25
6 files changed, 33 insertions, 3 deletions
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js
index ee3e2abd..f74d4e57 100755
--- a/js/lib/geom/circle.js
+++ b/js/lib/geom/circle.js
@@ -42,8 +42,8 @@ var Circle = function GLCircle() {
42 42
43 this._strokeWidth = strokeSize; 43 this._strokeWidth = strokeSize;
44 this._innerRadius = innerRadius; 44 this._innerRadius = innerRadius;
45 if (strokeColor) this._strokeColor = strokeColor; 45 this._strokeColor = strokeColor;
46 if (fillColor) this._fillColor = fillColor; 46 this._fillColor = fillColor;
47 47
48 this._strokeStyle = strokeStyle; 48 this._strokeStyle = strokeStyle;
49 } 49 }
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js
index 2b2434f5..f3806fac 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -44,7 +44,7 @@ var Line = function GLLine( world, xOffset, yOffset, width, height, slope, strok
44 44
45 this._slope = slope; 45 this._slope = slope;
46 this._strokeWidth = strokeSize; 46 this._strokeWidth = strokeSize;
47 if (strokeColor) this._strokeColor = strokeColor.slice(); 47 this._strokeColor = strokeColor;
48 48
49 this._strokeStyle = strokeStyle; 49 this._strokeStyle = strokeStyle;
50 this._scaleX = (world.getViewportWidth())/(world.getViewportHeight()); 50 this._scaleX = (world.getViewportWidth())/(world.getViewportHeight());
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js
index dd5a7c72..499a6b9d 100755
--- a/js/tools/LineTool.js
+++ b/js/tools/LineTool.js
@@ -216,6 +216,7 @@ exports.LineTool = Montage.create(ShapeTool, {
216 { 216 {
217 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM)); 217 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM));
218 } 218 }
219 strokeColor = this._getMaterialColor(strokeM) || strokeColor;
219 } 220 }
220 221
221 var world = this.getGLWorld(canvas, this.options.use3D); 222 var world = this.getGLWorld(canvas, this.options.use3D);
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js
index 0ad74aa4..c09c9bc7 100755
--- a/js/tools/OvalTool.js
+++ b/js/tools/OvalTool.js
@@ -53,12 +53,14 @@ exports.OvalTool = Montage.create(ShapeTool, {
53 { 53 {
54 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM)); 54 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM));
55 } 55 }
56 strokeColor = this._getMaterialColor(strokeM) || strokeColor;
56 57
57 var fillM = this.options.fillMaterial; 58 var fillM = this.options.fillMaterial;
58 if(fillM) 59 if(fillM)
59 { 60 {
60 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM)); 61 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM));
61 } 62 }
63 fillColor = this._getMaterialColor(fillM) || fillColor;
62 } 64 }
63 65
64 var world = this.getGLWorld(canvas, this.options.use3D); 66 var world = this.getGLWorld(canvas, this.options.use3D);
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js
index c56e4424..d69aa933 100755
--- a/js/tools/RectTool.js
+++ b/js/tools/RectTool.js
@@ -72,12 +72,14 @@ exports.RectTool = Montage.create(ShapeTool, {
72 { 72 {
73 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM)); 73 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM));
74 } 74 }
75 strokeColor = this._getMaterialColor(strokeM) || strokeColor;
75 76
76 var fillM = this.options.fillMaterial; 77 var fillM = this.options.fillMaterial;
77 if(fillM) 78 if(fillM)
78 { 79 {
79 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM)); 80 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM));
80 } 81 }
82 fillColor = this._getMaterialColor(fillM) || fillColor;
81 } 83 }
82 84
83 var world = this.getGLWorld(canvas, this.options.use3D); 85 var world = this.getGLWorld(canvas, this.options.use3D);
diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js
index d3a36163..1a12401f 100755
--- a/js/tools/ShapeTool.js
+++ b/js/tools/ShapeTool.js
@@ -206,7 +206,32 @@ exports.ShapeTool = Montage.create(DrawingTool, {
206 } 206 }
207 }, 207 },
208 208
209 _getMaterialColor: {
210 value: function(m)
211 {
212 var css,
213 colorObj;
214 if(m === "LinearGradientMaterial")
215 {
216 css = "-webkit-gradient(linear, left top, right top, from(rgb(255, 0, 0)), color-stop(0.3, rgb(0, 255, 0)), color-stop(0.6, rgb(0, 0, 255)), to(rgb(0, 255, 255)))";
217 }
218 else if(m === "RadialGradientMaterial")
219 {
220 css = "-webkit-radial-gradient(50% 50%, ellipse cover, rgb(255, 0, 0) 0%, rgb(0, 255, 0) 30%, rgb(0, 0, 255) 60%, rgb(0, 255, 255) 100%)";
221 }
222
223 if(css)
224 {
225 colorObj = this.application.ninja.colorController.getColorObjFromCss(css);
226 if(colorObj)
227 {
228 return {gradientMode:colorObj.color.gradientMode, color:colorObj.color.stops};
229 }
230 }
209 231
232 return null;
233 }
234 },
210 235
211 // We can draw on an existing canvas unless it has only a single shape object 236 // We can draw on an existing canvas unless it has only a single shape object
212 _useExistingCanvas: { 237 _useExistingCanvas: {