Skip to content
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

[FEATURE] Revert to using single onPanUpdate to detect pan events #1729

Open
S-Man42 opened this issue Nov 12, 2023 · 12 comments · May be fixed by #1809
Open

[FEATURE] Revert to using single onPanUpdate to detect pan events #1729

S-Man42 opened this issue Nov 12, 2023 · 12 comments · May be fixed by #1809
Labels
feature This issue requests a new feature P: 4 (far future) S: core Scoped to the core flutter_map functionality

Comments

@S-Man42
Copy link

S-Man42 commented Nov 12, 2023

What is the bug?

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

@S-Man42 S-Man42 added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels Nov 12, 2023
@JaffaKetchup
Copy link
Member

Hi @S-Man42,
Can you try disabling MapOptions.applyPointerTranslucencyToLayers to see if that makes a difference?

@S-Man42
Copy link
Author

S-Man42 commented 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
Copy link
Member

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
Copy link
Author

S-Man42 commented Nov 12, 2023

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...

@JaffaKetchup
Copy link
Member

Ok, can you try what that PR recommends to fix the issue then and listen to onVerticalDrag and onHorizontalDrag separately?

@S-Man42
Copy link
Author

S-Man42 commented 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.

@JaffaKetchup JaffaKetchup added needs triage This new bug report needs reproducing and prioritizing P: 3 (low) (Default priority for feature requests) S: core Scoped to the core flutter_map functionality and removed needs triage This new bug report needs reproducing and prioritizing labels Dec 10, 2023
@JaffaKetchup JaffaKetchup changed the title [BUG] onPanUpdate event is not called on layer anymore [BUG] onPanUpdate event is not called on layer anymore Dec 10, 2023
@josxha josxha linked a pull request Dec 14, 2023 that will close this issue
38 tasks
@josxha josxha linked a pull request Jan 23, 2024 that will close this issue
@Mike-3
Copy link

Mike-3 commented May 22, 2024

Is there any progress?
The problem is that flutter_map 3.1 is no longer compatible with the current Flutter. But we cannot update flutter_map to the current version because the touch events no longer work properly.
There are no more status changes/progress in the corresponding PR.

@JaffaKetchup
Copy link
Member

Ok, can you try what that PR recommends to fix the issue then and listen to onVerticalDrag and onHorizontalDrag separately?

Have you tried this?

@JaffaKetchup JaffaKetchup removed the needs triage This new bug report needs reproducing and prioritizing label May 23, 2024
@S-Man42
Copy link
Author

S-Man42 commented May 23, 2024

Yes, we did (see my post above). But we did not came up with any proper solution, so we had do downgrade. We hoped very much for the upcoming changes and the PR...

@JaffaKetchup
Copy link
Member

Unfortunately that PR is likely to take a little longer than planned. We're still considering the best way forward. There's also a good chance that that PR won't fix the issue. For now I believe this is the only way.

The flutter_map_dragmarker doesn't seem to be that complex, it seems to just redirect both to the same listener methods. Is there any reason this doesn't work for you?

https://github.com/ibrierley/flutter_map_dragmarker/blob/1e79d6bc9c9f3757d68545b24e15c99323c49ab2/lib/src/drag_marker_widget.dart#L64-L69
https://github.com/ibrierley/flutter_map_dragmarker/blob/1e79d6bc9c9f3757d68545b24e15c99323c49ab2/lib/src/drag_marker_widget.dart#L127-L130

@S-Man42
Copy link
Author

S-Man42 commented May 24, 2024

Hi, I am not quite sure, but you are pointing me to the Dragmarker plugin as at beginning of this thread, right? So please read thr discussion:

  1. I cannot use this plugin out-of-the-box because I need to combine it with the Popup Marker Plugin.
  2. As stated above: It is not quite clear to me, why there is a need for listen to at least four different events, that a not even designed for this purpose, write an own logic, just do calculate the drag data I got directly in one single event until version 3.x. Wouldn't it be much easier and even more correct to simply return the x/y values in the onPanUpdate as you did before instead of require us to write some logic on our own?

@JaffaKetchup
Copy link
Member

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.

@JaffaKetchup JaffaKetchup added feature This issue requests a new feature P: 4 (far future) and removed bug This issue reports broken functionality or another error P: 3 (low) (Default priority for feature requests) labels Aug 8, 2024
@JaffaKetchup JaffaKetchup changed the title [BUG] onPanUpdate event is not called on layer anymore [FEATURE] Revert to using single onPanUpdate to detect pan events Aug 8, 2024
@JaffaKetchup JaffaKetchup removed a link to a pull request Aug 8, 2024
38 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue requests a new feature P: 4 (far future) S: core Scoped to the core flutter_map functionality
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

3 participants