aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
authorhwc4872012-04-27 13:53:14 -0700
committerhwc4872012-04-27 13:53:14 -0700
commitb460ea23025d9d5067dc78e2ae97c71d0dce2d13 (patch)
tree67c3b549d83c490364ed4a4c0dc6304106595b69 /assets
parente73fba18b095f0c270f5d954e5993c155b488c73 (diff)
parent917668dbd753d69b346cb9fd2e665fbe257f5311 (diff)
downloadninja-b460ea23025d9d5067dc78e2ae97c71d0dce2d13.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into Canvas-interaction
Diffstat (limited to 'assets')
-rw-r--r--assets/canvas-runtime.js40
1 files changed, 24 insertions, 16 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index b2db2cbd..104c22cc 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -715,14 +715,22 @@ NinjaCvsRt.RuntimeRectangle = function ()
715 // various declarations 715 // various declarations
716 var pt, rad, ctr, startPt, bPts; 716 var pt, rad, ctr, startPt, bPts;
717 var width = Math.round(this._width), 717 var width = Math.round(this._width),
718 height = Math.round(this._height); 718 height = Math.round(this._height),
719 719 hw = 0.5*width,
720 pt = [inset, inset]; // top left corner 720 hh = 0.5*height;
721 721
722 var tlRad = this._tlRadius; //top-left radius 722 pt = [inset, inset]; // top left corner
723 var trRad = this._trRadius; 723
724 var blRad = this._blRadius; 724 var tlRad = this._tlRadius; //top-left radius
725 var brRad = this._brRadius; 725 var trRad = this._trRadius;
726 var blRad = this._blRadius;
727 var brRad = this._brRadius;
728 // limit the radii to half the rectangle dimension
729 var minDimen = hw < hh ? hw : hh;
730 if (tlRad > minDimen) tlRad = minDimen;
731 if (blRad > minDimen) blRad = minDimen;
732 if (brRad > minDimen) brRad = minDimen;
733 if (trRad > minDimen) trRad = minDimen;
726 734
727 var world = this.getWorld(); 735 var world = this.getWorld();
728 var vpw = world.getViewportWidth(), vph = world.getViewportHeight(); 736 var vpw = world.getViewportWidth(), vph = world.getViewportHeight();
@@ -807,7 +815,7 @@ NinjaCvsRt.RuntimeRectangle = function ()
807 var lw = this._strokeWidth; 815 var lw = this._strokeWidth;
808 var w = world.getViewportWidth(), 816 var w = world.getViewportWidth(),
809 h = world.getViewportHeight(); 817 h = world.getViewportHeight();
810 818
811 var c, 819 var c,
812 inset, 820 inset,
813 gradient, 821 gradient,
@@ -819,13 +827,13 @@ NinjaCvsRt.RuntimeRectangle = function ()
819 // render the fill 827 // render the fill
820 ctx.beginPath(); 828 ctx.beginPath();
821 if (this._fillColor) { 829 if (this._fillColor) {
822 inset = Math.ceil( lw ) + 0.5; 830 inset = Math.ceil( lw ) - 0.5;
823 831
824 if(this._fillColor.gradientMode) { 832 if(this._fillColor.gradientMode) {
825 if(this._fillColor.gradientMode === "radial") { 833 if(this._fillColor.gradientMode === "radial") {
826 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(w/2, h/2)-inset); 834 gradient = ctx.createRadialGradient(w/2, h/2, 0, w/2, h/2, Math.max(w, h)/2);
827 } else { 835 } else {
828 gradient = ctx.createLinearGradient(inset, h/2, w-2*inset, h/2); 836 gradient = ctx.createLinearGradient(inset/2, h/2, w-inset, h/2);
829 } 837 }
830 colors = this._fillColor.color; 838 colors = this._fillColor.color;
831 839
@@ -853,11 +861,11 @@ NinjaCvsRt.RuntimeRectangle = function ()
853 // render the stroke 861 // render the stroke
854 ctx.beginPath(); 862 ctx.beginPath();
855 if (this._strokeColor) { 863 if (this._strokeColor) {
856 inset = Math.ceil( 0.5*lw ) + 0.5; 864 inset = Math.ceil( 0.5*lw ) - 0.5;
857 865
858 if(this._strokeColor.gradientMode) { 866 if(this._strokeColor.gradientMode) {
859 if(this._strokeColor.gradientMode === "radial") { 867 if(this._strokeColor.gradientMode === "radial") {
860 gradient = ctx.createRadialGradient(w/2, h/2, Math.min(h/2, w/2)-inset, w/2, h/2, Math.max(h/2, w/2)); 868 gradient = ctx.createRadialGradient(w/2, h/2, Math.min(h, w)/2-inset, w/2, h/2, Math.max(h, w)/2);
861 } else { 869 } else {
862 gradient = ctx.createLinearGradient(0, h/2, w, h/2); 870 gradient = ctx.createLinearGradient(0, h/2, w, h/2);
863 } 871 }
@@ -1063,9 +1071,9 @@ NinjaCvsRt.RuntimeOval = function ()
1063 if(this._fillColor.gradientMode) { 1071 if(this._fillColor.gradientMode) {
1064 if(this._fillColor.gradientMode === "radial") { 1072 if(this._fillColor.gradientMode === "radial") {
1065 gradient = ctx.createRadialGradient(xCtr, yCtr, 0, 1073 gradient = ctx.createRadialGradient(xCtr, yCtr, 0,
1066 xCtr, yCtr, Math.max(yScale, xScale)); 1074 xCtr, yCtr, Math.max(this._width, this._height)/2);
1067 } else { 1075 } else {
1068 gradient = ctx.createLinearGradient(0, this._height/2, this._width, this._height/2); 1076 gradient = ctx.createLinearGradient(lineWidth/2, this._height/2, this._width-lineWidth, this._height/2);
1069 } 1077 }
1070 colors = this._fillColor.color; 1078 colors = this._fillColor.color;
1071 1079