3 ms·
If num is an integer, it returns num + 0.5; otherwise it just returns num. I don't see why this is called 'round' or why it would be particularly useful behavi
by endtime 16y ago
If num is an integer, it returns num + 0.5; otherwise it just returns num. I don't see why this is called 'round' or why it would be particularly useful behavior, so it's probably a bug.
- mryall 16y agoI'm pretty sure it's to work around a difference in SVG and VML. In SVG, a one-pixel line rendered at an integral coordinate (like x=1) will render half-half on either side of that value, resulting in a blurry two-pixel-wide line. VML renders a one-pixel line in this case, automatically colouring the pixel(s) between x=1 and x=2. Raphaël adds 0.5 to the values in SVG in order to make one-pixel-wide lines render as a single pixel instead of two.
- endtime 16y agoOh, cool, thanks for explaining that.