wout/svg.js — pull request #27 by DASPRiD (2013-04-21 14:40:41+00:00)
Title: Add sub-pixel offset handling

This bugfix takes care of a possible sub-pixel offset of the SVG element. This is because Firefox and Internet Explorer both use the float-position as starting coordinate when rendering the SVG. This leads to lines drawn in sub-pixels which are meant to be drawn in full pixels.

For reference, see https://bugzilla.mozilla.org/show_bug.cgi?id=608812

Beside fixing the offset on load, this fix also recalculates the offset on every window resize, so if the container of the SVG is centered with ```margin 0 auto``` or percentage positioning, it will stay snapped on pixels.

Basically one would want to recalculate the offset every time the SVG element is moved relative to the 0,0 position of the ```

```, but we don't have listeners for that, and the alternative of checking the offset periodically every N milliseconds doesn't sound very nice to me.