plotly / dash-cytoscape

Interactive network visualization in Python and Dash, powered by Cytoscape.js
https://dash.plot.ly/cytoscape
MIT License
587 stars 120 forks source link

[BUG] CyLeaflet: Updating Leaflet tile layers does not change max zoom of CyLeaflet #205

Closed emilykl closed 2 months ago

emilykl commented 5 months ago

Description

After creating a CyLeaflet instance, the tile layer can be updated by using a callback to update the children of the Leaflet component.

If the new tile layer has a different max zoom level than the previous tile layer, you would expect the maximum zoom of CyLeaflet to also change, but instead it remains the same.

Expected Results

The maximum zoom of CyLeaflet updates to match the maximum zoom of the new tile layer.

Actual Results

The maximum zoom of CyLeaflet remains the same.

If the new tile layer has a higher maxZoom than the old one, this means you are not able to zoom in as far as the new tile layer allows.

If the new tile layer has a lower maxZoom than the old one, this means CyLeaflet will not properly stop the zooming at the new maxZoom, resulting in the tiles disappearing when zooming beyond that point.

emilykl commented 4 months ago

Proposed fix: Add a callback as part of the CyLeaflet AIO component, which takes the Leaflet children as input and Cytoscape max zoom as output. The callback looks at the maxZoom of the first child in the Leaflet children and applies the appropriate corresponding Cytoscape max zoom.