capacitor-community / capacitor-community/google-maps

feat(map): allow map instances to be rendered on top of webview

Open
#161 5 comments 3 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
161
Forks
65
PR merge metrics
No merged PRs in 30d

Description

Right now, the plugin deliberately renders map instances **below** the webview. This allows for overlaying the map with anything that's in the webview. This way it is possible to customize the map with custom-made HTMLElements like a "to my location"-button for example. Also this allows for use-cases, where you can show full-fledged HTMLElements - like cards - on top of the map, when you click a marker for example.

As can be read in the [Should you use this plugin?](https://capacitor-community.github.io/google-maps/#/about/should-you-use-this-plugin?id=should-you-use-this-plugin) section of the documentation, the main use-case of this plugin is for apps which main focus is the map:

> If your app revolves mainly around a Map, like for example Uber or Lime, this plugin is probably a good fit for your concept.

However, this approach actually makes it more difficult for developers with "simple" use-cases to implement this plugin. For example in issue https://github.com/capacitor-community/google-maps/issues/154, a developer mentioned he'd like to use this plugin in a modal. As said before, those type of use-cases are not the main focus of this plugin.

Right now a developer would need to make every element (including the modal) transparent to make the map visible. This can be sub-optimal in certain scenarios. Especially when utilizing a modal.

We'd like to add a feature that makes it easier to utilize this plugin in similar scenarios. We will be doing that by adding a `renderOnTopOfWebView` (or something similarly named) parameter to the `createMap` method. When this parameter is set to `true`, the map instance will (as its named suggests) on top of the webview, instead of behind it. That way it is not needed anymore to make all kinds of HTMLElement transparent.

Of course this has the drawback that all advantages that come with rendering **behind** the webview, are not applicable for that specific map instance. So we will need to document this option clearly, so that a developer can make a rational decision between the two types of rendering.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.