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 pixel_bounds to Map #616

Merged
merged 1 commit into from
Jun 12, 2020

Conversation

davidbrochart
Copy link
Member

Similar to the bounds read-only attribute, but in projected pixel coordinates instead of lat/lon coordinates (see https://leafletjs.com/reference-1.0.3.html#map-getpixelbounds).
While bounds is ((south, west), (north, east)), pixel_bounds is ((left, top), (right, bottom)) to respect the Leaflet convention.

@martinRenou
Copy link
Member

Is it the size in pixels of the map?

@davidbrochart
Copy link
Member Author

davidbrochart commented Jun 12, 2020

No, its bounds in pixels.

@martinRenou
Copy link
Member

In screen pixels? Is it the size of the map?

@davidbrochart
Copy link
Member Author

Yes, screen pixels. You can get the size of the map from it.

@martinRenou
Copy link
Member

But that does not work when having multiple views with different sizes

@davidbrochart
Copy link
Member Author

As for the bounds, we take the biggest view.

@martinRenou
Copy link
Member

I see :) ok

@@ -1032,6 +1032,11 @@ def _default_options(self):
east = Float(def_loc[1], read_only=True).tag(sync=True)
west = Float(def_loc[1], read_only=True).tag(sync=True)

bottom = Int(0, read_only=True).tag(sync=True)
top = Int(9007199254740991, read_only=True).tag(sync=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this default value?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the biggest Number. We need this initial value in order to play well with the min.

@martinRenou martinRenou merged commit 7347adb into jupyter-widgets:master Jun 12, 2020
@davidbrochart davidbrochart deleted the pixel_bounds branch June 12, 2020 09:33
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