diff options
author | wout <wout@impinc.co.uk> | 2014-07-31 20:31:07 +0200 |
---|---|---|
committer | wout <wout@impinc.co.uk> | 2014-07-31 20:31:07 +0200 |
commit | 98b3ec9d79ef31d59dc865fbc15919b44c69b576 (patch) | |
tree | e1bf9c0c6293a5122f5da9443dec7ee82ed7c4d0 /README.md | |
parent | b2ab34637b96f7bab941390f71b7aafd46ec5565 (diff) | |
download | svg.js-98b3ec9d79ef31d59dc865fbc15919b44c69b576.tar.gz svg.js-98b3ec9d79ef31d59dc865fbc15919b44c69b576.zip |
Reworked sub-pixel offset fix
Diffstat (limited to 'README.md')
-rwxr-xr-x | README.md | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -67,11 +67,17 @@ Svg.js also works outside of the HTML DOM, inside an SVG document for example: </svg> ``` -### Sub pixel offset fix -By default sub pixel offset won't be corrected. To enable it, call the `fixSubPixelOffset()` method: +### Sub-pixel offset fix +Call the `spof()` method to fix sub-pixel offset: ```javascript -var draw = SVG('drawing').fixSubPixelOffset() +var draw = SVG('drawing').spof() +``` + +To enable automatic sub-pixel offset correction when the window is resized: + +```javascript +SVG.on(window, 'resize', function() { draw.spof() }) ``` ## Parent elements @@ -3642,6 +3648,9 @@ SVG.extend(SVG.Rect, { }) ``` +### Refactor your code +Once your implementation is ready, revisit and rework it. We like to keep it [DRY](http://en.wikipedia.org/wiki/Don't_repeat_yourself). + ### Test. Your. Code. It's not that hard to write at least one example per implementation, although we prefer more. Your code might seem to work by quickly testing it in your brwoser but more than often you can't forsee everything. |