Open rdewit opened 1 year ago
Hey @rdewit, thanks for the report.
Hopefully it helps finding out what's causing it, @KaiVolland . I've tried all sorts of things in the app side of things (like pre-loading the SVGs) but none of them worked. Happy to help out where I can.
Hey @rdewit, actually a timing/loading issue with the svg was my first guess too. Maybe i'll find some time in the next two weeks to have a closer look at this. But i can't promise. :/
Bug
Describe the bug When a style contains an Icon with an image, the legend will not show it unless it's also visible on the map.
To Reproduce Steps to reproduce the behavior:
Expected behavior The legend image(s) should be visible even when the feature has not been drawn on the map (yet).
Screenshots The screenshot shows the problem in our application: the icons for 'Accessible parking' and 'Off-leash area 6am to 9am only' do not show because the features that have those icons are not visible on the map. When we redraw the legend when those features are visible, they show as expected.
Note: the icons in the screenshot are cut off because geostyler-legend does not yet support offsets (which are used in this style). The style of these layers has 3 SVG icons: one for the 'bubble', one for the contents of the bubble and a separate shadow icon. The latter is showing for all styles in the screenshot because it's showing for at least one visible feature.
Environment: This happens both on the latest versions of Firefox and Chrome and both on Linux and Windows.
Additional context It seems that something is preventing the icon image(s) from loading (correctly) in the legend code. When looking at the network tab in the dev tools, I see the image being fetched. I have had similar issues in the past with our custom (non-geostyler) legend where when an image is first loaded without
crossOrigin: anonymous
and then again withoutcrossOrigin
, the map would refuse to show the image due to the browser serving the image from the cache that was stored withoutcrossOrigin
and tainting the canvas. I wonder if this might be something similar.