MapCompose icon indicating copy to clipboard operation
MapCompose copied to clipboard

Expose onDoubleTap callback function

Open mkmckenna opened this issue 5 months ago • 4 comments

Hi Pierre,

I would like to expose a callback function for onDoubleTap gestures. In my use case, I would prefer if MapCompose could be configured to zoom to the maximum zoom scale when there is a double tap. With an onDoubleTap callback function, we will be able to achieve this.

Does this sound ok? I will submit a PR if so.

Thank you for your efforts with MapCompose

mkmckenna avatar Jun 24 '26 20:06 mkmckenna

Hi Martin,

On double-tap, the library doubles the current scale using an animation. So, exposing a callback isn't enough. If you e.g snap the scale to the max scale on double-tap, the animation will produce an undesired behavior. So this requires a new api. I'll have a look when I have time.

p-lr avatar Jun 25 '26 07:06 p-lr

Hi Pierre,

Thanks for your quick response.

I've tested a proposed implementation and used this within the SImpleDemoVM example, which seems to work.

It's quite possible I'm overlooking something, as I'm not completely familiar with MapCompose yet. I've mainly used TileView in the past.

I'll open a PR for you to review.

mkmckenna avatar Jun 25 '26 08:06 mkmckenna

I've done something very similar to your initial implementation. Mainly, with the withDefaultBehavior flag and avoid a double computation (probably overkill). It's available in the branch fix-#149. Could you please confirm it's good for you?

p-lr avatar Jun 26 '26 05:06 p-lr

Thanks. I've had a look at the branch and that looks exactly like what I'm after. I'll integrate this later today.

mkmckenna avatar Jun 26 '26 12:06 mkmckenna