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.width = '100%';
|
||||||
googleControl.style.height = '100%';
|
googleControl.style.height = '100%';
|
||||||
mapObject.controls[google.maps.ControlPosition.TOP_LEFT].push(googleControl);
|
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
|
// cache elements for use by any other google layers added to
|
||||||
// this same map
|
// this same map
|
||||||
@@ -140,26 +141,13 @@ OpenLayers.Layer.Google.v3 = {
|
|||||||
}
|
}
|
||||||
var container = this.mapObject.getDiv();
|
var container = this.mapObject.getDiv();
|
||||||
if (visible === true) {
|
if (visible === true) {
|
||||||
if (container.parentNode !== map.div) {
|
container.style.display = '';
|
||||||
map.div.appendChild(container);
|
cache.googleControl.appendChild(map.viewPortDiv);
|
||||||
if (!cache.rendered) {
|
google.maps.event.trigger(this.mapObject, 'resize');
|
||||||
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');
|
|
||||||
}
|
|
||||||
this.mapObject.setMapTypeId(type);
|
this.mapObject.setMapTypeId(type);
|
||||||
cache.displayed = this.id;
|
|
||||||
} else {
|
} else {
|
||||||
if (cache.googleControl.hasChildNodes()) {
|
map.div.appendChild(map.viewPortDiv);
|
||||||
map.div.appendChild(map.viewPortDiv);
|
container.style.display = 'none';
|
||||||
map.div.removeChild(container);
|
|
||||||
}
|
|
||||||
delete cache.displayed;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user