Merge pull request #925 from ahocevar/google-container
Google Maps rendering bug on fresh reload. r=@kevbradwick (fix #925)
This commit is contained in:
@@ -92,6 +92,7 @@ OpenLayers.Layer.Google.v3 = {
|
||||
googleControl.style.width = '100%';
|
||||
googleControl.style.height = '100%';
|
||||
mapObject.controls[google.maps.ControlPosition.TOP_LEFT].push(googleControl);
|
||||
this.map.div.appendChild(container);
|
||||
|
||||
// cache elements for use by any other google layers added to
|
||||
// this same map
|
||||
@@ -140,26 +141,13 @@ OpenLayers.Layer.Google.v3 = {
|
||||
}
|
||||
var container = this.mapObject.getDiv();
|
||||
if (visible === true) {
|
||||
if (container.parentNode !== map.div) {
|
||||
map.div.appendChild(container);
|
||||
if (!cache.rendered) {
|
||||
google.maps.event.addListenerOnce(this.mapObject, 'tilesloaded', function() {
|
||||
cache.googleControl.appendChild(map.viewPortDiv);
|
||||
cache.rendered = true;
|
||||
});
|
||||
} else {
|
||||
cache.googleControl.appendChild(map.viewPortDiv);
|
||||
}
|
||||
google.maps.event.trigger(this.mapObject, 'resize');
|
||||
}
|
||||
container.style.display = '';
|
||||
cache.googleControl.appendChild(map.viewPortDiv);
|
||||
google.maps.event.trigger(this.mapObject, 'resize');
|
||||
this.mapObject.setMapTypeId(type);
|
||||
cache.displayed = this.id;
|
||||
} else {
|
||||
if (cache.googleControl.hasChildNodes()) {
|
||||
map.div.appendChild(map.viewPortDiv);
|
||||
map.div.removeChild(container);
|
||||
}
|
||||
delete cache.displayed;
|
||||
map.div.appendChild(map.viewPortDiv);
|
||||
container.style.display = 'none';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user