[OpenLayers-Users] wheel zooming: want to turn off re-centre of
map at mouse location
Trond Michelsen
trondmm-openlayers at crusaders.no
Mon Oct 29 09:02:39 EDT 2007
On Sun, Oct 28, 2007 at 08:13:00PM -0400, Christopher Schmidt wrote:
> On Mon, Oct 29, 2007 at 12:24:06AM +0100, Trond Michelsen wrote:
>> On Tue, Oct 23, 2007 at 11:41:49AM -0400, Michael Quentel wrote:
>>> In Navigation.js, it appears that the wheelChange function gets the
>>> event x y, and not only zooms in or out, but also appears to re-centre
>>> on the mouse event location. Is this correct?
>> In my opinion, it is not. This behaviour means that if you put the
>> mousepointer over an area, and zoom in more than once, the second (and
>> third, etc.) zoom will zoom in on a different area than the first. I
>> don't think this behaviour is very intuitive.
> I'm not sure if you're responding to Michael's question with "This is
> the current behavior", or "this is what I expect."
Sorry for being unclear. Yeah, I meant "this is current behaviour".
> The above described is not what the current behavior is -- what you
> described below is the current behavior.
That's good to hear, but even after upgrading to 2.5, my openlayers
installation is still behaving like I described.
After a bit of digging, I figured out the problem. I've been using
OpenLayers.Control.MouseDefaults to get the wheel zooming, instead of
OpenLayers.Control.Navigation. MouseDefaults will recenter on the
mouse event location, while Navigation works the way I expect.
I see from the source that MouseDefaults has been deprecated, so I'll
just use Navigation from now on :) Just one thing, though: I can't see
any mention of its deprecation in the documentation:
http://dev.openlayers.org/docs/files/OpenLayers/Control/MouseDefaults-js.html
I think it would be useful if the documentation was upgraded.
--
Trond Michelsen
More information about the Users
mailing list