[whatwg] Canvas - Exception on arc with negative radius

Hi,

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>
<html>
<script>
    function drawShape()
    {
        var canvas = document.getElementById("canvas");
        var ctx = canvas.getContext("2d");

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

        ctx.beginPath();
        ctx.fillRect(10,10,30,30);
    }
</script>
<body onload="drawShape();">
<canvas id="canvas" width="100" height="60">
</body>
</html>

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%
20dimethylcyclopropane

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?

-Dirk

Received on Friday, 27 March 2009 12:50:47 UTC