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
This commit is contained in:
crschmidt
2007-11-21 08:22:35 +00:00
parent 14ae911b47
commit 9acb997b20

View File

@@ -15,6 +15,18 @@
* - <OpenLayers.Layer>
*/
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;