[OpenLayers-Users] getCenter() in moveend handler problems

brancusi roger.moffatt at gmail.com
Mon Feb 9 07:20:11 EST 2009


Hiya

I've created a moveend listener using;

map.events.register("moveend",null,myeventhandler);

and myeventhandler works fine. BUT if myeventhandler includes the code
map.getCenter() to determine where the user might have dragged to, I find
that as soon as I then try to drag again, the map resets to the position it
was in before the eventhandler was called so you can never actually combine
multiple drags to move around the map.

If I use the navigation up down left right default controls, what happens is
that the map moves (say) left, myeventhandler is called, and then the map
moves back to where it was before the control was hit.

If I remove the call to map.getCenter() then everything performs as
expected.

Does anyone know what the issue with calling getCenter() inside an
eventhandler might be? Is there a better way to find out the current center
of the map after a moveend event?

TIA
brancusi



-- 
View this message in context: http://n2.nabble.com/getCenter%28%29-in-moveend-handler-problems-tp2296931p2296931.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list