giving Layer.Google.v3 an animationEnabled option, like the one we already have for Layer.VirtualEarth. r=bartvde (closes #3020)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11047 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-01-20 13:31:30 +00:00
parent 3913ef1787
commit 3a16592b1a
3 changed files with 34 additions and 0 deletions

View File

@@ -51,6 +51,19 @@ OpenLayers.Layer.Google.v3 = {
projection: "EPSG:900913"
},
/**
* APIProperty: animationEnabled
* {Boolean} If set to true, the transition between zoom levels will be
* animated (if supported by the GMaps API for the device used). Set to
* false to match the zooming experience of other layer types. Default
* is true. Note that the GMaps API does not give us control over zoom
* animation, so if set to false, when zooming, this will make the
* layer temporarily invisible, wait until GMaps reports the map being
* idle, and make it visible again. The result will be a blank layer
* for a few moments while zooming.
*/
animationEnabled: true,
/**
* Method: loadMapObject
* Load the GMap and register appropriate event listeners. If we can't
@@ -340,6 +353,17 @@ OpenLayers.Layer.Google.v3 = {
* zoom - {int} MapObject zoom format
*/
setMapObjectCenter: function(center, zoom) {
if (this.animationEnabled === false && zoom != this.mapObject.zoom) {
var mapContainer = this.getMapContainer();
google.maps.event.addListenerOnce(
this.mapObject,
"idle",
function() {
mapContainer.style.visibility = "";
}
);
mapContainer.style.visibility = "hidden";
}
this.mapObject.setOptions({
center: center,
zoom: zoom