flutter-maplibre-gl
flutter-maplibre-gl copied to clipboard
Adding events to the map
Like it is in the JavaScript version, is it possible to attach events to the map? For example like the MouseTouchEvent
, more specifically touchend
.
map.on('touchend', (e) => {
console.log(e);
}
My exact use case is that I need to trigger a method when a long press ends.
Yes, you can specify different event callbacks in the MaplibreMap
constructor, e.g. onMapLongClick
Yes, this I got it, I'm already using onMapLongClick, but my question is can we raise an event when the long map click ends?
I am using the native Flutter Listener widget for this with the child being an instance of the MaplibreMap. Then, I am using the onPointerUp callback in the Listener widget to capture when the longpress ends. The issue is that onPointerUp will be called everytime the pointer is up, so even for simple clicks on the instance of the MaplibreMap. So having to keep boolean to know whether it's a longpress that is ending.
I hope it's the right way of doing.
can we raise an event when the long map click ends?
When is the long click event raised for you? During the long click? I unfortunately think its not possible to change this in the native SDK we're using.
Closing this question since there hasn't been any response in a long time.