Update: reduce the dom position information in order to pass it to the native side.
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="cluster-20170822-2333" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="cluster-20170823-0018" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<name>cordova-plugin-googlemaps</name>
<js-module name="BaseClass" src="www/BaseClass.js">
<runs />

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -331,12 +331,15 @@ if (!cordova) {
// If the map div is not displayed (such as display='none'),
// ignore the map temporally.
+ var minMapDepth = 9999999;
mapIDs.forEach(function(mapId) {
var div = MAPS[mapId].getDiv();
if (div) {
var elemId = div.getAttribute("__pluginDomId");
- if (elemId && !(elemId in domPositions)) {
-
+ if (elemId) {
+ if (elemId in domPositions) {
+ minMapDepth = Math.min(minMapDepth, domPositions[elemId].depth);
+ } else {
// Is the map div removed?
if (window.document.querySelector) {
var ele = document.querySelector("[__pluginDomId='" + elemId + "']");
@@ -357,8 +360,46 @@ if (!cordova) {
};
}
}
+ }
+ });
+
+ //-----------------------------------------------------------------
+ // Ignore the elements that their z-index is smaller than map div
+ //-----------------------------------------------------------------
+ var quickfilter = function(list, head, tail) {
+ var i = head, j = tail;
+ var leftRight = true;
+ while(i < j) {
+ if (leftRight) {
+ if (domPositions[list[j]].depth < minMapDepth) {
+ list[i] = list[j];
+ i++;
+ leftRight = false;
+ } else {
+ j--;
+ }
+ } else {
+ if (domPositions[list[i]].depth >= minMapDepth) {
+ list[j] = list[i];
+ j--;
+ leftRight = true;
+ } else {
+ i++;
+ }
+ }
+ }
+ list.splice(0, j);
+ };
+ var list = Object.keys(domPositions);
+ quickfilter(list, 0, list.length - 1);
+ var finalDomPositions = {};
+ list.forEach(function(domId) {
+ finalDomPositions[domId] = domPositions[domId];
});
+ //-----------------------------------------------------------------
+ // Pass information to native
+ //-----------------------------------------------------------------
cordova_exec(function() {
prevDomPositions = domPositions;
mapIDs.forEach(function(mapId) {
@@ -368,7 +409,7 @@ if (!cordova) {
});
setTimeout(putHtmlElements, 50);
isChecking = false;
- }, null, 'CordovaGoogleMaps', 'putHtmlElements', [domPositions]);
+ }, null, 'CordovaGoogleMaps', 'putHtmlElements', [finalDomPositions]);
child = null;
parentNode = null;
elemId = null;

Update: reduce the dom position information in order to pass it to the native side.