[OpenLayers-Commits] r11284 - in
sandbox/camptocamp/mobile/openlayers: . examples
lib/OpenLayers/Control lib/OpenLayers/Handler tests
tests/BaseTypes tests/Control tools
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Wed Feb 23 04:50:03 EST 2011
Author: fredj
Date: 2011-02-23 01:50:03 -0800 (Wed, 23 Feb 2011)
New Revision: 11284
Added:
sandbox/camptocamp/mobile/openlayers/examples/geolocation.js
sandbox/camptocamp/mobile/openlayers/examples/kinetic.js
Modified:
sandbox/camptocamp/mobile/openlayers/
sandbox/camptocamp/mobile/openlayers/examples/browser.html
sandbox/camptocamp/mobile/openlayers/examples/controls.html
sandbox/camptocamp/mobile/openlayers/examples/geolocation.html
sandbox/camptocamp/mobile/openlayers/examples/kinetic.html
sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html
sandbox/camptocamp/mobile/openlayers/examples/mobile-navigation.html
sandbox/camptocamp/mobile/openlayers/examples/mobile-sencha.html
sandbox/camptocamp/mobile/openlayers/examples/mobile.html
sandbox/camptocamp/mobile/openlayers/examples/style.css
sandbox/camptocamp/mobile/openlayers/lib/OpenLayers/Control/TouchNavigation.js
sandbox/camptocamp/mobile/openlayers/lib/OpenLayers/Handler/Click.js
sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/Bounds.html
sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/LonLat.html
sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/Pixel.html
sandbox/camptocamp/mobile/openlayers/tests/Control/Geolocate.html
sandbox/camptocamp/mobile/openlayers/tests/Control/Scale.html
sandbox/camptocamp/mobile/openlayers/tests/Control/TouchNavigation.html
sandbox/camptocamp/mobile/openlayers/tests/run-tests.html
sandbox/camptocamp/mobile/openlayers/tools/exampleparser.py
Log:
merge with trunk
Property changes on: sandbox/camptocamp/mobile/openlayers
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11233,11236-11238
+ /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11233,11236-11238,11240-11279
Modified: sandbox/camptocamp/mobile/openlayers/examples/browser.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/browser.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/examples/browser.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -79,7 +79,9 @@
</head>
<body onload="init()">
<h1 id="title">Browser detection</h1>
-
+<div id="tags">
+ browser, vendor, mobile, events, HTML5, gesture, touch
+</div>
<p id="shortdesc">
The goal of this script is to inform about the capacity of the browser used by the user.
</p>
Modified: sandbox/camptocamp/mobile/openlayers/examples/controls.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/controls.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/examples/controls.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -27,23 +27,29 @@
});
- var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
+ var ol_wms = new OpenLayers.Layer.WMS(
+ "OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
- {layers: 'basic'} );
- var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
- "http://t1.hypercube.telascience.org/cgi-bin/landsat7",
- {layers: "landsat7"});
- var dm_wms = new OpenLayers.Layer.WMS( "DM Solutions Demo",
+ {layers: 'basic'}
+ );
+
+ var gwc = new OpenLayers.Layer.WMS(
+ "Global Imagery",
+ "http://maps.opengeo.org/geowebcache/service/wms",
+ {layers: "bluemarble"},
+ {tileOrigin: new OpenLayers.LonLat(-180, -90)}
+ );
+ var dm_wms = new OpenLayers.Layer.WMS(
+ "DM Solutions Demo",
"http://www2.dmsolutions.ca/cgi-bin/mswms_gmap",
{layers: "bathymetry,land_fn,park,drain_fn,drainage," +
"prov_bound,fedlimit,rail,road,popplace",
- transparent: "true", format: "image/png" });
+ transparent: "true", format: "image/png"},
+ {visibility: false}
+ );
- jpl_wms.setVisibility(false);
- dm_wms.setVisibility(false);
-
- map.addLayers([ol_wms, jpl_wms, dm_wms]);
- if (!map.getCenter()) map.zoomToMaxExtent();
+ map.addLayers([ol_wms, gwc, dm_wms]);
+ map.zoomToMaxExtent();
}
</script>
</head>
Modified: sandbox/camptocamp/mobile/openlayers/examples/geolocation.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/geolocation.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/examples/geolocation.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -1,95 +1,23 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
+<!DOCTYPE html>
+<html>
<head>
- <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
+ <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
+ <meta name="apple-mobile-web-app-capable" content="yes">
<title>OpenLayers Geolocation</title>
- <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
- <link rel="stylesheet" href="style.css" type="text/css" />
- <script src="../lib/OpenLayers.js"></script>
- <script type="text/javascript">
- var map, layer, vector, watchId;
- function init(){
- var style = {
- fillOpacity: 0.1,
- fillColor: '#000',
- strokeColor: '#f00',
- strokeOpacity: 0.6
- }
-
- map = new OpenLayers.Map('map');
- layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
- vector = new OpenLayers.Layer.Vector('vector');
- map.addLayers([layer, vector]);
-
- map.setCenter(
- new OpenLayers.LonLat(-71.147, 42.472).transform(
- new OpenLayers.Projection("EPSG:4326"),
- map.getProjectionObject()
- ), 12
- );
-
- var geolocate = new OpenLayers.Control.Geolocate({
- options: {
- enableHighAccuracy : false,
- maximumAge : 0,
- timeout : 7000
- }
- });
- map.addControl(geolocate);
- geolocate.events.register("locationupdated",this,function(e) {
- vector.removeAllFeatures();
- vector.addFeatures([
- new OpenLayers.Feature.Vector(
- e.point,
- {},
- {
- graphicName: 'cross',
- strokeColor: '#f00',
- strokeWidth: 2,
- fillOpacity: 0,
- pointRadius: 10
- }
- ),
- new OpenLayers.Feature.Vector(
- OpenLayers.Geometry.Polygon.createRegularPolygon(
- new OpenLayers.Geometry.Point(e.point.x, e.point.y),
- e.position.coords.accuracy/2,
- 50,
- 0
- ),
- {},
- style
- )
- ]);
- map.zoomToExtent(vector.getDataExtent());
- });
- geolocate.events.register("locationfailed",this,function() {
- console.log('Location detection failed');
- });
- window.geolocate = geolocate;
-
- $('locate').onclick = function() {
- geolocate.deactivate();
- $('track').checked = false;
- geolocate.watch = false;
- geolocate.activate();
- };
- $('track').onclick = function() {
- geolocate.deactivate();
- if (this.checked) {
- geolocate.watch = true;
- geolocate.activate();
- }
- };
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ <style>
+ .olControlAttribution {
+ bottom: 3px;
}
- </script>
+ </style>
</head>
<body onload="init()">
<h1 id="title">Geolocation Example</h1>
<div id="tags">
- geolocation, geolocate
+ geolocation, geolocate, mobile
</div>
<p id="shortdesc">
@@ -97,13 +25,16 @@
</p>
<div id="map" class="smallmap"></div>
-
+ <button id="locate">Locate me!</button>
+ <input type="checkbox" name="track" id="track">
+ <label for="track">Track my position</label>
<div id="docs">
- <button id="locate">Locate me!</button>
- <label>
- <input type="checkbox" name="track" id="track" />
- Track my position
- </label>
+ <p>
+ View the <a href="geolocation.js" target="_blank">geolocation.js source</a>
+ to see how this is done.
+ </p>
</div>
+ <script src="../lib/OpenLayers.js"></script>
+ <script src="geolocation.js"></script>
</body>
</html>
Copied: sandbox/camptocamp/mobile/openlayers/examples/geolocation.js (from rev 11279, trunk/openlayers/examples/geolocation.js)
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/geolocation.js (rev 0)
+++ sandbox/camptocamp/mobile/openlayers/examples/geolocation.js 2011-02-23 09:50:03 UTC (rev 11284)
@@ -0,0 +1,72 @@
+var style = {
+ fillOpacity: 0.1,
+ fillColor: '#000',
+ strokeColor: '#f00',
+ strokeOpacity: 0.6
+}
+
+var map = new OpenLayers.Map('map');
+var layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
+var vector = new OpenLayers.Layer.Vector('vector');
+map.addLayers([layer, vector]);
+
+map.setCenter(
+ new OpenLayers.LonLat(-71.147, 42.472).transform(
+ new OpenLayers.Projection("EPSG:4326"),
+ map.getProjectionObject()
+ ), 12
+);
+
+var geolocate = new OpenLayers.Control.Geolocate({
+ geolocationOptions: {
+ enableHighAccuracy: false,
+ maximumAge: 0,
+ timeout: 7000
+ }
+});
+map.addControl(geolocate);
+geolocate.events.register("locationupdated",this,function(e) {
+ vector.removeAllFeatures();
+ vector.addFeatures([
+ new OpenLayers.Feature.Vector(
+ e.point,
+ {},
+ {
+ graphicName: 'cross',
+ strokeColor: '#f00',
+ strokeWidth: 2,
+ fillOpacity: 0,
+ pointRadius: 10
+ }
+ ),
+ new OpenLayers.Feature.Vector(
+ OpenLayers.Geometry.Polygon.createRegularPolygon(
+ new OpenLayers.Geometry.Point(e.point.x, e.point.y),
+ e.position.coords.accuracy/2,
+ 50,
+ 0
+ ),
+ {},
+ style
+ )
+ ]);
+ map.zoomToExtent(vector.getDataExtent());
+});
+geolocate.events.register("locationfailed",this,function() {
+ OpenLayers.Console.log('Location detection failed');
+});
+
+$('locate').onclick = function() {
+ geolocate.deactivate();
+ $('track').checked = false;
+ geolocate.watch = false;
+ geolocate.activate();
+};
+$('track').onclick = function() {
+ geolocate.deactivate();
+ if (this.checked) {
+ geolocate.watch = true;
+ geolocate.activate();
+ }
+};
+$('track').checked = false;
\ No newline at end of file
Modified: sandbox/camptocamp/mobile/openlayers/examples/kinetic.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/kinetic.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/examples/kinetic.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -1,50 +1,13 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
+<!DOCTYPE html>
+<html>
<head>
<title>OpenLayers Kinetic Dragging Example</title>
- <link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
- <link rel="stylesheet" href="style.css" type="text/css" />
- <style type="text/css">
- #map {
- width: 100%;
- height: 100%;
- }
- </style>
- <script src="../lib/OpenLayers.js"></script>
- <script type="text/javascript">
- var map, layer;
- function init(){
- map = new OpenLayers.Map({
- div: "map",
- resolutions: [0.087890625, 0.0439453125, 0.02197265625, 0.010986328125],
- panDuration: 100,
- controls: [
- new OpenLayers.Control.Navigation(
- {dragPanOptions: {enableKinetic: true}}
- )
- ]
- });
- layer = new OpenLayers.Layer.TileCache("TileCache Layer",
- ["http://c0.tilecache.osgeo.org/wms-c/cache/",
- "http://c1.tilecache.osgeo.org/wms-c/cache/",
- "http://c2.tilecache.osgeo.org/wms-c/cache/",
- "http://c3.tilecache.osgeo.org/wms-c/cache/",
- "http://c4.tilecache.osgeo.org/wms-c/cache/"],
- "basic",
- {
- serverResolutions: [0.703125, 0.3515625, 0.17578125, 0.087890625,
- 0.0439453125, 0.02197265625, 0.010986328125,
- 0.0054931640625, 0.00274658203125, 0.001373291015625,
- 0.0006866455078125, 0.00034332275390625, 0.000171661376953125,
- 0.0000858306884765625, 0.00004291534423828125, 0.000021457672119140625],
- buffer: 4
- }
- );
- map.addLayer(layer);
- map.setCenter(new OpenLayers.LonLat(0, 0), 0);
- }
- </script>
+ <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
+ <meta name="apple-mobile-web-app-capable" content="yes" />
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
</head>
- <body onload="init()">
+ <body>
<h1 id="title">Kinetic Dragging Example</h1>
<div id="tags">
@@ -58,24 +21,23 @@
<div id="map" class="smallmap"></div>
<div id="docs">
-
<p>
- OpenLayers Kinetic Dragging inspired from <a href="http://www.tile5.org">Tile5</a>, and
- <a href="http://code.google.com/p/kineticscrolling/">kineticscrolling</a> for Google Maps API V3.
+ OpenLayers Kinetic Dragging inspired from <a href="http://www.tile5.org">Tile5</a>, and
+ <a href="http://code.google.com/p/kineticscrolling/">kineticscrolling</a> for Google Maps API V3.
+ </p><p>
+ As shown in this example Kinetic Dragging is enabled by setting
+ <code>enableKinetic</code> to true in the config object provided to the
+ <code>Control.DragPan</code> constructor. When using
+ <code>Control.Navigation</code> or <code>Control.TouchNavigation</code>
+ providing options to the underlying <code>Control.DragPan</code>
+ instance is done through the <code>dragPanOptions</code> config
+ property.
+ </p><p>
+ View the <a href="kinetic.js" target="_blank">kinetic.js source</a>
+ to see how this is done.
</p>
-
- <p>
-
- As shown in this example Kinetic Dragging is enabled by setting
- <code>enableKinetic</code> to true in the config object provided to the
- <code>Control.DragPan</code> constructor. When using
- <code>Control.Navigation</code> or <code>Control.TouchNavigation</code>
- providing options to the underlying <code>Control.DragPan</code>
- instance is done through the <code>dragPanOptions</code> config
- property.
-
- </p>
-
</div>
+ <script src="../lib/OpenLayers.js"></script>
+ <script src="kinetic.js"></script>
</body>
</html>
Copied: sandbox/camptocamp/mobile/openlayers/examples/kinetic.js (from rev 11279, trunk/openlayers/examples/kinetic.js)
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/kinetic.js (rev 0)
+++ sandbox/camptocamp/mobile/openlayers/examples/kinetic.js 2011-02-23 09:50:03 UTC (rev 11284)
@@ -0,0 +1,28 @@
+var map = new OpenLayers.Map({
+ div: "map",
+ resolutions: [0.087890625, 0.0439453125, 0.02197265625, 0.010986328125],
+ panDuration: 100,
+ controls: [
+ new OpenLayers.Control.Navigation(
+ {dragPanOptions: {enableKinetic: true}}
+ )
+ ]
+});
+var layer = new OpenLayers.Layer.TileCache("TileCache Layer",
+ ["http://c0.tilecache.osgeo.org/wms-c/cache/",
+ "http://c1.tilecache.osgeo.org/wms-c/cache/",
+ "http://c2.tilecache.osgeo.org/wms-c/cache/",
+ "http://c3.tilecache.osgeo.org/wms-c/cache/",
+ "http://c4.tilecache.osgeo.org/wms-c/cache/"],
+ "basic",
+ {
+ serverResolutions: [0.703125, 0.3515625, 0.17578125, 0.087890625,
+ 0.0439453125, 0.02197265625, 0.010986328125,
+ 0.0054931640625, 0.00274658203125, 0.001373291015625,
+ 0.0006866455078125, 0.00034332275390625, 0.000171661376953125,
+ 0.0000858306884765625, 0.00004291534423828125, 0.000021457672119140625],
+ buffer: 4
+ }
+);
+map.addLayer(layer);
+map.setCenter(new OpenLayers.LonLat(0, 0), 0);
\ No newline at end of file
Modified: sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/examples/mobile-jq.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -37,7 +37,6 @@
bottom: 5px;
right: 5px;
}
-
#navigation {
position: absolute;
bottom: 50px;
@@ -48,7 +47,9 @@
display: block;
padding: 7px 6px 7px 8px;
}
-
+ #title, #tags, #shortdesc {
+ display: none;
+ }
</style>
<script>
$(document).ready(function() {
@@ -129,7 +130,21 @@
</script>
</head>
<body>
+ <h1 id="title">OpenLayers with jQuery Mobile</h1>
+ <div id="tags">
+ mobile, jquery
+ </div>
+ <p id="shortdesc">
+ Using jQuery Mobile to display an OpenLayers map.
+ </p>
+
<div data-role="page" id="mappage">
+<!-- <div data-role="header"> -->
+<!-- <input id="west" type="button" data-icon="arrow-l" value="west"> -->
+<!-- <input id="north" type="button" data-icon="arrow-u" value="north"> -->
+<!-- <input id="south" type="button" data-icon="arrow-d" value="south"> -->
+<!-- <input id="east" type="button" data-icon="arrow-r" value="east"> -->
+<!-- </div> -->
<div data-role="content">
<div id="map"></div>
</div>
Modified: sandbox/camptocamp/mobile/openlayers/examples/mobile-navigation.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/mobile-navigation.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/examples/mobile-navigation.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -11,20 +11,36 @@
<script type="text/javascript" src="mobile-navigation.js"></script>
</head>
<body onload="init()">
- <h1 id="title">TouchNavigation Control</h1>
+ <h1 id="title">Mobile Navigation</h1>
<div id="tags">
mobile, touch, drag, move, zoom, navigate
</div>
- <div id="shortdesc">Demonstrate TouchNavigation Control features</div>
+ <div id="shortdesc">Demonstrate map navigation on mobile</div>
<div id="map" class="smallmap"></div>
<div id="docs">
+
<p>
- 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 demonstates what OpenLayers provides for map
+ navigation on mobile.
+ </p>
+
+ <p>
+ The TouchNavigation control allows to pan the map with touch
+ gestures on the screen – "touchstart", "touchmove",
+ "touchend" sequences. It also allows to zoom in with double taps,
+ and to zoom out with two-finger single taps. The latter is only
+ available on devices supporting multi-touch. Note that in most
+ devices Android doesn't support multi-touch in the browser.
+ </p>
+
+ <p>
+ The ZoomPanel control provides + and - buttons for zooming in and
+ out. These buttons should work on any device, and the zoom out
+ button is especially needed for devices that don't support
+ multi-touch.
</p>
<p>
See the <a href="mobile-navigation.js" target="_blank">mobile-navigation.js
Modified: sandbox/camptocamp/mobile/openlayers/examples/mobile-sencha.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/mobile-sencha.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/examples/mobile-sencha.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -24,10 +24,19 @@
width: 26px;
height: 26px;
}
+ #title, #tags, #shortdesc {
+ display: none;
+ }
</style>
-
<script src="mobile-sencha.js"></script>
</head>
<body>
+ <h1 id="title">OpenLayers with Sencha Touch</h1>
+ <div id="tags">
+ mobile, sencha touch
+ </div>
+ <p id="shortdesc">
+ Using Sencha Touch to display an OpenLayers map.
+ </p>
</body>
</html>
Modified: sandbox/camptocamp/mobile/openlayers/examples/mobile.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/mobile.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/examples/mobile.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -23,9 +23,19 @@
bottom: 5px;
right: 5px;
}
+ #title, #tags, #shortdesc {
+ display: none;
+ }
</style>
</head>
<body>
+ <h1 id="title">Basic Mobile Example</h1>
+ <div id="tags">
+ mobile
+ </div>
+ <p id="shortdesc">
+ A basic full-screen map for mobile devices.
+ </p>
<div id="map"></div>
<script>
init();
Modified: sandbox/camptocamp/mobile/openlayers/examples/style.css
===================================================================
--- sandbox/camptocamp/mobile/openlayers/examples/style.css 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/examples/style.css 2011-02-23 09:50:03 UTC (rev 11284)
@@ -121,3 +121,19 @@
display : none;
}
}
+ at media only screen and (orientation: landscape) {
+ #shortdesc {
+ float: right;
+ width: 25%;
+ }
+ #map {
+ width: 70%;
+ }
+ #docs {
+ font-size: 12px;
+ }
+}
+body {
+ -webkit-text-size-adjust: none;
+}
+
Modified: sandbox/camptocamp/mobile/openlayers/lib/OpenLayers/Control/TouchNavigation.js
===================================================================
--- sandbox/camptocamp/mobile/openlayers/lib/OpenLayers/Control/TouchNavigation.js 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/lib/OpenLayers/Control/TouchNavigation.js 2011-02-23 09:50:03 UTC (rev 11284)
@@ -128,7 +128,7 @@
* evt - {Event}
*/
defaultClick: function (evt) {
- if(evt.lasttouches && evt.lasttouches.length == 2) {
+ if(evt.lastTouches && evt.lastTouches.length == 2) {
this.map.zoomOut();
}
},
Modified: sandbox/camptocamp/mobile/openlayers/lib/OpenLayers/Handler/Click.js
===================================================================
--- sandbox/camptocamp/mobile/openlayers/lib/OpenLayers/Handler/Click.js 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/lib/OpenLayers/Handler/Click.js 2011-02-23 09:50:03 UTC (rev 11284)
@@ -269,10 +269,10 @@
* touches property from last touchstart or touchmove
*/
touchend: function(evt) {
- if(!evt) {
+ var last = this.last || this.down;
+ if (!evt || !last) {
return false;
}
- var last = this.last || this.down;
evt.xy = last.xy;
evt.lastTouches = last.touches;
return evt.xy ? this.click(evt) : false;
Modified: sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/Bounds.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/Bounds.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/Bounds.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -606,6 +606,7 @@
t.ok( bounds.equals(b), "bounds is set correctly");
//null values
+ OpenLayers.Lang.setCode('en');
var desiredMsg = "You must pass both x and y values to the add function.";
OpenLayers.Console.error = function(msg) {
t.eq(msg, desiredMsg, "error correctly reported");
Modified: sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/LonLat.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/LonLat.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/LonLat.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -64,6 +64,7 @@
t.ok( addpx.equals(ll), "addpx is set correctly");
//null values
+ OpenLayers.Lang.setCode('en');
var desiredMsg = "You must pass both lon and lat values to the add function.";
OpenLayers.Console.error = function(msg) {
t.eq(msg, desiredMsg, "error correctly reported");
Modified: sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/Pixel.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/Pixel.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/tests/BaseTypes/Pixel.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -74,6 +74,7 @@
t.ok( pixel.equals(px), "returned pixel is correct");
//null values
+ OpenLayers.Lang.setCode('en');
var desiredMsg = "You must pass both x and y values to the add function.";
OpenLayers.Console.error = function(msg) {
t.eq(msg, desiredMsg, "error correctly reported");
Modified: sandbox/camptocamp/mobile/openlayers/tests/Control/Geolocate.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/tests/Control/Geolocate.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/tests/Control/Geolocate.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -18,12 +18,14 @@
}
};
- function test_initialize (t) {
- t.plan( 2 );
-
- control = new OpenLayers.Control.Geolocate();
- t.ok( control instanceof OpenLayers.Control.Geolocate, "new OpenLayers.Control returns object" );
- t.eq( control.displayClass, "olControlGeolocate", "displayClass is correct" );
+ function test_initialize(t) {
+ t.plan(3);
+ control = new OpenLayers.Control.Geolocate({geolocationOptions: {foo: 'bar'}});
+ t.ok(control instanceof OpenLayers.Control.Geolocate,
+ "new OpenLayers.Control returns object" );
+ t.eq(control.displayClass, "olControlGeolocate", "displayClass is correct" );
+ t.eq(control.geolocationOptions.foo, 'bar',
+ 'provided geolocation options are set in the geolocationOptions prop');
}
function test_bind(t) {
t.plan(3);
Modified: sandbox/camptocamp/mobile/openlayers/tests/Control/Scale.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/tests/Control/Scale.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/tests/Control/Scale.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -2,6 +2,7 @@
<head>
<script src="../OLLoader.js"></script>
<script type="text/javascript">
+ OpenLayers.Lang.setCode('en');
var map;
function test_Control_Scale_constructor (t) {
t.plan( 2 );
Modified: sandbox/camptocamp/mobile/openlayers/tests/Control/TouchNavigation.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/tests/Control/TouchNavigation.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/tests/Control/TouchNavigation.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -102,6 +102,28 @@
}
+ function test_zoomOut(t) {
+ t.plan(1);
+
+ var map = new OpenLayers.Map(document.body);
+ var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
+ "http://labs.metacarta.com/wms/vmap0",
+ {layers: 'basic'} );
+ map.addLayer(layer);
+ map.setCenter(new OpenLayers.LonLat(0, 0), 5);
+ var control = new OpenLayers.Control.TouchNavigation();
+ map.addControl(control);
+ var handler = control.handlers.click;
+ handler.touchstart({xy: {x: 1, y: 1}, touches: ["foo", "bar"]});
+ handler.touchend({});
+ t.delay_call(1, function() {
+ t.eq(map.getZoom(), 4, "Did we zoom out?");
+ // tear down
+ map.destroy();
+ });
+
+ }
+
</script>
</head>
<body>
Modified: sandbox/camptocamp/mobile/openlayers/tests/run-tests.html
===================================================================
--- sandbox/camptocamp/mobile/openlayers/tests/run-tests.html 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/tests/run-tests.html 2011-02-23 09:50:03 UTC (rev 11284)
@@ -2410,4 +2410,10 @@
</div>
</span>
+<script>
+ if (/noscroll/.test(location.href)) {
+ document.getElementById('scroller').style.height='auto';
+ document.getElementById('right_frame').style.height='auto';
+ }
+</script>
</body></html>
Modified: sandbox/camptocamp/mobile/openlayers/tools/exampleparser.py
===================================================================
--- sandbox/camptocamp/mobile/openlayers/tools/exampleparser.py 2011-02-23 09:36:15 UTC (rev 11283)
+++ sandbox/camptocamp/mobile/openlayers/tools/exampleparser.py 2011-02-23 09:50:03 UTC (rev 11284)
@@ -20,7 +20,14 @@
missing_deps = False
try:
- import simplejson
+ import json
+except ImportError:
+ try:
+ import simplejson as json
+ except ImportError, E:
+ missing_deps = E
+
+try:
from BeautifulSoup import BeautifulSoup
except ImportError, E:
missing_deps = E
@@ -196,7 +203,7 @@
if __name__ == "__main__":
if missing_deps:
- print "This script requires simplejson and BeautifulSoup. You don't have them. \n(%s)" % E
+ print "This script requires json or simplejson and BeautifulSoup. You don't have them. \n(%s)" % E
sys.exit()
if len(sys.argv) > 1:
@@ -237,7 +244,7 @@
index = wordIndex(exampleList)
- json = simplejson.dumps({"examples": exampleList, "index": index})
+ json = json.dumps({"examples": exampleList, "index": index})
#give the json a global variable we can use in our js. This should be replaced or made optional.
json = 'var info=' + json
outFile.write(json)
More information about the Commits
mailing list