Add: apply background color during map is creating
MODIFY
www/Map.js
www/Map.js
@@ -149,6 +149,18 @@ Map.prototype.getMap = function(mapId, div, options) {
}
args.push(elemId);
+ }
+
+ cordova.fireDocumentEvent('plugin_touch', {});
+
+ exec(function() {
+ cordova.fireDocumentEvent('plugin_touch', {});
+
+ //------------------------------------------------------------------------
+ // Clear background colors of map div parents after the map is created
+ //------------------------------------------------------------------------
+ var div = self.get("div");
+ if (common.isDom(div)) {
while (div.parentNode) {
div.style.backgroundColor = 'rgba(0,0,0,0)';
@@ -162,12 +174,9 @@ Map.prototype.getMap = function(mapId, div, options) {
div = div.parentNode;
}
}
-
- cordova.fireDocumentEvent('plugin_touch', {});
-
- exec(function() {
- cordova.fireDocumentEvent('plugin_touch', {});
+ //------------------------------------------------------------------------
// In order to work map.getVisibleRegion() correctly, wait a little.
+ //------------------------------------------------------------------------
setTimeout(function() {
self.refreshLayout();
self.trigger(event.MAP_READY, self);

MODIFY
www/googlemaps-cdv-plugin.js
www/googlemaps-cdv-plugin.js
@@ -486,6 +486,10 @@ module.exports = {
var mapId;
if (common.isDom(div)) {
mapId = div.getAttribute("__pluginMapId");
+ if (!mapOptions || mapOptions.visible !== false) {
+ // Add gray color until the map is displayed.
+ div.style.backgroundColor = "rgba(255, 30, 30, 0.5);";
+ }
}
if (mapId in MAPS) {
//--------------------------------------------------

Add: apply background color during map is creating