capacitor-community / google-maps

Capacitor Plugin using native Google Maps SDK for Android and iOS.
https://capacitor-community.github.io/google-maps/
MIT License
152 stars 64 forks source link

Define touch delegation areas #235

Open frederikheld opened 3 months ago

frederikheld commented 3 months ago

Is your feature request related to a problem? Please describe. I see that touch delegation is marked as WIP. I also feel that the plugin has issues with figuring out when to delegate touch (it often takes two consecutive taps to get one tap delegated to the map). I also see that empty divs that overlap the map will prevent touch delegation.

So here's my feature request:

Add an API that allows to delegate taps programmatically. This would allow to set listeners to HTML elements that can be patched through to the map without the need for any advanced magic to figure out if the touch should be delegated or not. This would also allow for more complex overlays.

Example:

Does this feature exist in the Google Maps SDK for android and iOS? Please link the documentation for this feature.

I don't know

Describe the solution you'd like

Be able to define HTMLElements as "delegate touch events to Google Maps layer".

Additional context

Example

Problem: Area with pink border is a container for the controls that won't delegate touch to the Google Map at all, not even in the empty areas. All other parts of the map don't react to taps immediately if the user clicked on one of the WebView components before.

Solutions: Overlay areas that should be delegated to the Google Map with invisible divs (in this example the red, green and blue areas). define those divs as "alway delegate touch events to Google Map".

example