diff options
author | Nivesh Rajbhandari | 2012-04-25 13:37:02 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-04-25 13:37:02 -0700 |
commit | 5e029d148e267b7ec8662f31ccdae2a0916de329 (patch) | |
tree | 48f4f0593c6b31bdf4f809cb0a589407be5f20c5 | |
parent | b183dbb1d5efef5db0ba3f8004b674b63b66b76a (diff) | |
download | ninja-5e029d148e267b7ec8662f31ccdae2a0916de329.tar.gz |
IKNinja-406 - Strange behavior when changing the corner radius to the maximum value.
IKNinja-1236 - Corner radius is not applied if stroke size is >= 2 times the corner radius.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
-rwxr-xr-x | js/lib/geom/rectangle.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/js/lib/geom/rectangle.js b/js/lib/geom/rectangle.js index 8278f1a3..fcd1c1bd 100755 --- a/js/lib/geom/rectangle.js +++ b/js/lib/geom/rectangle.js | |||
@@ -356,7 +356,9 @@ var Rectangle = function GLRectangle() { | |||
356 | // various declarations | 356 | // various declarations |
357 | var pt, rad, ctr, startPt, bPts; | 357 | var pt, rad, ctr, startPt, bPts; |
358 | var width = Math.round(this.getWidth()), | 358 | var width = Math.round(this.getWidth()), |
359 | height = Math.round(this.getHeight()); | 359 | height = Math.round(this.getHeight()), |
360 | hw = 0.5*width, | ||
361 | hh = 0.5*height; | ||
360 | 362 | ||
361 | pt = [inset, inset]; // top left corner | 363 | pt = [inset, inset]; // top left corner |
362 | 364 | ||
@@ -364,6 +366,12 @@ var Rectangle = function GLRectangle() { | |||
364 | var trRad = this._trRadius; | 366 | var trRad = this._trRadius; |
365 | var blRad = this._blRadius; | 367 | var blRad = this._blRadius; |
366 | var brRad = this._brRadius; | 368 | var brRad = this._brRadius; |
369 | // limit the radii to half the rectangle dimension | ||
370 | var minDimen = hw < hh ? hw : hh; | ||
371 | if (tlRad > minDimen) tlRad = minDimen; | ||
372 | if (blRad > minDimen) blRad = minDimen; | ||
373 | if (brRad > minDimen) brRad = minDimen; | ||
374 | if (trRad > minDimen) trRad = minDimen; | ||
367 | 375 | ||
368 | if ((tlRad <= 0) && (blRad <= 0) && (brRad <= 0) && (trRad <= 0)) { | 376 | if ((tlRad <= 0) && (blRad <= 0) && (brRad <= 0) && (trRad <= 0)) { |
369 | ctx.rect(pt[0], pt[1], width - 2*inset, height - 2*inset); | 377 | ctx.rect(pt[0], pt[1], width - 2*inset, height - 2*inset); |
@@ -452,7 +460,7 @@ var Rectangle = function GLRectangle() { | |||
452 | // render the fill | 460 | // render the fill |
453 | ctx.beginPath(); | 461 | ctx.beginPath(); |
454 | if (this._fillColor) { | 462 | if (this._fillColor) { |
455 | inset = Math.ceil( lw ); | 463 | inset = Math.ceil( lw ) - 0.5; |
456 | 464 | ||
457 | if(this._fillColor.gradientMode) { | 465 | if(this._fillColor.gradientMode) { |
458 | if(this._fillColor.gradientMode === "radial") { | 466 | if(this._fillColor.gradientMode === "radial") { |
@@ -486,7 +494,7 @@ var Rectangle = function GLRectangle() { | |||
486 | // render the stroke | 494 | // render the stroke |
487 | ctx.beginPath(); | 495 | ctx.beginPath(); |
488 | if (this._strokeColor) { | 496 | if (this._strokeColor) { |
489 | inset = Math.ceil( 0.5*lw ); | 497 | inset = Math.ceil( 0.5*lw ) - 0.5; |
490 | 498 | ||
491 | if(this._strokeColor.gradientMode) { | 499 | if(this._strokeColor.gradientMode) { |
492 | if(this._strokeColor.gradientMode === "radial") { | 500 | if(this._strokeColor.gradientMode === "radial") { |