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

laurentK2 lboileau at k2geospatial.com
Wed Sep 28 08:58:50 EDT 2011


erilem wrote:
> 
> 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.
> 

I will use a Handler.Click-based control as per your suggestion. 

However, regarding the event firing only when the mouse is released: I
experience the same strange behavior upon pressing and releasing the mouse
button *and then* panning. Like so:

http://osgeo-org.1803224.n2.nabble.com/file/n6840117/Ndnzu.png 

I also logged the defaultClick function's argument. This is when I press and
release the mouse without doing a pan afterwards:

The click event's OpenLayers.Pixel is x: 572 y: 571
That Pixel is then transformed to Lonlat: Lat: -36.666379958496 Lon:
-21.296623259826

This is when I press/release *and then pan at the same exact location* (both
in terms of pixels and and lonlat):

The click event's OpenLayers.Pixel is x: 572 y: 571
That Pixel is then transformed to Lonlat: Lat: -15.051548061825 Lon:
-21.296623259826

I believe that in both cases the transformed lonlat should have equal values
since the click originated at the same place geographically. 

I hope that using a Handler.Click control will solve my problem, however I
fear it might be related to how browsers choose to process their event
queues.

Thanks again, I will keep you updated. 

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


More information about the Users mailing list