Smooth GDragging at last. Thanks to overstdr for digging up the getDragObject method. With v2.93 and later we no longer get flickers on panning. Non-API smooth dragging is no longer supported. r=crschmidt,me (closes #1402)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@6492 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -75,6 +75,13 @@ OpenLayers.Layer.Google = OpenLayers.Class(
|
||||
* other maps, etc.
|
||||
*/
|
||||
sphericalMercator: false,
|
||||
|
||||
/**
|
||||
* Property: dragObject
|
||||
* {GDraggableObject} Since 2.93, Google has exposed the ability to get
|
||||
* the maps GDraggableObject. We can now use this for smooth panning
|
||||
*/
|
||||
dragObject: null,
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Layer.Google
|
||||
@@ -106,6 +113,14 @@ OpenLayers.Layer.Google = OpenLayers.Class(
|
||||
try {
|
||||
// create GMap, hide nav controls
|
||||
this.mapObject = new GMap2( this.div );
|
||||
|
||||
//since v 2.93 getDragObject is now available.
|
||||
if(typeof this.mapObject.getDragObject == "function") {
|
||||
this.dragObject = this.mapObject.getDragObject();
|
||||
} else {
|
||||
this.dragPanMapObject = null;
|
||||
}
|
||||
|
||||
|
||||
// move the ToS and branding stuff up to the pane
|
||||
// thanks a *mil* Erik for thinking of this
|
||||
@@ -123,15 +138,8 @@ 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
|
||||
OpenLayers.Console.error(e);
|
||||
}
|
||||
|
||||
},
|
||||
@@ -343,11 +351,9 @@ OpenLayers.Layer.Google = OpenLayers.Class(
|
||||
* 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);
|
||||
this.dragObject.moveBy(new GSize(-dX, dY));
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* APIMethod: getMapObjectCenter
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user