[OpenLayers-Users] Customize Panning Resolutions
Erik Uzureau
erik.uzureau at metacarta.com
Tue Sep 18 21:38:14 EDT 2007
embarrassingly, that is *not* customizable in OL right now.
It *should* be, via the property 'slideFactor' on the PanZoom control.
However, if we look closely at the buttonDown() function, we'll
see that the 50's are hardcoded in there.
If you *really* need to change this, it can be done. you'd have to add
a patch like this:
OpenLayers.Control.PanZoom.prototype.buttonDown = function(evt) {
if (!OpenLayers.Event.isLeftClick(evt)) return;
switch (this.action) {
case "panup":
this.map.pan(0, -50);
break;
case "pandown":
this.map.pan(0, 50);
break;
case "panleft":
this.map.pan(-50, 0);
break;
case "panright":
this.map.pan(50, 0);
break;
case "zoomin":
this.map.zoomIn();
break;
case "zoomout":
this.map.zoomOut();
break;
case "zoomworld":
this.map.zoomToMaxExtent();
break;
};
OpenLayers.Event.stop(evt);
};
you'd have to call that *before* instantiating the your map (or at
least your panzoom control) and *after* loading the OpenLayers.js
library of course, you'd replace the 50's with whatever else you want.
I'm making a ticket to have this fixed in 2.6.
Thanks for the report!
Erik
On 9/18/07, Linda Rawson <linda.rawson at gmail.com> wrote:
> I of course have this issue with having to do all sorts of things when the
> user is at a certain resolution. The latest thing is they want the panning
> unit decreased. When they pan right they only want to go a certain distance
> not the default zoom scale. Is there a way to change the amount of the pan?
>
> Thanks,
> Linda Rawson
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
More information about the Users
mailing list