Patch from (but not everything)
MODIFY
src/android/plugin/google/maps/MyPlugin.java
src/android/plugin/google/maps/MyPlugin.java
@@ -24,14 +24,14 @@ import org.json.JSONException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class MyPlugin extends CordovaPlugin implements MyPluginInterface {
- protected HashMap<String, Object> objects;
+ protected ConcurrentHashMap<String, Object> objects;
public MyPlugin self = null;
- public final HashMap<String, Method> methods = new HashMap<String, Method>();
+ public final ConcurrentHashMap<String, Method> methods = new ConcurrentHashMap<String, Method>();
private static ExecutorService executorService = null;
public CordovaGoogleMaps mapCtrl = null;
@@ -52,7 +52,7 @@ public class MyPlugin extends CordovaPlugin implements MyPluginInterface {
@Override
public void initialize(CordovaInterface cordova, final CordovaWebView webView) {
super.initialize(cordova, webView);
- this.objects = new HashMap<String, Object>();
+ this.objects = new ConcurrentHashMap<String, Object>();
TAG = this.getServiceName();
if (executorService == null) {
executorService = Executors.newFixedThreadPool(5);

MODIFY
src/android/plugin/google/maps/PluginMap.java
src/android/plugin/google/maps/PluginMap.java
@@ -77,7 +77,7 @@ import java.util.Set;
public class PluginMap extends MyPlugin implements OnMarkerClickListener,
OnInfoWindowClickListener, OnMapClickListener, OnMapLongClickListener,
- OnMarkerDragListener,
+ OnMarkerDragListener, GoogleMap.OnMapLoadedCallback,
OnMyLocationButtonClickListener, OnIndoorStateChangeListener, InfoWindowAdapter,
GoogleMap.OnCameraIdleListener, GoogleMap.OnCameraMoveCanceledListener,
GoogleMap.OnCameraMoveListener, GoogleMap.OnCameraMoveStartedListener,
@@ -297,6 +297,7 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
map.setOnMarkerClickListener(PluginMap.this);
map.setOnMarkerDragListener(PluginMap.this);
map.setOnMyLocationButtonClickListener(PluginMap.this);
+ map.setOnMapLoadedCallback(PluginMap.this);
map.setOnIndoorStateChangeListener(PluginMap.this);
map.setOnInfoWindowClickListener(PluginMap.this);
map.setOnInfoWindowLongClickListener(PluginMap.this);
@@ -431,7 +432,7 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
//-----------------------------------
// Create the instance of class
//-----------------------------------
- public void loadPlugin(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
+ public synchronized void loadPlugin(final JSONArray args, final CallbackContext callbackContext) throws JSONException {
final String serviceName = args.getString(0);
final String pluginName = mapId + "-" + serviceName.toLowerCase();
//Log.d("PluginMap", "serviceName = " + serviceName + ", pluginName = " + pluginName);
@@ -648,6 +649,7 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
map.setOnMapLongClickListener(null);
map.setOnMarkerClickListener(null);
map.setOnMyLocationButtonClickListener(null);
+ map.setOnMapLoadedCallback(null);
map.setOnMarkerDragListener(null);
} catch (SecurityException e) {
e.printStackTrace();
@@ -2007,6 +2009,11 @@ public class PluginMap extends MyPlugin implements OnMarkerClickListener,
activeMarker = null;
}
+ @Override
+ public void onMapLoaded() {
+ this.onMapEvent("map_loaded");
+ }
+
/********************************************************

MODIFY
src/android/plugin/google/maps/PluginPolygon.java
src/android/plugin/google/maps/PluginPolygon.java
@@ -144,8 +144,10 @@ public class PluginPolygon extends MyPlugin implements MyPluginInterface {
if (objects.containsKey(objectId)) {
if (objectId.contains("property")) {
Polygon polygon = (Polygon) objects.remove(objectId.replace("property_", ""));
+ if (polygon != null) {
polygon.remove();
}
+ }
Object object = objects.remove(objectId);
object = null;

MODIFY
src/ios/GoogleMaps/GoogleMapsViewController.m
src/ios/GoogleMaps/GoogleMapsViewController.m
}
*/
+/**
+ * Map tiles are loaded
+ */
+- (void) mapViewDidFinishTileRendering:(GMSMapView *)mapView {
+ [self triggerMapEvent:@"map_loaded"];
+}
+
/**
* plugin.google.maps.event.MAP_***()) events
*/

MODIFY
www/Common.js
www/Common.js
@@ -301,7 +301,7 @@ function getDomDepth(dom, idx) {
//}
//orgDom.setAttribute("_depth", depth + "_" + zIndex + "_" + idx);
- var result = idx * 1000 + parseInt(zIndex, 10) + depth;
+ var result = parseInt(zIndex, 10) * 100000 + depth * 1000 + idx;
orgDom.setAttribute("_result", result);
return result;
}
@@ -530,6 +530,7 @@ function convertToPositionArray(array) {
}
module.exports = {
+ getZIndex: getZIndex,
getDomDepth: getDomDepth,
deleteFromObject: deleteFromObject,
getDivRect: getDivRect,

MODIFY
www/event.js
www/event.js
module.exports = {
MAP_READY: 'map_ready',
+ MAP_LOADED: 'map_loaded',
MAP_CLICK: 'map_click',
MAP_LONG_CLICK: 'map_long_click',
MY_LOCATION_BUTTON_CLICK: 'my_location_button_click',

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -121,7 +121,10 @@ var saltHash = Math.floor(Math.random() * Date.now());
}
//domPositions[elemId] = common.getDomInfo(child);
var depth = cacheDepth[elemId];
- if (elemId in cacheDepth) {
+ var zIndex = common.getZIndex(child);
+ if (elemId in cacheDepth &&
+ elemId in prevDomPositions &&
+ prevDomPositions[elemId].zIndex === zIndex) {
depth = cacheDepth[elemId];
} else {
depth = common.getDomDepth(child, i);
@@ -129,14 +132,16 @@ var saltHash = Math.floor(Math.random() * Date.now());
}
domPositions[elemId] = {
size: common.getDivRect(child),
- depth: depth
+ depth: depth,
+ zIndex: zIndex
};
if (!shouldUpdate) {
if (elemId in prevDomPositions) {
if (domPositions[elemId].size.left !== prevDomPositions[elemId].size.left ||
domPositions[elemId].size.top !== prevDomPositions[elemId].size.top ||
domPositions[elemId].size.width !== prevDomPositions[elemId].size.width ||
- domPositions[elemId].size.height !== prevDomPositions[elemId].size.height) {
+ domPositions[elemId].size.height !== prevDomPositions[elemId].size.height ||
+ domPositions[elemId].depth !== prevDomPositions[elemId].depth) {
shouldUpdate = true;
}
} else {

Patch from https://github.com/thyde1/cordova-plugin-googlemaps/commit/17aa762fae41f8e6c059770fb127edcb55b22844 (but not everything)