p-lr / MapCompose

A fast, memory efficient Jetpack Compose library to display tiled maps, with support for markers, paths, and rotation.
Apache License 2.0
220 stars 19 forks source link

[Feature Request] Zooming by double tapping and sliding #74

Closed TimPushkin closed 2 years ago

TimPushkin commented 2 years ago

Google Maps and other popular map apps have a feature like this (description from Google Maps SDK): "One finger zooming by double tapping but not releasing on the second tap, and then sliding the finger up to zoom out, or down to zoom in". It would be nice to have this gesture available in MapCompose too.

p-lr commented 2 years ago

I could implement it in the one-finger-zoom branch - you can have a look. This isn't just a new gesture support, it has (limited) differences with current gesture detection. In the one-finger-zoom branch, long-press isn't detected anymore after the second tap, and a double-tap can no-longer timeout. Google Maps behaves the same way.

p-lr commented 2 years ago

BTW, there's another gesture which Google Maps supports and MapCompose doesn't (yet): Two finger tap to decrease the zoom level by 1 (zoom out)

TimPushkin commented 2 years ago

Tried in the demo app, seems to work great. Waiting for this to be published!

p-lr commented 2 years ago

I just implemented the two finger tap gesture. I'll make sure there's no corner case regression then publish.

p-lr commented 2 years ago

My testing revealed that my last changes with the two fingers tap had unwanted interactions with other gestures. So I'm reverting my last changes. Maybe one day I'll come back to it and find a better solution. At least I'm keeping the feature you asked for. The next version is 2.2.0 and should be available on maven shortly.

TimPushkin commented 2 years ago

@p-lr Thanks for implementing the feature I asked here!

Don't want to open a separate issue for this yet, but I see this line in 2.2.1 release notes: "Add support for two-fingers tap to zoom out", but I don't see this feature in the demo app. When I tap the screen with two fingers in demos where zoom is available ("Simple map", for example), nothing happens. Am I misunderstanding something?

p-lr commented 2 years ago

It is there, but I've created #76