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

Default threshold for the MoveGestureDetector is zero #2792

Open
westnordost opened this issue Aug 31, 2024 · 3 comments
Open

Default threshold for the MoveGestureDetector is zero #2792

westnordost opened this issue Aug 31, 2024 · 3 comments
Labels

Comments

@westnordost
Copy link
Collaborator

Describe the bug
onMoveBegin(detector: MoveGestureDetector) in a MapLibreMap.OnMoveListener is also called when the map is not actually moved but when the user just taps the map.

To Reproduce
Register an MapLibreMap.OnMoveListener and log something on onMoveBegin. Start the app and tap the map. Something will be logged.

Expected behavior
onMoveBegin(detector: MoveGestureDetector) is only called when the map is moved

Platform information (please complete the following information):

  • OS: Android, any API level
  • Version 11.2.0

Additional context
In StreetComplete, there is a follow-me mode. I.e. the map automatically centers on the current user's location. This is turned off when the user moves the map manually but it should not turn off when the user just taps the map.

Cause of this issue: streetcomplete/StreetComplete#5824

@westnordost westnordost added bug Something isn't working android labels Aug 31, 2024
@westnordost
Copy link
Collaborator Author

I noticed that the various *GestureDetectors (shove, move, rotate, scale, ...) each have a field named *threshold which governs the minimum movement necessary for the gesture detector to detect the movement.

By setting a breakpoint during the map initialization, I noticed that those various *GestureDetectors actually do have a minimum default threshold set, although I didn't find where it is set.
It was 43.5px for the shove gesture, 18.9px for the scale gesture, 3° for the rotate gesture but 0px for the move gesture.

So, wherever these defaults are set, the move gesture should also get some minimum threshold.

westnordost added a commit to streetcomplete/StreetComplete that referenced this issue Aug 31, 2024
@westnordost westnordost changed the title MapLibreMap.OnMoveListener::onMoveBegin is also called on tap No default threshold for the MoveGestureDetector Aug 31, 2024
@westnordost westnordost changed the title No default threshold for the MoveGestureDetector Default threshold for the MoveGestureDetector is 0 Aug 31, 2024
@westnordost westnordost changed the title Default threshold for the MoveGestureDetector is 0 Default threshold for the MoveGestureDetector is zero Aug 31, 2024
@louwers
Copy link
Collaborator

louwers commented Sep 3, 2024

@westnordost
Copy link
Collaborator Author

westnordost commented Sep 5, 2024

Not sure, maybe at that point, too.

Reading the code vertically, it looks like the LocationCameraController is only used at all when the LocationComponent is used. But the usage of the location component itself is optional, as far as I know. I.e. one might just as well not have a location component.

@louwers louwers removed the bug Something isn't working label Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants