aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-03-09 10:28:40 -0800
committerNivesh Rajbhandari2012-03-09 10:28:40 -0800
commit7793b312ef9490c90c3d2332849ab41d56950437 (patch)
tree4efb6e8545739e57634e2b80373456fd27854456
parentc792c7a82a6247524d3c5bfab5eaa1258931a401 (diff)
downloadninja-7793b312ef9490c90c3d2332849ab41d56950437.tar.gz
Fixing radial gradients for line and circle.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
-rwxr-xr-xjs/lib/geom/circle.js6
-rwxr-xr-xjs/lib/geom/line.js2
2 files changed, 4 insertions, 4 deletions
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js
index 70f608be..8f9f54d1 100755
--- a/js/lib/geom/circle.js
+++ b/js/lib/geom/circle.js
@@ -457,7 +457,7 @@ var Circle = function GLCircle() {
457 if(this._fillColor.gradientMode) { 457 if(this._fillColor.gradientMode) {
458 if(this._fillColor.gradientMode === "radial") { 458 if(this._fillColor.gradientMode === "radial") {
459 gradient = ctx.createRadialGradient(xCtr, yCtr, 0, 459 gradient = ctx.createRadialGradient(xCtr, yCtr, 0,
460 xCtr, yCtr, yScale); 460 xCtr, yCtr, Math.max(yScale, xScale));
461 } else { 461 } else {
462 gradient = ctx.createLinearGradient(0, this._height/2, this._width, this._height/2); 462 gradient = ctx.createLinearGradient(0, this._height/2, this._width, this._height/2);
463 } 463 }
@@ -533,8 +533,8 @@ var Circle = function GLCircle() {
533 if (this._strokeColor) { 533 if (this._strokeColor) {
534 if(this._strokeColor.gradientMode) { 534 if(this._strokeColor.gradientMode) {
535 if(this._strokeColor.gradientMode === "radial") { 535 if(this._strokeColor.gradientMode === "radial") {
536 gradient = ctx.createRadialGradient(xCtr, yCtr, yScale, 536 gradient = ctx.createRadialGradient(xCtr, yCtr, Math.min(xScale, yScale),
537 xCtr, yCtr, 0.5*this._height); 537 xCtr, yCtr, 0.5*Math.max(this._height, this._width));
538 } else { 538 } else {
539 gradient = ctx.createLinearGradient(0, this._height/2, this._width, this._height/2); 539 gradient = ctx.createLinearGradient(0, this._height/2, this._width, this._height/2);
540 } 540 }
diff --git a/js/lib/geom/line.js b/js/lib/geom/line.js
index eaa26cf0..51a6fa98 100755
--- a/js/lib/geom/line.js
+++ b/js/lib/geom/line.js
@@ -365,7 +365,7 @@ var Line = function GLLine( world, xOffset, yOffset, width, height, slope, strok
365 if (this._strokeColor) { 365 if (this._strokeColor) {
366 if(this._strokeColor.gradientMode) { 366 if(this._strokeColor.gradientMode) {
367 if(this._strokeColor.gradientMode === "radial") { 367 if(this._strokeColor.gradientMode === "radial") {
368 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, h/2); 368 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(w/2, h/2));
369 } else { 369 } else {
370 gradient = ctx.createLinearGradient(0, h/2, w, h/2); 370 gradient = ctx.createLinearGradient(0, h/2, w, h/2);
371 } 371 }