openlayers / ol-mapbox-style

Use Mapbox Style objects with OpenLayers
https://unpkg.com/ol-mapbox-style/dist/examples/index.html
BSD 2-Clause "Simplified" License
350 stars 120 forks source link

line-pattern webgl #1045

Open nssang00 opened 11 months ago

nssang00 commented 11 months ago

Since line-pattern is not supported, I personally used createPattern (https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createPattern), but the problem was that the image was not drawn along the line.

However, I confirmed that the line pattern is drawn normally in the webgl version (https://openlayers.org/en/latest/examples/webgl-draw-line.html). Are you planning to support ol-mapbox-gl webgl version?

ahocevar commented 11 months ago

ol-mapbox-style uses the Canvas 2D renderer. Support for line patterns is planned for the Canvas 2D renderer.

nssang00 commented 11 months ago

Is it possible to draw in the corresponding direction along a line on a 2D canvas?

ahocevar commented 11 months ago

Yes, using a transform and doing separate stroke() operations for each segment.