(JS) Bug fix: idingCnt does not stop if there is/are element(s) that has/have the `pointer-events:none` style
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.1.2-beta-20171102-1112" 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.1.2-beta-20171102-1303" 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
@@ -255,6 +255,7 @@ function shouldWatchByNative(node) {
var visibilityCSS = getStyle(node, 'visibility');
var displayCSS = getStyle(node, 'display');
var opacityCSS = getStyle(node, 'opacity');
+ var pointerEventsCSS = getStyle(node, 'pointer-events');
opacityCSS = /^[\d.]+$/.test(opacityCSS + "") ? opacityCSS : 1;
var clickableSize = (
node.offsetHeight > 0 && node.offsetWidth > 0 ||
@@ -263,7 +264,7 @@ function shouldWatchByNative(node) {
node.className.indexOf("_gmaps_cdv_") > -1);
return displayCSS !== "none" &&
opacityCSS > 0 && visibilityCSS !== "hidden" &&
- clickableSize;
+ clickableSize && pointerEventsCSS !== "none";
}

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -221,11 +221,12 @@ if (!cordova) {
var zIndex = parentZIndex;
doNotTrace = false;
var depth = 1;
+ var elemId;
if (common.shouldWatchByNative(element)) {
// Generates a __pluginDomId
- var elemId = element.getAttribute("__pluginDomId");
+ elemId = element.getAttribute("__pluginDomId");
if (!elemId) {
elemId = "pgm" + Math.floor(Math.random() * Date.now());
element.setAttribute("__pluginDomId", elemId);
@@ -250,20 +251,7 @@ if (!cordova) {
}
// Calculate dom clickable region
- var pointerEventsCSS = common.getStyle(element, 'pointer-events');
- var rect = {};
- if (pointerEventsCSS === 'none') {
- rect = {
- left: 0,
- right: 0,
- top: 0,
- bottom: 0,
- overflowX_hidden: true,
- overflowY_hidden: true,
- elemId: elemId
- };
- } else {
- rect = common.getDivRect(element);
+ var rect = common.getDivRect(element);
rect.right = rect.left + rect.width;
rect.bottom = rect.top + rect.height;
rect.overflowX_hidden = common.getStyle(element, "overflow-x") === "hidden";
@@ -313,7 +301,6 @@ if (!cordova) {
};
parentRect = rect;
parentRect.elemId = elemId;
- }
if (!shouldUpdate) {
if (elemId in prevDomPositions) {
@@ -336,6 +323,35 @@ if (!cordova) {
//}
if (doNotTraceTags.indexOf(element.tagName.toLowerCase()) > -1) {
doNotTrace = true;
+ } else {
+ var pointerEventsCSS = common.getStyle(element, 'pointer-events');
+ if (pointerEventsCSS === "none") {
+
+ // Generates a __pluginDomId
+ elemId = element.getAttribute("__pluginDomId");
+ if (!elemId) {
+ elemId = "pgm" + Math.floor(Math.random() * Date.now());
+ element.setAttribute("__pluginDomId", elemId);
+ if (common.getStyle(element, "-webkit-overflow-scrolling") === "touch") {
+ element.addEventListener("touchstart", onTouchStart);
+ element.addEventListener("touchmove", followMapDivPositionOnly);
+ element.addEventListener("touchend", onTouchEnd);
+ element.addEventListener("touchcancel", onTouchEnd);
+ element.addEventListener("touchleave", onTouchEnd);
+ }
+ }
+
+ // get dom depth
+ zIndex = common.getZIndex(element);
+ if (elemId in cacheDepth &&
+ elemId in prevDomPositions &&
+ prevDomPositions[elemId].zIndex === zIndex) {
+ depth = cacheDepth[elemId];
+ } else {
+ depth = common.getDomDepth(element, domIdx, parentDepth, floorLevel);
+ cacheDepth[elemId] = depth;
+ }
+ }
}
} else {
doNotTrace = true;
@@ -369,7 +385,6 @@ if (!cordova) {
if (elementCnt !== prevElementCnt) {
shouldUpdate = true;
}
-
if (!shouldUpdate && idlingCnt > -1) {
idlingCnt++;
if (idlingCnt === 2) {

(JS) Bug fix: idingCnt does not stop if there is/are element(s) that has/have the `pointer-events:none` style