Skip to content

Fix polygon map bounds #110

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

Merged
merged 3 commits into from
Mar 12, 2018
Merged

Conversation

mjmdavis
Copy link

@mjmdavis mjmdavis commented Mar 5, 2018

Leaflet needs to know the size of the viewport in order to calculate the zoom level for displaying geojson content.
In order to resize gracefully, fitBounds needs to be called each time the size of the map is changed.

By moving the fitBounds call into update we can ensure that the geojson will always fit inside the viewport of the map.
Fixes #28

@mjmdavis
Copy link
Author

mjmdavis commented Mar 5, 2018

Thinking about it, this could be annoying when you want to stay zoomed into a specific spot...

@mjmdavis
Copy link
Author

mjmdavis commented Mar 7, 2018

@gnestor @blink1073 can someone cast an eye over this?

@mjmdavis mjmdavis force-pushed the fix-polygon-map-bounds branch from 525c3b2 to 07e45af Compare March 7, 2018 10:51
@gnestor
Copy link
Collaborator

gnestor commented Mar 8, 2018

@mjmdavis Thanks!! I tried it out and there is an improvement when rendering an (polygon) output in a notebook. I don't see any different when rendering a GeoJSON document.

Thinking about it, this could be annoying when you want to stay zoomed into a specific spot...

Can you elaborate?

@mjmdavis
Copy link
Author

mjmdavis commented Mar 8, 2018

@gnestor The issue could arise when the user wants to stay zoomed into a specific spot, then resizes. Their zoom would be reset and they could lose their place. I think we can probably ignore this for now. If it's that important, a user could only render the section of geojson that they care about.

@mjmdavis
Copy link
Author

mjmdavis commented Mar 8, 2018

I have a wip with a 'zoom to bounds' button that breaks the build for some reason.

@mjmdavis
Copy link
Author

@gnestor I feel like this is ready to merge. It fixes the bounds zoom of geojson inside notebooks, and this is super annoying for my team at work. Let me know if there is anything else I should change.

I'll working on #114.

@gnestor gnestor merged commit b58beaf into jupyterlab:master Mar 12, 2018
@gnestor
Copy link
Collaborator

gnestor commented Mar 12, 2018

Ok, thanks @mjmdavis!

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