You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have thousands of polygons i am rendering, and i need to be able to show/hide them and also update the opacity of them. Currently i am creating them any time an update needs to happen like this: let glifyPolygons = glify.shapes({ map: map, data: colouredGrids, click: (e: any, feature: GeoJSON.Feature) => { handleGridClick(feature); }, color: (index: any, shape: any) => hexToRgb(shape.properties.color, transparency[0] / 100), });
Then any time a i need to hide or change the opacity, i remove it: glifyPolygons.remove()
then redraw the polygons with the new opacity. However when i show/hide the polygons alot or update the opacity too frequently I get a warning in the console:
WARNING: Too many active WebGL contexts. Oldest context will be lost.
Then other shapes i am drawing with glify start to be deleted. It seems like the WebGL contexts arent being removed. I found a quick solution to show/hide by doing this: if (layer && !state) { layer.remove(); } else if (layer && state) { layer.addTo(map); }
but the polygon data can also change so i need to be able to create new shape objects.
How can i fix this?
The text was updated successfully, but these errors were encountered:
I have thousands of polygons i am rendering, and i need to be able to show/hide them and also update the opacity of them. Currently i am creating them any time an update needs to happen like this:
let glifyPolygons = glify.shapes({ map: map, data: colouredGrids, click: (e: any, feature: GeoJSON.Feature) => { handleGridClick(feature); }, color: (index: any, shape: any) => hexToRgb(shape.properties.color, transparency[0] / 100), });
Then any time a i need to hide or change the opacity, i remove it:
glifyPolygons.remove()
then redraw the polygons with the new opacity. However when i show/hide the polygons alot or update the opacity too frequently I get a warning in the console:
WARNING: Too many active WebGL contexts. Oldest context will be lost.
Then other shapes i am drawing with glify start to be deleted. It seems like the WebGL contexts arent being removed. I found a quick solution to show/hide by doing this:
if (layer && !state) { layer.remove(); } else if (layer && state) { layer.addTo(map); }
but the polygon data can also change so i need to be able to create new shape objects.
How can i fix this?
The text was updated successfully, but these errors were encountered: