[OpenLayers-Users] Touch navigation implementation

Eric Lemoine eric.lemoine at camptocamp.com
Tue Dec 4 22:44:59 PST 2012


On Mon, Dec 3, 2012 at 11:07 AM, Derek Watling <derek at cmainfo.co.za> wrote:
> I am in the process of updating to OL 2.12 and Google v3 (previously used OL
> 2.10, Google v2).
>
> While I have sorted most of the issues I am a bit confused as to
> implementing touch navigation.
>
> I am testing on various desktop browsers as well as an iPad and an Andriod
> tablet. Is there any device detection? Which navigation control should be
> included if you don't know what device the web site is being viewed on?
>
>
> Currently I have the following code:
> map.addControl(new OpenLayers.Control.Navigation({ dragPanOptions: {
> enableKinetic: true } }));
> map.addControl(new OpenLayers.Control.TouchNavigation({ dragPanOptions: {
> enableKinetic: true } }));


OpenLayers.Control.Navigation supports mouse as well as touch. For
pinch zoom to work you have to have OpenLayers/Control/PinchZoom.js in
your build.

OpenLayers.Control.TouchNavigation supports touch only, it is to be
used for touch/mobile specific apps.


> The one issue I do still have is with the Measure control. On both iPad and
> Andriod when measuring, each "click" to add a point also activates the map's
> Click control. How do I stop this happening?

You can try this:

yourMeasureControl.handler.stopUp = true;



-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 94
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list