-
Notifications
You must be signed in to change notification settings - Fork 30
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
Clicked point to Lonboard map #671
base: main
Are you sure you want to change the base?
Conversation
…into clicked-point2
I think the main question is whether we want to have this as a property or as an event. In general, I think the right way to think about the traitlets is as serializing state. The data state should be the same on each side, so it makes sense for all the data properties to be traitlets. But stuff like the clicked point potentially should be an event handler instead. |
yeah, that's fair (and what I was originally going for). I think I got excited to get the information from the javascript side into somewhere I could access it from the python side and ran with it :). I'll poke around some more when I get some more free time to see if I can wire it up as a legit "on_click" event. With me being totally new to this sort of work, if you happen to have any pointers where to read anything about doing something like this, I'm all ears, my random searching the internet hasn't been as productive as I'd like |
You can use custom messages. See https://ipywidgets.readthedocs.io/en/8.1.5/examples/Widget%20Events.html You can use Then register an on_message handler on the Python side: https://github.com/developmentseed/lonboard/pull/413/files#diff-ab269100f27648760a02f3304913cbb24dbb1b8b2a7a3dc8b514aac5c15ff34dR543 And we'd probably have a wrapper to ensure that only messages with an ID of something like |
Thanks Kyle, that helped a lot! I appear to have it all working on my end but need to get to work. I should be able to get it cleaned up and checked in tonight though! |
ok, all checked in, let me know what you think! |
This PR adds a new property to the Lonboard map that holds a tuple for the coordinate where the user last clicked on the map. It is not implemented as an .on_click(), as was discussed, but I think it accomplishes the same functionality (and may actually have more utility this way). hopefully this is an acceptable pattern, but if not, let me know and I'll see what I can do.