Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom redraw method for TileLayer #242

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Farkites
Copy link

Description

Adds custom redraw method to TileLayer to round Zoom levels and fix the issue #236

This fix is a workaround suggested in this comment by Leaflet.js maintainers.

Test fix:

@emilhe
Copy link
Owner

emilhe commented Jul 3, 2024

Could you elaborate on what the code is doing? Apart from the fix copied from Leaflet/Leaflet#8613, I am not sure why the rest is needed. I tried your example using just that code ( implemented in #244), and it seems to work as intended. I have pushed the build as dash-leaflet==1.0.16rc3. Could you check if it works as intended, or if there are edge cases not covered?

@Farkites
Copy link
Author

Farkites commented Jul 4, 2024

Thanks for reviewing @emilhe! I have checked your implementation in #244 and it works exactly as expected both for #236 and for the issue in dash-cytoscape with the cytoscape + leaflet all in one component.

Apologies for the confusing code, I run into some issues overwriting the redraw() function that lead me to this rather convoluted logic. With my initial approach the redraw function was being called in an infinite loop, probably due to the adding and removing layers to useMap that was calling the redraw again, so I had to add the redrawNeeded state.

Your implementation is also clearer than mine and I haven't found any edge cases not covered. So I'm very happy to proceed with your approach and close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants