aboutsummaryrefslogtreecommitdiff
path: root/js/lib/geom/circle.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/circle.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/circle.js')
-rwxr-xr-xjs/lib/geom/circle.js34
1 files changed, 30 insertions, 4 deletions
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js
index 8f9f54d1..05501ec3 100755
--- a/js/lib/geom/circle.js
+++ b/js/lib/geom/circle.js
@@ -606,8 +606,20 @@ var Circle = function GLCircle() {
606 rtnStr += "strokeWidth: " + this._strokeWidth + "\n"; 606 rtnStr += "strokeWidth: " + this._strokeWidth + "\n";
607 rtnStr += "innerRadius: " + this._innerRadius + "\n"; 607 rtnStr += "innerRadius: " + this._innerRadius + "\n";
608 rtnStr += "strokeStyle: " + this._strokeStyle + "\n"; 608 rtnStr += "strokeStyle: " + this._strokeStyle + "\n";
609 rtnStr += "strokeColor: " + String(this._strokeColor) + "\n"; 609
610 rtnStr += "fillColor: " + String(this._fillColor) + "\n"; 610 if(this._strokeColor.gradientMode) {
611 rtnStr += "strokeGradientMode: " + this._strokeColor.gradientMode + "\n";
612 rtnStr += "strokeColor: " + this.gradientToString(this._strokeColor.color) + "\n";
613 } else {
614 rtnStr += "strokeColor: " + String(this._strokeColor) + "\n";
615 }
616
617 if(this._fillColor.gradientMode) {
618 rtnStr += "fillGradientMode: " + this._fillColor.gradientMode + "\n";
619 rtnStr += "fillColor: " + this.gradientToString(this._fillColor.color) + "\n";
620 } else {
621 rtnStr += "fillColor: " + String(this._fillColor) + "\n";
622 }
611 623
612 rtnStr += "strokeMat: "; 624 rtnStr += "strokeMat: ";
613 if (this._strokeMaterial) { 625 if (this._strokeMaterial) {
@@ -640,8 +652,22 @@ var Circle = function GLCircle() {
640 this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr ); 652 this._strokeStyle = this.getPropertyFromString( "strokeStyle: ", importStr );
641 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr ); 653 var strokeMaterialName = this.getPropertyFromString( "strokeMat: ", importStr );
642 var fillMaterialName = this.getPropertyFromString( "fillMat: ", importStr ); 654 var fillMaterialName = this.getPropertyFromString( "fillMat: ", importStr );
643 this._fillColor = eval( "[" + this.getPropertyFromString( "fillColor: ", importStr ) + "]" ); 655 if(importStr.indexOf("fillGradientMode: ") < 0) {
644 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" ); 656 this._fillColor = eval( "[" + this.getPropertyFromString( "fillColor: ", importStr ) + "]" );
657 } else {
658 this._fillColor = {};
659 this._fillColor.gradientMode = this.getPropertyFromString( "fillGradientMode: ", importStr );
660 this._fillColor.color = this.stringToGradient(this.getPropertyFromString( "fillColor: ", importStr ));
661 }
662
663 if(importStr.indexOf("strokeGradientMode: ") < 0)
664 {
665 this._strokeColor = eval( "[" + this.getPropertyFromString( "strokeColor: ", importStr ) + "]" );
666 } else {
667 this._strokeColor = {};
668 this._strokeColor.gradientMode = this.getPropertyFromString( "strokeGradientMode: ", importStr );
669 this._strokeColor.color = this.stringToGradient(this.getPropertyFromString( "strokeColor: ", importStr ));
670 }
645 671
646 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); 672 var strokeMat = MaterialsModel.getMaterial( strokeMaterialName );
647 if (!strokeMat) { 673 if (!strokeMat) {