[OpenLayers-Users] Problem with Pixel to Lonlat conversions
during pan.
Eric Lemoine
eric.lemoine at camptocamp.com
Tue Sep 27 18:13:34 EDT 2011
On Tue, Sep 27, 2011 at 4:57 PM, laurentK2 <lboileau at k2geospatial.com> wrote:
> 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?
This is expected. defaultClick gets called when the mouse is released,
this isn't related to delayed calls in Handler.Click but to when the
browser actually triggers "click" events. Also, I think you shouldn't
override the touch navigation's control defaultClick function to be
notified on clicks. Instead you should probably create your
Handler.Click-based control, look at the click-handler example for
that.
Cheers,
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com
More information about the Users
mailing list