From ab309197e2202697c0c80cc4ef9a093334556843 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 22 Feb 2011 12:08:30 +0000 Subject: [PATCH] mobile-navigation example - place the JS code in a separate file, no functional change git-svn-id: http://svn.openlayers.org/trunk/openlayers@11230 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- examples/mobile-navigation.html | 33 +++++++++++---------------------- examples/mobile-navigation.js | 17 +++++++++++++++++ 2 files changed, 28 insertions(+), 22 deletions(-) create mode 100644 examples/mobile-navigation.js diff --git a/examples/mobile-navigation.html b/examples/mobile-navigation.html index bb1f9282ef..1a0528528a 100644 --- a/examples/mobile-navigation.html +++ b/examples/mobile-navigation.html @@ -6,25 +6,8 @@ OpenLayers TouchNavigation Control - - + +

TouchNavigation Control

@@ -37,9 +20,15 @@
- This example demonstrates a couple features of the TouchNavigation - control. The TouchNavigation control controls most map dragging, - movement, zooming, etc, optimized for mobile devices. +

+ This example demonstrates a couple features of the TouchNavigation + control. The TouchNavigation control controls most map dragging, + movement, zooming, etc, optimized for mobile devices. +

+

+ See the mobile-navigation.js + source to see how this is done. +

diff --git a/examples/mobile-navigation.js b/examples/mobile-navigation.js new file mode 100644 index 0000000000..7d69226145 --- /dev/null +++ b/examples/mobile-navigation.js @@ -0,0 +1,17 @@ +var map, layer; +function init() { + map = new OpenLayers.Map('map', { controls: [ + new OpenLayers.Control.TouchNavigation({ + dragPanOptions: { + interval: 0, // non-zero kills performance on some mobile phones + enableKinetic: true + } + }), + new OpenLayers.Control.ZoomPanel() + ] }); + layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", + "http://vmap0.tiles.osgeo.org/wms/vmap0", + {layers: 'basic'} ); + map.addLayer(layer); + map.setCenter(new OpenLayers.LonLat(5, 40), 2); +}