[OpenLayers-Users] Touch navigation implementation

Eric Lemoine eric.lemoine at camptocamp.com
Wed Dec 5 02:41:20 PST 2012


On Wed, Dec 5, 2012 at 9:19 AM, Derek Watling <derek at cmainfo.co.za> wrote:
> Eric, Thank you for clarifying the controls.
>
> I tried adding "stopUp = true" as in the following code:
>
>     var control;
>     for (var key in measureControls) {
>         control = measureControls[key];
>         control.events.on({
>             "measure": handleMeasurements,
>             "measurepartial": handleMeasurements
>         });
>         control.geodesic = true;
> +      control.handler.stopUp = true;
>         map.addControl(control);
>     }
>
> This works on the touch devices but breaks the measure when using a mouse,
> ie. you click the first point and the map then drags.
>
> Is there any way of detecting touch devices?

One way:

'ontouchstart' in document.documentElement


> What about devices that have
> both touch and mouse?

You probably want to rely on touch events for those.



-- 
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