Bug fix: The domDepth calculation is incorrect
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.0.0-beta2-20170623-1421" xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android">
+<plugin id="cordova-plugin-googlemaps" version="2.0.0-beta2-20170623-1615" 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
src/android/plugin/google/maps/MyPluginLayout.java
src/android/plugin/google/maps/MyPluginLayout.java
@@ -512,7 +512,7 @@ public class MyPluginLayout extends FrameLayout implements ViewTreeObserver.OnSc
String domIDs[] = HTMLNodes.keySet().toArray(new String[HTMLNodes.size()]);
Bundle domInfo = HTMLNodes.get(pluginMap.mapDivId);
RectF htmlElementRect;
- long mapDivDepth = domInfo.getLong("depth");
+ int mapDivDepth = domInfo.getInt("depth");
for (String domId : domIDs) {
if (pluginMap.mapDivId.equals(domId)) {
@@ -525,7 +525,7 @@ public class MyPluginLayout extends FrameLayout implements ViewTreeObserver.OnSc
if (domInfo == null) {
continue;
}
- if (domInfo.getLong("depth") <= mapDivDepth) {
+ if (domInfo.getInt("depth") <= mapDivDepth) {
continue;
}

MODIFY
src/ios/GoogleMaps/MyPluginLayer.m
src/ios/GoogleMaps/MyPluginLayer.m
@@ -286,7 +286,7 @@ BOOL hasCordovaStatusBar = NO; // YES if the app has cordova-plugin-statusbar
webviewHeight *= zoomScale;
NSDictionary *domInfo, *mapDivInfo;
- long domDepth, mapDivDepth;
+ int domDepth, mapDivDepth;
if (hasCordovaStatusBar) {
UIApplication* app = [UIApplication sharedApplication];
if (app.isStatusBarHidden) {
@@ -338,14 +338,14 @@ BOOL hasCordovaStatusBar = NO; // YES if the app has cordova-plugin-statusbar
// Is the clicked point is on the html elements in the map?
mapDivInfo = [self.pluginScrollView.debugView.HTMLNodes objectForKey:mapCtrl.mapDivId];
- mapDivDepth = [[mapDivInfo objectForKey:@"depth"] longValue];
+ mapDivDepth = [[mapDivInfo objectForKey:@"depth"] intValue];
for (NSString *domId in self.pluginScrollView.debugView.HTMLNodes) {
if ([mapCtrl.mapDivId isEqualToString:domId]) {
continue;
}
domInfo = [self.pluginScrollView.debugView.HTMLNodes objectForKey:domId];
- domDepth = [[domInfo objectForKey:@"depth"] longValue];
+ domDepth = [[domInfo objectForKey:@"depth"] intValue];
if (domDepth < mapDivDepth) {
continue;
}

MODIFY
www/Common.js
www/Common.js
@@ -321,15 +321,15 @@ function getDomDepth(dom, idx) {
return 0;
}
var orgDom = dom;
- var depth = 0;
var zIndex = getZIndex(dom);
+ /*
+ var depth = 0;
while (dom.parentNode !== null && dom.parentNode != document) {
dom = dom.parentNode;
depth++;
}
- var zIdx = (parseInt(zIndex, 10) + 1) * 1000000;
- var idxS = idx * 1000;
- var result = zIdx + idxS + depth;
+ */
+ var result = (zIndex + 1) * 1000 + idx;
orgDom.setAttribute("_depth", result); // for debugging
return result;
}

Bug fix: The domDepth calculation is incorrect