From 9acb997b200faa126334e79cd9fb0504b6f101e5 Mon Sep 17 00:00:00 2001 From: crschmidt Date: Wed, 21 Nov 2007 08:22:35 +0000 Subject: [PATCH] Add an option for turning off smooth dragging, since it works on a pixel level, and our geography doesn't, so the numbers end up off in the north-south direction when *not* using spherical mercator. Now, if someone comes to use us and says 'oh my! you ruined me!' we can say 'options! we love options!' and do a rain dance. (Closes #1164) git-svn-id: http://svn.openlayers.org/trunk/openlayers@5229 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer/EventPane.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Layer/EventPane.js b/lib/OpenLayers/Layer/EventPane.js index 71bcb10242..ad5892e32b 100644 --- a/lib/OpenLayers/Layer/EventPane.js +++ b/lib/OpenLayers/Layer/EventPane.js @@ -15,6 +15,18 @@ * - */ OpenLayers.Layer.EventPane = OpenLayers.Class(OpenLayers.Layer, { + + /** + * APIProperty: smoothDragPan + * {Boolean} smoothDragPan determines whether non-public/internal API + * methods are used for better performance while dragging EventPane layers. + * When not in sphericalMercator mode, the smoother dragging doesn't + * actually move north/south directly with the number of pixels moved, + * resulting in a slight offset when you drag your mouse north south with + * this option on. If this visual disparity bothers you, you should turn + * this option off, or use spherical mercator. Default is on. + */ + smootherDragging: true, /** * Property: isBaseLayer @@ -226,7 +238,8 @@ OpenLayers.Layer.EventPane = OpenLayers.Class(OpenLayers.Layer, { var center = this.getMapObjectLonLatFromOLLonLat(newCenter); - if (dragging && this.dragPanMapObject) { + if (dragging && this.dragPanMapObject && + this.smoothDragPan) { var resolution = this.map.getResolution(); var dX = (newCenter.lon - oldCenter.lon) / resolution; var dY = (newCenter.lat - oldCenter.lat) / resolution;