diff options
author | Nivesh Rajbhandari | 2012-03-09 10:28:40 -0800 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-03-09 10:28:40 -0800 |
commit | 7793b312ef9490c90c3d2332849ab41d56950437 (patch) | |
tree | 4efb6e8545739e57634e2b80373456fd27854456 /js/lib/geom | |
parent | c792c7a82a6247524d3c5bfab5eaa1258931a401 (diff) | |
download | ninja-7793b312ef9490c90c3d2332849ab41d56950437.tar.gz |
Fixing radial gradients for line and circle.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/lib/geom')
-rwxr-xr-x | js/lib/geom/circle.js | 6 | ||||
-rwxr-xr-x | js/lib/geom/line.js | 2 |
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 | } |