sunng87 / heatcanvas

Pixel based heatmap with html5 canvas.
http://sunng87.github.com/heatcanvas/
401 stars 54 forks source link

Issue when using in Bootstrap modals #46

Closed albertobenavides closed 1 year ago

albertobenavides commented 1 year ago

I am rendering a map inside a Bootstrap modal. The map gets resized properly when the modal opens with map.invalidateSize() as suggested in https://stackoverflow.com/a/49441778/3113008

But the heatcanvas dissapears and then the map needs to be paned or zoomed in order to show the heatcanvas layer.

Anyone have any idea why this is happening?

albertobenavides commented 1 year ago

Well, a workaround is to remove and add the layer after the map.invalidateSize():

map.invalidateSize()
map.removeLayer(heatmap);
map.addLayer(heatmap);

So... I think this has been self resolved, I guess, haha.