diff --git a/src/Plugin/Source/GoogleMaps/js/googlemaps.js b/src/Plugin/Source/GoogleMaps/js/googlemaps.js index bb391c0..de0e540 100644 --- a/src/Plugin/Source/GoogleMaps/js/googlemaps.js +++ b/src/Plugin/Source/GoogleMaps/js/googlemaps.js @@ -21,8 +21,16 @@ Drupal.openlayers.pluginManager.register({ var center = ol.proj.transform(data.map.getView().getCenter(), 'EPSG:3857', 'EPSG:4326'); gmap.setCenter(new google.maps.LatLng(center[1], center[0])); }); + var mapTypeId = gmap.getMapTypeId(); data.map.getView().on('change:resolution', function() { gmap.setZoom(data.map.getView().getZoom()); + + // If gmap won't zoom in any farther, switch to ROADMAP. + if (gmap.getZoom() < data.map.getView().getZoom()) { + gmap.setMapTypeId(google.maps.MapTypeId.ROADMAP); + } else { + gmap.setMapTypeId(mapTypeId); + } }); data.map.getView().setCenter(data.map.getView().getCenter());