Bug fix: Can not control the map with the latest version
Bug fix: removeAttribute("__pluginDomId") breaks cache mechanism
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.0.7-beta-20170908-1807" 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.7-beta-20170911-1120" 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/Common.js
www/Common.js
@@ -308,7 +308,7 @@ function getZIndex(dom) {
return z;
}
-function getDomDepth(dom, idx) {
+function getDomDepth(dom, idx, parentZIndex) {
if (dom.nodeType !== Node.ELEMENT_NODE) {
return 0;
}
@@ -322,7 +322,7 @@ function getDomDepth(dom, idx) {
}
*/
//var result = ((zIndex + 1) << (depth + 1)) + idx;
- var result = Math.floor(((zIndex + 1) / (idx + 1) + idx) * 1000);
+ var result = (parentZIndex + zIndex) * 10000 + idx;
orgDom.setAttribute("_depth", result); // for debugging
return result;
}

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -150,7 +150,7 @@ if (!cordova) {
visibleMapList.push(mapId);
}
}
- if (idlingCnt > -1 && visibleMapList.length === 0) {
+ if (idlingCnt > -1 && visibleMapList.length === 0 && Object.keys(MAPS).length === 0) {
idlingCnt++;
if (!isSuspended) {
cordova_exec(null, null, 'CordovaGoogleMaps', 'pause', []);
@@ -174,7 +174,8 @@ if (!cordova) {
var shouldUpdate = false;
var doNotTrace = false;
- var traceDomTree = function(element, domIdx, parentRect) {
+ var traceDomTree = function(element, domIdx, parentRect, parentZIndex) {
+ var zIndex = parentZIndex;
doNotTrace = false;
if (common.shouldWatchByNative(element)) {
@@ -188,13 +189,13 @@ if (!cordova) {
// get dom depth
var depth;
- var zIndex = common.getZIndex(element);
+ zIndex = common.getZIndex(element);
if (elemId in cacheDepth &&
elemId in prevDomPositions &&
prevDomPositions[elemId].zIndex === zIndex) {
depth = cacheDepth[elemId];
} else {
- depth = common.getDomDepth(element, domIdx);
+ depth = common.getDomDepth(element, domIdx, parentZIndex);
cacheDepth[elemId] = depth;
}
@@ -265,10 +266,10 @@ if (!cordova) {
}
} else {
if (element.nodeType === Node.ELEMENT_NODE) {
- if (element.hasAttribute("__pluginDomId")) {
- shouldUpdate = true;
- element.removeAttribute("__pluginDomId");
- }
+ //if (element.hasAttribute("__pluginDomId")) {
+ // shouldUpdate = true;
+ // element.removeAttribute("__pluginDomId");
+ //}
if (doNotTraceTags.indexOf(element.tagName.toLowerCase()) > -1) {
doNotTrace = true;
}
@@ -286,7 +287,7 @@ if (!cordova) {
common.getStyle(child, "display") === "none") {
continue;
}
- traceDomTree(child, domIdx + i + 1, parentRect);
+ traceDomTree(child, domIdx + i + 1, parentRect, zIndex);
}
}
}
@@ -295,7 +296,7 @@ if (!cordova) {
bodyRect.right = bodyRect.left + bodyRect.width;
bodyRect.bottom = bodyRect.top + bodyRect.heihgt;
- traceDomTree(document.body, 0, bodyRect);
+ traceDomTree(document.body, 0, bodyRect, 0);
// If some elements has been removed, should update the positions
var elementCnt = Object.keys(domPositions).length;
@@ -478,6 +479,7 @@ if (!cordova) {
//--------------------------------------------
var anotherBackbuttonHandler = null;
function onBackButton() {
+ console.log("---->backbutton");
cordova.fireDocumentEvent('plugin_touch', {});
if (anotherBackbuttonHandler) {
anotherBackbuttonHandler();

Bug fix: Can not control the map with the latest version #1727
Bug fix: removeAttribute("__pluginDomId") breaks cache mechanism