nikhilbchilwant / google-web-toolkit-incubator

Automatically exported from code.google.com/p/google-web-toolkit-incubator
1 stars 1 forks source link

GWTCanvas arc method improperly "cuts" continuous paths in IE #281

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The code below drew the expected vertical line connected to a quarter-pie
slice outlined in default black in FF2. But in IE7, Hosted, it drew a
vertical line, and, separately, an arc with a connecting chord across its
two endpoints:

     GWTCanvas canvas = new GWTCanvas(200, 200);
     canvas.beginPath();
     canvas.moveTo(100,50);
     canvas.lineTo(100,100);
     canvas.arc(100, 100, 50, 0, Math.PI/2., false);
     canvas.closePath();
     canvas.stroke();
     RootPanel.get().add(canvas);

IE fails to extend the path from (100,100) to the initial arc endpoint;
instead it is sort of like there was a beginPath inserted before the arc
(but not quite because the final stroke still draws both of these now
distinct "paths").

Workaround: Explicitly break up the path where arc occurs, stroking each
separately and adjusting the second path to re-create the original figure:

        GWTCanvas canvas = new GWTCanvas(200, 200);
        canvas.beginPath();
        canvas.moveTo(100,50);
        canvas.lineTo(100,100);
        canvas.closePath();
        canvas.stroke();
        canvas.beginPath();
        canvas.arc(100, 100, 50, 0, Math.PI/2., false);
        canvas.lineTo(100,100); 
        canvas.closePath();
        canvas.stroke();
        RootPanel.get().add(canvas);

In the workaround code, FF2 and IE7 still have an inconsistency: the
vertical line is darker/thicker in FF2. You need to remove the first
closePath to make the figures exactly the same in both browsers.

May be related to issue #237

Original issue reported on code.google.com by johncurt...@gmail.com on 26 May 2009 at 5:29

GoogleCodeExporter commented 8 years ago

Original comment by jaime...@google.com on 5 Aug 2009 at 12:11