aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/rectangle.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/rectangle.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/rectangle.js')
-rwxr-xr-xjs/lib/geom/rectangle.js38
1 files changed, 33 insertions, 5 deletions
diff --git a/js/lib/geom/rectangle.js b/js/lib/geom/rectangle.js
index 81201a79..6abaef2f 100755
--- a/js/lib/geom/rectangle.js
+++ b/js/lib/geom/rectangle.js
@@ -203,8 +203,20 @@ var Rectangle = function GLRectangle() {
203 rtnStr += "width: " + this._width + "\n"; 203 rtnStr += "width: " + this._width + "\n";
204 rtnStr += "height: " + this._height + "\n"; 204 rtnStr += "height: " + this._height + "\n";
205 rtnStr += "strokeWidth: " + this._strokeWidth + "\n"; 205 rtnStr += "strokeWidth: " + this._strokeWidth + "\n";
206 rtnStr += "strokeColor: " + String(this._strokeColor) + "\n"; 206
207 rtnStr += "fillColor: " + String(this._fillColor) + "\n"; 207 if(this._strokeColor.gradientMode) {
208 rtnStr += "strokeGradientMode: " + this._strokeColor.gradientMode + "\n";
209 rtnStr += "strokeColor: " + this.gradientToString(this._strokeColor.color) + "\n";
210 } else {
211 rtnStr += "strokeColor: " + String(this._strokeColor) + "\n";
212 }
213
214 if(this._fillColor.gradientMode) {
215 rtnStr += "fillGradientMode: " + this._fillColor.gradientMode + "\n";
216 rtnStr += "fillColor: " + this.gradientToString(this._fillColor.color) + "\n";
217 } else {
218 rtnStr += "fillColor: " + String(this._fillColor) + "\n";
219 }
208 rtnStr += "tlRadius: " + this._tlRadius + "\n"; 220 rtnStr += "tlRadius: " + this._tlRadius + "\n";
209 rtnStr += "trRadius: " + this._trRadius + "\n"; 221 rtnStr += "trRadius: " + this._trRadius + "\n";
210 rtnStr += "blRadius: " + this._blRadius + "\n"; 222 rtnStr += "blRadius: " + this._blRadius + "\n";
@@ -244,9 +256,25 @@ var Rectangle = function GLRectangle() {
244 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr ); 256 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr );
245 var fillMaterialName = this.getPropertyFromString( "fillMat: ", importStr ); 257 var fillMaterialName = this.getPropertyFromString( "fillMat: ", importStr );
246 this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr ); 258 this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr );
247 this._fillColor = eval( "[" + this.getPropertyFromString( "fillColor: ", importStr ) + "]" ); 259
248 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" ); 260 if(importStr.indexOf("fillGradientMode: ") < 0) {
249 this._tlRadius = Number( this.getPropertyFromString( "tlRadius: ", importStr ) ); 261 this._fillColor = eval( "[" + this.getPropertyFromString( "fillColor: ", importStr ) + "]" );
262 } else {
263 this._fillColor = {};
264 this._fillColor.gradientMode = this.getPropertyFromString( "fillGradientMode: ", importStr );
265 this._fillColor.color = this.stringToGradient(this.getPropertyFromString( "fillColor: ", importStr ));
266 }
267
268 if(importStr.indexOf("strokeGradientMode: ") < 0)
269 {
270 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" );
271 } else {
272 this._strokeColor = {};
273 this._strokeColor.gradientMode = this.getPropertyFromString( "strokeGradientMode: ", importStr );
274 this._strokeColor.color = this.stringToGradient(this.getPropertyFromString( "strokeColor: ", importStr ));
275 }
276
277 this._tlRadius = Number( this.getPropertyFromString( "tlRadius: ", importStr ) );
250 this._trRadius = Number( this.getPropertyFromString( "trRadius: ", importStr ) ); 278 this._trRadius = Number( this.getPropertyFromString( "trRadius: ", importStr ) );
251 this._blRadius = Number( this.getPropertyFromString( "blRadius: ", importStr ) ); 279 this._blRadius = Number( this.getPropertyFromString( "blRadius: ", importStr ) );
252 this._brRadius = Number( this.getPropertyFromString( "brRadius: ", importStr ) ); 280 this._brRadius = Number( this.getPropertyFromString( "brRadius: ", importStr ) );