diff --git a/examples/draggingGoogle.html b/examples/draggingGoogle.html
new file mode 100755
index 0000000000..c4721721f9
--- /dev/null
+++ b/examples/draggingGoogle.html
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+ OpenLayers With Responsive Google Dragging
+ Uses Google Maps v2.82
+
+
+
diff --git a/lib/OpenLayers/Layer/EventPane.js b/lib/OpenLayers/Layer/EventPane.js
index 3c8a75cd07..02464556d6 100644
--- a/lib/OpenLayers/Layer/EventPane.js
+++ b/lib/OpenLayers/Layer/EventPane.js
@@ -225,8 +225,16 @@ OpenLayers.Layer.EventPane = OpenLayers.Class(OpenLayers.Layer, {
!(newZoom == oldZoom) ) {
var center = this.getMapObjectLonLatFromOLLonLat(newCenter);
- var zoom = this.getMapObjectZoomFromOLZoom(newZoom);
- this.setMapObjectCenter(center, zoom);
+
+ if (dragging && this.dragPanMapObject) {
+ var res = this.map.resolution; //readability
+ var dX = (newCenter.lon - oldCenter.lon) / res;
+ var dY = (newCenter.lat - oldCenter.lat) / res;
+ this.dragPanMapObject(dX, dY);
+ } else {
+ var zoom = this.getMapObjectZoomFromOLZoom(newZoom);
+ this.setMapObjectCenter(center, zoom, dragging);
+ }
}
}
}
diff --git a/lib/OpenLayers/Layer/Google.js b/lib/OpenLayers/Layer/Google.js
index 9d247cb401..92e652ed2b 100644
--- a/lib/OpenLayers/Layer/Google.js
+++ b/lib/OpenLayers/Layer/Google.js
@@ -119,6 +119,13 @@ OpenLayers.Layer.Google = OpenLayers.Class(
termsOfUse.style.right = "";
termsOfUse.style.bottom = "";
+ //can we do smooth panning? (some versions don't)
+ if ( !this.mapObject.G || !this.mapObject.G.qb ||
+ (typeof this.mapObject.G.qb != "function") ) {
+
+ this.dragPanMapObject = null;
+ }
+
} catch (e) {
// do not crash
}
@@ -334,6 +341,19 @@ OpenLayers.Layer.Google = OpenLayers.Class(
this.mapObject.setCenter(center, zoom);
},
+ /**
+ * APIMethod: dragPanMapObject
+ *
+ * Parameters:
+ * dX - {Integer}
+ * dY - {Integer}
+ */
+ dragPanMapObject: function(dX, dY) {
+ var newX = this.mapObject.G.left - dX;
+ var newY = this.mapObject.G.top + dY;
+ this.mapObject.G.qb(newX, newY);
+ },
+
/**
* APIMethod: getMapObjectCenter
*