ol-mapbox-style icon indicating copy to clipboard operation
ol-mapbox-style copied to clipboard

`icon-offset` moves left instead of right

Open mike-000 opened this issue 3 years ago • 2 comments

The specification https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#layout-symbol-icon-offset says Positive values indicate right and down However as implemented it moves left. See https://codesandbox.io/s/print-to-scale-forked-cbx1cz?file=/main.js and comment out the styleLayer.layout['icon-offset'] = [100, 100]; to see the original position of the station icon. As noted in https://github.com/openlayers/openlayers/pull/13975#issuecomment-1215593028 this code would be affected by that issue, but currently ).map((v) => -v * spriteImageData.pixelRatio) would need to ).map((v)(v, i) => (1 - 2 * i) * v * spriteImageData.pixelRatio). If making a breaking change it might be worth making a further change to define displacement positive down consistent with ol/style/Text offsetY.

mike-000 avatar Aug 15 '22 21:08 mike-000

Please suggest a fix for both.

ahocevar avatar Aug 16 '22 07:08 ahocevar

I don't think we need a temporary fix which could be broken again by OL7. Decide what should be in OL7, implement it, then fix this so it behaves as specified.

mike-000 avatar Aug 16 '22 13:08 mike-000

If we make more breaking changes to ol/style/Image, they will be in v8. So now is the time to fix this here.

ahocevar avatar Aug 18 '22 15:08 ahocevar