[OpenLayers-Users] Re: TouchNavigation control single "clicks"

William DePalo depalow at gmail.com
Mon May 21 16:01:37 PDT 2012


On 5/20/2012 8:10 PM, William DePalo wrote:
> I have a map with a text layer which displays icons which when clicked
> pop up text messages. It works well on the desktop. If I don't put the
> TouchNavigation control on a map displayed on my Android phone (don't
> know yet if the iPhone behaves the same) touching the icons in the text
> layer will pop up the text.
>
> However if I put the TouchNavigation control on the map displayed on the
> phone then I can pan the map with my fingers but touching the icons in
> the text layer does nothing.
>
> Do I have to choose between having touch navigation and the text layer
> or am I doing something wrong.

Just in case anyone else encounters the same problem, and for what it is 
worth, here is how I was able to use a text layer with click-able 
markers on an a Open Street Map map rendered on Android:

1) start with the mobile-navigation.html example
2) remove the TouchNavigation control from the controls array
3) add the touch.js file from

     http://anders.com/cms/352/OpenLayers/iPhone/Android/Touch.Gestures

to the html page
4) add this line after the map is initialized

  window.touchhandler = new TouchHandler(map, 1);

The constant in the last line is a hack. The author suggests using a 
value of 4. It seems that 1 works better for me. I could be wrong. 
Caveat emptor.

Regards,
Will





More information about the Users mailing list