aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/line.js
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-03-12 16:19:44 -0700
committerNivesh Rajbhandari2012-03-12 16:19:44 -0700
commit2ac9a855724cc4ccf147ce4130a733a84cc647c3 (patch)
tree0ea2eb5581fad03d93e3b37e7a289bc294af2b90 /js/lib/geom/line.js
parent2c6339a9191033c937c2bac3e181c2bc380f4c48 (diff)
downloadninja-2ac9a855724cc4ccf147ce4130a733a84cc647c3.tar.gz
Support import/export of gradient materials. This fixes the eyedropper not being able to sample gradient colors from WebGL shapes.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/lib/geom/line.js')
-rwxr-xr-xjs/lib/geom/line.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js
index 51a6fa98..4a935de8 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -112,7 +112,14 @@ var Line = function GLLine( world, xOffset, yOffset, width, height, slope, strok
112 rtnStr += "xAdj: " + this._xAdj + "\n"; 112 rtnStr += "xAdj: " + this._xAdj + "\n";
113 rtnStr += "yAdj: " + this._yAdj + "\n"; 113 rtnStr += "yAdj: " + this._yAdj + "\n";
114 rtnStr += "strokeWidth: " + this._strokeWidth + "\n"; 114 rtnStr += "strokeWidth: " + this._strokeWidth + "\n";
115 rtnStr += "strokeColor: " + String(this._strokeColor) + "\n"; 115
116 if(this._strokeColor.gradientMode) {
117 rtnStr += "strokeGradientMode: " + this._strokeColor.gradientMode + "\n";
118 rtnStr += "strokeColor: " + this.gradientToString(this._strokeColor.color) + "\n";
119 } else {
120 rtnStr += "strokeColor: " + String(this._strokeColor) + "\n";
121 }
122
116 rtnStr += "strokeStyle: " + this._strokeStyle + "\n"; 123 rtnStr += "strokeStyle: " + this._strokeStyle + "\n";
117 rtnStr += "slope: " + String(this._slope) + "\n"; 124 rtnStr += "slope: " + String(this._slope) + "\n";
118 125
@@ -145,7 +152,15 @@ var Line = function GLLine( world, xOffset, yOffset, width, height, slope, strok
145 152
146 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr ); 153 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr );
147 this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr ); 154 this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr );
148 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" ); 155
156 if(importStr.indexOf("strokeGradientMode: ") < 0)
157 {
158 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" );
159 } else {
160 this._strokeColor = {};
161 this._strokeColor.gradientMode = this.getPropertyFromString( "strokeGradientMode: ", importStr );
162 this._strokeColor.color = this.stringToGradient(this.getPropertyFromString( "strokeColor: ", importStr ));
163 }
149 164
150 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); 165 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName );
151 if (!strokeMat) { 166 if (!strokeMat) {