Work around a WebKit bug in which the same path cannot be used to storke and fill.
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 11 Dec 2010 21:16:52 +0000 (16:16 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 11 Dec 2010 21:16:52 +0000 (16:16 -0500)
RGB Converter.wdgt/Widget.js

index 1fef88549cb67dca7b79eb2f260a591c2246e04e..ae334541cf21855854f273b2c172af14eceb925c 100644 (file)
@@ -157,14 +157,23 @@ function Draw()
   context.fill();
   context.closePath();
 
-  // Draw the inner wheel.
+  // Draw the inner wheel. WebKit in 10.6.5 (and maybe earlier) has a bug in
+  // which you can't fill a path after stroking it, or vice versa.
+  var _arc = function(c) {
+    c.arc(center[0], center[1], canvas.width / 4.75, 0, Math.PI * 2, true);
+  }
+  context.save();
+  context.beginPath();
+  _arc(context)
+  context.strokeStyle = 'rgb(30,30,30)';
+  context.stroke();
+
   context.beginPath();
-  context.arc(center[0], center[1], canvas.width / 4.75, 0, Math.PI * 2, true);
+  _arc(context);
   context.fillStyle = _GetRGBColorString();
   context.fill();
-  context.strokeStyle = 'black';
-  context.stroke();
   context.closePath();
+  delete _arc;
 }
 
 // ###################################################################