aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
authorhwc4872012-05-18 12:35:58 -0700
committerhwc4872012-05-18 12:35:58 -0700
commit6b03f357f45d76733ae7bf5ff52ffe2fb2a84fda (patch)
tree2411bd4bf3478621a16c83ead914670e0d143372 /js/lib
parent651341341f894c4d0def267ab3250e77f7d0c276 (diff)
downloadninja-6b03f357f45d76733ae7bf5ff52ffe2fb2a84fda.tar.gz
Updates for WebGL/Canvas 2D authortime and runtime gradients.
Diffstat (limited to 'js/lib')
-rwxr-xr-xjs/lib/geom/circle.js2
-rwxr-xr-xjs/lib/geom/rectangle.js10
2 files changed, 5 insertions, 7 deletions
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js
index 2ca4c1f5..4a369844 100755
--- a/js/lib/geom/circle.js
+++ b/js/lib/geom/circle.js
@@ -581,7 +581,7 @@ exports.Circle = Object.create(GeomObj, {
581 if (this._strokeColor) { 581 if (this._strokeColor) {
582 if(this._strokeColor.gradientMode) { 582 if(this._strokeColor.gradientMode) {
583 if(this._strokeColor.gradientMode === "radial") { 583 if(this._strokeColor.gradientMode === "radial") {
584 gradient = ctx.createRadialGradient(xCtr, yCtr, Math.min(xScale, yScale), 584 gradient = ctx.createRadialGradient(xCtr, yCtr, 0,
585 xCtr, yCtr, 0.5*Math.max(this._height, this._width)); 585 xCtr, yCtr, 0.5*Math.max(this._height, this._width));
586 } else { 586 } else {
587 gradient = ctx.createLinearGradient(0, this._height/2, this._width, this._height/2); 587 gradient = ctx.createLinearGradient(0, this._height/2, this._width, this._height/2);
diff --git a/js/lib/geom/rectangle.js b/js/lib/geom/rectangle.js
index 711245ae..b85433a0 100755
--- a/js/lib/geom/rectangle.js
+++ b/js/lib/geom/rectangle.js
@@ -507,7 +507,7 @@ exports.Rectangle = Object.create(GeomObj, {
507 } 507 }
508 }, 508 },
509 509
510 render: { 510 render: {
511 value: function() { 511 value: function() {
512 // get the world 512 // get the world
513 var world = this.getWorld(); 513 var world = this.getWorld();
@@ -538,7 +538,6 @@ exports.Rectangle = Object.create(GeomObj, {
538 if(this._fillColor.gradientMode) { 538 if(this._fillColor.gradientMode) {
539 if(this._fillColor.gradientMode === "radial") { 539 if(this._fillColor.gradientMode === "radial") {
540 var ww = w - 2*lw, hh = h - 2*lw; 540 var ww = w - 2*lw, hh = h - 2*lw;
541 //gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2-this._strokeWidth, h/2, Math.max(ww, hh)/2);
542 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(ww, hh)/2); 541 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(ww, hh)/2);
543 } else { 542 } else {
544 gradient = ctx.createLinearGradient(inset, h/2, w-inset, h/2); 543 gradient = ctx.createLinearGradient(inset, h/2, w-inset, h/2);
@@ -572,11 +571,10 @@ exports.Rectangle = Object.create(GeomObj, {
572 inset = Math.ceil( 0.5*lw ) - 0.5; 571 inset = Math.ceil( 0.5*lw ) - 0.5;
573 572
574 if(this._strokeColor.gradientMode) { 573 if(this._strokeColor.gradientMode) {
575 if(this._strokeColor.gradientMode === "radial") { 574 if(this._strokeColor.gradientMode === "radial")
576 gradient = ctx.createRadialGradient(w/2, h/2, Math.min(h, w)/2-inset, w/2, h/2, Math.max(h, w)/2); 575 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(h, w)/2);
577 } else { 576 else
578 gradient = ctx.createLinearGradient(0, h/2, w, h/2); 577 gradient = ctx.createLinearGradient(0, h/2, w, h/2);
579 }
580 colors = this._strokeColor.color; 578 colors = this._strokeColor.color;
581 579
582 len = colors.length; 580 len = colors.length;