Libshumate: get clicked location

Hi folks!!

How can I get clicked location on a map using libshumate gtk4 library?

I’ve created a Shumate.PathLayer with a several of Shumate.Point and I’d like to know when the user click on some of these Shumate.Points.

I’ve tried by Gtk.GestureClick, somethingk like this, but it doesn’t work for me:

gesture = Gtk.GestureClick.new()
gesture.set_button(Gdk.BUTTON_PRIMARY)
gesture.connect("pressed", lambda *_: print("pressed"))

viewport = self.get_viewport()
path_layer = Shumate.PathLayer.new(viewport)
for tp in points:
    shumate_location = Shumate.Point.new()
    shumate_location.set_location(tp.latitude, tp.longitude)
    shumate_location.add_controller(gesture)
    path_layer.add_node(shumate_location)

self.add_overlay_layer(path_layer)

Thanks!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.