Skip to content

feat: replace map _height with height #816

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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ATL2001
Copy link
Contributor

@ATL2001 ATL2001 commented Jun 22, 2025

per what we discussed in #781 I believe I've come up with a good solution here. I had to add some CSS to the data-overlay-container which appears to be generated by the typescript which the lonboard div is housed in. and then I needed to make some tweaks to the map div which lives inside the lonboard one as well. then I changed _height to height and tweaked the way the default was setup so as to not make the default functionality of the creation of the map change.

but now if the user knows they want to put the map into an IFrame or some other container that has a fixed height, they can specify height="100%" and the map will fill the container's height.

I also checked in an example notebook so you can check the behavior yourself. I do not intend to keep that in there (unless you think it would be a benefit for others, if so I should probably retool it to make it a little nicer)

If this looks good let me know and I can find some time to update the docs so they match the behavior 👍

ATL2001 added 5 commits June 22, 2025 15:20
…string for the height of the lonboard div.

set the map div inside the lonboard div to be 100% height/width always
…not an integer so we can pass values like '300px' or '100%'

set the height/width of the layout of the widget to 100%

mark the body overflow to hidden so if it's inside a smaller container, it wont overrun it or make some scroll bars show up
shows the behavior of the height functionality
@ATL2001 ATL2001 changed the title replace map _height with height feat: replace map _height with height Jun 22, 2025
@github-actions github-actions bot added the feat label Jun 22, 2025
lonboard/_map.py Outdated
@@ -177,7 +179,7 @@ def on_click(self, callback: Callable, *, remove: bool = False) -> None:
Indicates if a click handler has been registered.
"""

_height = t.Int(default_value=DEFAULT_HEIGHT, allow_none=True).tag(sync=True)
height = t.Unicode(default_value=DEFAULT_HEIGHT).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.

I don't really want to have a breaking change here, so if we allow strings here, it should be a t.Union of strings and integers (or at least we need to validate that we can pass in an integer and it'll get converted to a string, but we probably want to add a px suffix?)

@kylebarron
Copy link
Member

kylebarron commented Jun 24, 2025

It would be really nice if the HTML export automatically filled the entire window:

Map([]).to_html("test.html")

gives:
image

@ATL2001
Copy link
Contributor Author

ATL2001 commented Jun 25, 2025

oh yeah, this exporting as height 100% looks really sharp! you want a map, you get a map! 💥

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

Successfully merging this pull request may close these issues.

2 participants