Bump up the version 2.0.0-beta3-20170807-1700
Bug fix: the calculation of clickable region is incorrect if the map div overflows the parent dimension
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.0.0-beta3-20170807-1015" 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-beta3-20170807-1700" 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
@@ -206,20 +206,11 @@ function getDivRect(div) {
}
var rect;
if (div === document.body) {
- var positionCSS = getStyle(document.body, "position");
- if (["relative", "sticky"].indexOf(positionCSS) === -1) {
- /*
- * ionic v1 sets the body.left = 0; .right=0; .width=0; .height=0
- */
- return {
- left: window.pageOffsetX || 0,
- top: window.pageOffsetY || 0,
- width: window.innerWidth,
- height: window.innerHeight
- };
- } else {
rect = div.getBoundingClientRect();
- }
+ rect.left = Math.max(rect.left, window.pageOffsetX);
+ rect.top = Math.max(rect.top, window.pageOffsetY);
+ rect.width = Math.max(rect.width, window.innerWidth);
+ rect.height = Math.max(rect.height, window.innerHeight);
} else {
rect = div.getBoundingClientRect();
}

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -30,8 +30,6 @@ var Geocoder = require('./Geocoder');
var ExternalService = require('./ExternalService');
var Environment = require('./Environment');
var MapTypeId = require('./MapTypeId');
-var MarkerCluster = require('./MarkerCluster');
-var geomodel = require('./geomodel');
var INTERVAL_TIMER = null;
var MAPS = {};
@@ -182,12 +180,50 @@ document.head.appendChild(navDecorBlocker);
cacheDepth[elemId] = depth;
}
- // Stores dom bounds and depth
+
+ // Calculate dom clickable region
var rect = common.getDivRect(element);
- rect.left = Math.max(rect.left, parentRect.left);
- rect.top = Math.min(rect.top, parentRect.top);
- rect.width = Math.min(rect.width, parentRect.width);
- rect.height = Math.min(rect.height, parentRect.height);
+ rect.right = rect.left + rect.width;
+ rect.bottom = rect.top + rect.height;
+ if (rect.left !== parentRect.left || rect.width !== parentRect.width) {
+ if (rect.left < parentRect.left) {
+ if (rect.right > parentRect.right) {
+ rect.width = parentRect.width;
+ rect.left = parentRect.left;
+ } else {
+ rect.width = rect.width + rect.left - parentRect.left;
+ rect.left = parentRect.left;
+ }
+ } else if (rect.right > parentRect.right) {
+ if (rect.left > parentRect.left) {
+ rect.width = rect.width + parentRect.right - rect.right;
+ } else {
+ rect.width = parentRect.width;
+ }
+ }
+ rect.right = rect.left + rect.width;
+ }
+
+ if (rect.top !== parentRect.top || rect.height !== parentRect.height) {
+ if (rect.top < parentRect.top) {
+ if (rect.bottom > parentRect.bottom) {
+ rect.height = parentRect.height;
+ rect.top = parentRect.top;
+ } else {
+ rect.height = rect.height + rect.top - parentRect.top;
+ rect.top = parentRect.top;
+ }
+ } else if (rect.bottom > parentRect.bottom) {
+ if (rect.top > parentRect.top) {
+ rect.height = rect.height + parentRect.bottom - rect.bottom;
+ } else {
+ rect.height = parentRect.height;
+ }
+ }
+ rect.bottom = rect.top + rect.height;
+ }
+
+ // Stores dom bounds and depth
domPositions[elemId] = {
size: rect,
depth: depth,
@@ -580,7 +616,6 @@ module.exports = {
external: ExternalService,
environment: Environment,
Geocoder: Geocoder,
- MarkerCluster: MarkerCluster,
geometry: {
encoding: encoding,
spherical: spherical

Bump up the version 2.0.0-beta3-20170807-1700
- Bug fix: the calculation of clickable region is incorrect if the map div overflows the parent dimension