[OpenLayers-Users] Problem with Pixel to Lonlat conversions during pan.

laurentK2 lboileau at k2geospatial.com
Tue Sep 27 10:57:01 EDT 2011


Hello,

I'm using OpenLayers 2.11 for a mobile project. My map has a TouchNavigation
control used for pinch zooming, kinetic drag/panning and map clicking. I've
found a strange behavior concerning the conversion of OpenLayers.Pixel to
OpenLayers.Lonlat within TouchNavigation's defaultClick function.

I use the defaultClick function to add a marker on the map at the location
clicked. The location is obtained as a OpenLayers.Pixel received via the
defaultClick argument and is then converted to a OpenLayers.Lonlat using
Map.getLonLatFromPixel. During testing I have found that if I click and then
pan, the marker will be positioned not at the location I clicked, but at the
destination of my pan.

Here is an image describing the problem. The cursor represents the location
that I clicked, the red arrow is the distance panned (in this case using my
keyboard's arrow keys in chrome) and the marker is the result of my click.

http://osgeo-org.1803224.n2.nabble.com/file/n6836236/FPUGL.png 

Here's another example with Las Vegas as my initial click and a pan to the
right:

http://osgeo-org.1803224.n2.nabble.com/file/n6836236/Xa0w4.png 

I believe this problem may be due to delayed calls in Handler.Click. Does
anyone have any ideas?

Thank you.

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Problem-with-Pixel-to-Lonlat-conversions-during-pan-tp6836236p6836236.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list