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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user