W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2009

[whatwg] Canvas - Exception on arc with negative radius

From: Dirk Schulze <vbs85@gmx.de>
Date: Fri, 27 Mar 2009 20:50:47 +0100
Message-ID: <1238183447.18321.4.camel@dirk-laptop>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:47:49 GMT