You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE] Revert to using single onPanUpdate to detect pan events #1729
Since v4 I was able to create a marker which contained a GestureDetector as builder output. This GestureDetector included an onPanUpdate event which I used to enable dragging functionality. It worked fine a long time.
Now I upgraded FlutterMap to v5 and it came out, that exactly this event is not called anymore. Funny: All other events can be called as onTap or even onVerticalDragUpdate.
Do you have an idea what changed and how could I restore this feature?
How can we reproduce it?
FlutterMap(
children: [
MarkerLayer(
markers: [
Marker(
point: myPoint,
builder: (context) => GestureDetector(
onTap: () {
// WORKS
},
onPanUpdate: (details) {
// DOES NOT WORK ANYMORE
},
child: myIcon
)
)
]
)
]
)
Do you have a potential solution?
No response
Platforms
Android, web, iOS
Severity
Obtrusive: Prevents normal functioning but causes no errors in the console
This is not part of v5 as I see it. I believe it was integrated a bit later... But I cannot do another major upgrade at the moment. I need a v5 solution, if possible...
Ah, sorry, didn't see that you were still using v5. Can I ask why you are not using the flutter_map_dragmarker plugin? If there's a reason, maybe you can check the implementation there?
The only thing I can think of off the top of my head as to why this changed is due to #1455, but that should have been available in and impacting v4 as well.
The only thing I can think of off the top of my head as to why this changed is due to #1455, but that should have been available in and impacting v4 as well.
Yes, you are right, I cross-checked: We were using v3.1.0, not 4 - sorry my fault.
Can I ask why you are not using the flutter_map_dragmarker plugin
I am currently trying. But my problem is, that I am using the flutter_map_marker_popup plugin for my markers. So I cannot see a way to combine both plugins to create a draggable popup marker. I am currently trying to implement an inherited PopupMarkerLayer with integrated code from the DragMarker plugin, but it seems not correct to me:
Using one third-party lib code (DragMarker) to enhance a second third-party lib (PopupMarker) just to fix an issue of a third plugin (FlutterMap itself) whilst previously everything was fine...
Yes, I can listen to these events successfully. But the events do not what I want to, since they give me only delta x or delta y. So my markers will only be moved directly up/down or left/right.
Yes, I could implement some workaround logic to recalculate the correct direction as the DragMarker plugin does.
But do you really believe, that this is the smartest way? Using two independent events (plus need to store some start positions for the opposite directions, so in fact I need at least 4 events) which are not designed for this issues (as there are designed for one-directional issues as scrollbars or similar) to write some logic by manually detecting the touch point/cursor position and recalculate some behaviour which originally yet existed with onPanUpdate?
I mean, pls have a look at the DragMarker plugin's code. This all is required to get this workaround running for something which already worked out-of-the-box.
changed the title [-][BUG] onPanUpdate event is not called on layer anymore[/-][+][BUG] `onPanUpdate` event is not called on layer anymore[/+]on Dec 10, 2023
I'm not saying to use that plugin, I'm just saying it doesn't appear to be too hard to implement. Please see #1455 to find out why the onPanUpdate was removed.
At the moment, there is no short term plan to add this back, so if you require it, you'll need to use this workaround.
changed the title [-][BUG] `onPanUpdate` event is not called on layer anymore[/-][+][FEATURE] Revert to using single `onPanUpdate` to detect pan events[/+]on Aug 8, 2024
I ran into the same problem.
It happens because the vertical/horizontal gesture recognizers take precedence over the pan recognizer on one dimensional drags.
I solved it using a RawGestureDetector with a customPanGestureRecognizer that immediately declares victory:
classEagerPanGestureRecognizerextendsPanGestureRecognizer {
@overridevoidhandleEvent(PointerEvent event) {
// Immediately claim victory for this pointerif (event isPointerMoveEvent) resolve(GestureDisposition.accepted);
super.handleEvent(event);
}
}
Activity
JaffaKetchup commentedon Nov 12, 2023
Hi @S-Man42,
Can you try disabling
MapOptions.applyPointerTranslucencyToLayersto see if that makes a difference?S-Man42 commentedon Nov 12, 2023
This is not part of v5 as I see it. I believe it was integrated a bit later... But I cannot do another major upgrade at the moment. I need a v5 solution, if possible...
JaffaKetchup commentedon Nov 12, 2023
Ah, sorry, didn't see that you were still using v5. Can I ask why you are not using the flutter_map_dragmarker plugin? If there's a reason, maybe you can check the implementation there?
The only thing I can think of off the top of my head as to why this changed is due to #1455, but that should have been available in and impacting v4 as well.
S-Man42 commentedon Nov 12, 2023
Yes, you are right, I cross-checked: We were using v3.1.0, not 4 - sorry my fault.
I am currently trying. But my problem is, that I am using the flutter_map_marker_popup plugin for my markers. So I cannot see a way to combine both plugins to create a draggable popup marker. I am currently trying to implement an inherited PopupMarkerLayer with integrated code from the DragMarker plugin, but it seems not correct to me:
Using one third-party lib code (DragMarker) to enhance a second third-party lib (PopupMarker) just to fix an issue of a third plugin (FlutterMap itself) whilst previously everything was fine...
JaffaKetchup commentedon Nov 12, 2023
Ok, can you try what that PR recommends to fix the issue then and listen to
onVerticalDragandonHorizontalDragseparately?S-Man42 commentedon Nov 12, 2023
Yes, I can listen to these events successfully. But the events do not what I want to, since they give me only delta x or delta y. So my markers will only be moved directly up/down or left/right.
Yes, I could implement some workaround logic to recalculate the correct direction as the DragMarker plugin does.
But do you really believe, that this is the smartest way? Using two independent events (plus need to store some start positions for the opposite directions, so in fact I need at least 4 events) which are not designed for this issues (as there are designed for one-directional issues as scrollbars or similar) to write some logic by manually detecting the touch point/cursor position and recalculate some behaviour which originally yet existed with onPanUpdate?
I mean, pls have a look at the DragMarker plugin's code. This all is required to get this workaround running for something which already worked out-of-the-box.
[-][BUG] onPanUpdate event is not called on layer anymore[/-][+][BUG] `onPanUpdate` event is not called on layer anymore[/+]6 remaining items
JaffaKetchup commentedon May 24, 2024
I'm not saying to use that plugin, I'm just saying it doesn't appear to be too hard to implement. Please see #1455 to find out why the
onPanUpdatewas removed.At the moment, there is no short term plan to add this back, so if you require it, you'll need to use this workaround.
[-][BUG] `onPanUpdate` event is not called on layer anymore[/-][+][FEATURE] Revert to using single `onPanUpdate` to detect pan events[/+]Robbendebiene commentedon Jan 19, 2026
I ran into the same problem.
It happens because the vertical/horizontal gesture recognizers take precedence over the pan recognizer on one dimensional drags.
I solved it using a
RawGestureDetectorwith a customPanGestureRecognizerthat immediately declares victory:GITBOOK-66: Add information about advanced gesture handling (based of…
JaffaKetchup commentedon Sep 3, 2026
Thanks again @Robbendebiene :)
I've added your workaround to the documentation: https://docs.fleaflet.dev/layers/marker-layer#handling-gestures
JaffaKetchup commentedon Sep 3, 2026
Because there are no plans to change this at the moment, and a simple documented workaround is available, I'm going to close this.
Only 3 years down the line - hope everyone in this thread is all good :)