NieuwlandGeo/SLDReader

externalgraphic files not scaled for Device Pixel Ratio for polygon fills

Closed this issue · 2 comments

externalgraphic files are not scaled to take account of Device Pixel Ratio when generating (polygon) fills. This results in patterns appearing very small on high DP ratio devices like iPhone X (dpr = 3.0). This seems to be fixable (I have tested this on both .png files and .svg files) by inserting:
imageRatio *= window.devicePixelRatio;
at line 2152 of sldreader.js (release 0.2.8):
https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio
However, if this gave unaccceptable support for older browsers (e.g. pre-IE11), then DEVICE_PIXEL_RATIO from import 'ol/has' could be used. (However, I don't really understand the "require" statements at the top of sldreader.js so wouldn't like to suggest how that could be added).

Good catch. I have refactored the polygon graphic fill logic in PR #89, taking device pixel ratio into account.
I will publish a new version of the library later today.

The fix is now live in SLDReader v0.2.9.