map.setDiv(...) does not work well on iOS simulator
MODIFY
plugin.xml
plugin.xml
<?xml version='1.0' encoding='utf-8'?>
-<plugin id="cordova-plugin-googlemaps" version="2.1.0-beta-20170921-1843" 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.0-beta-20170925-1216" 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/ios/GoogleMaps/MyPluginLayer.m
src/ios/GoogleMaps/MyPluginLayer.m
@@ -153,7 +153,7 @@ BOOL hasCordovaStatusBar = NO; // YES if the app has cordova-plugin-statusbar
// Add the mapView under the scroll view.
[self.pluginScrollView attachView:mapCtrl.view];
- //[self updateViewPosition:mapCtrl];
+ [self updateViewPosition:mapCtrl];
});
}

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -120,6 +120,7 @@ if (!cordova) {
var longIdlingCnt = -1;
var isChecking = false;
+ var pauseResizeTimer = false;
var cacheDepth = {};
document.head.appendChild(navDecorBlocker);
var doNotTraceTags = [
@@ -362,7 +363,8 @@ if (!cordova) {
MAPS[mapId].refreshLayout();
});
}
- if (idlingCnt > 2) {
+ if (idlingCnt > 2 && !pauseResizeTimer) {
+ pauseResizeTimer = true;
cordova_exec(null, null, 'CordovaGoogleMaps', 'pauseResizeTimer', []);
}
// Stop timer when user does not touch the app and no changes are occurred during 1500ms.
@@ -417,6 +419,10 @@ if (!cordova) {
//-----------------------------------------------------------------
// Ignore the elements that their z-index is smaller than map div
//-----------------------------------------------------------------
+ var finalDomPositions;
+ if (visibleMapList.length === 0) {
+ finalDomPositions = domPositions;
+ } else {
var quickfilter = function(list, head, tail) {
var i = head, j = tail;
var leftRight = true;
@@ -443,11 +449,11 @@ if (!cordova) {
};
var list = Object.keys(domPositions);
quickfilter(list, 0, list.length - 1);
- var finalDomPositions = {};
+ finalDomPositions = {};
list.forEach(function(domId) {
finalDomPositions[domId] = domPositions[domId];
});
-
+ }
//-----------------------------------------------------------------
// Pass information to native
//-----------------------------------------------------------------
@@ -474,6 +480,7 @@ if (!cordova) {
longIdlingCnt = -1;
cacheDepth = {};
cacheZIndex = {};
+ pauseResizeTimer = false;
cordova_exec(null, null, 'CordovaGoogleMaps', 'resumeResizeTimer', []);
putHtmlElements();
}
@@ -496,7 +503,10 @@ if (!cordova) {
putHtmlElements();
} else {
clearInterval(intervalTimer);
+ if (!pauseResizeTimer) {
+ pauseResizeTimer = true;
cordova_exec(null, null, 'CordovaGoogleMaps', 'pauseResizeTimer', []);
+ }
intervalTimer = null;
}
}

map.setDiv(...) does not work well on iOS simulator #1768