[whatwg] Canvas - Exception on arc with negative radius

Dirk Schulze vbs85 at gmx.de
Fri Mar 27 12:50:47 PDT 2009


why does the spec want an INDEX_SIZE_ERR exception on arc's with a
negative radius? This blocks further drawings. 

Here is a short example:

<!DOCTYPE html>
    function drawShape()
        var canvas = document.getElementById("canvas");
        var ctx = canvas.getContext("2d");

        //arc(x, y, radius, startAngle, endAngle, anticlockwise)
        ctx.arc(30, 30,-20, 0, 2*Math.PI, false);

<body onload="drawShape();">
<canvas id="canvas" width="100" height="60">

The circle, drawn by the arc, has a negative radius. A negative radius
doesn't make sense for circles, but an INDEX_SIZE_ERR exception stops
further drawing of the rect, even if the code is ok there.

Another example is: http://blahbleh.com/molecools.php?name=1,2%

If you turn the molecule a bit, the circles disappear with a
INDEX_SIZE_ERR exception.

Isn't it better to just ignore the arc and go on with the drawing, like
Firefox does? And perhaps the same for arcTo?


More information about the whatwg mailing list