[OpenLayers-Commits] r11528 - in sandbox/cmoullet/openlayers: .
build examples examples/img lib/OpenLayers
lib/OpenLayers/Handler lib/OpenLayers/Layer tests/Control
tests/Handler tools
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Fri Feb 25 11:28:09 EST 2011
Author: cmoullet
Date: 2011-02-25 08:28:08 -0800 (Fri, 25 Feb 2011)
New Revision: 11528
Added:
sandbox/cmoullet/openlayers/examples/img/locate.png
sandbox/cmoullet/openlayers/examples/img/mobile-layers.png
sandbox/cmoullet/openlayers/examples/img/mobile-loc.png
sandbox/cmoullet/openlayers/examples/img/openlayers.png
sandbox/cmoullet/openlayers/examples/mobile-jq.js
sandbox/cmoullet/openlayers/examples/style.mobile-jq.css
Modified:
sandbox/cmoullet/openlayers/
sandbox/cmoullet/openlayers/build/mobile.cfg
sandbox/cmoullet/openlayers/examples/accelerometer.html
sandbox/cmoullet/openlayers/examples/bing.html
sandbox/cmoullet/openlayers/examples/controls.html
sandbox/cmoullet/openlayers/examples/mobile-base.js
sandbox/cmoullet/openlayers/examples/mobile-jq.html
sandbox/cmoullet/openlayers/examples/mobile-navigation.js
sandbox/cmoullet/openlayers/examples/mobile.js
sandbox/cmoullet/openlayers/examples/spherical-mercator.html
sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Feature.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Layer.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/VirtualEarth.js
sandbox/cmoullet/openlayers/tests/Control/Geolocate.html
sandbox/cmoullet/openlayers/tests/Handler/Click.html
sandbox/cmoullet/openlayers/tests/Handler/Feature.html
sandbox/cmoullet/openlayers/tools/release.sh
Log:
Merge with trunk
Property changes on: sandbox/cmoullet/openlayers
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11499
+ /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11520
Modified: sandbox/cmoullet/openlayers/build/mobile.cfg
===================================================================
--- sandbox/cmoullet/openlayers/build/mobile.cfg 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/build/mobile.cfg 2011-02-25 16:28:08 UTC (rev 11528)
@@ -13,8 +13,10 @@
OpenLayers/Control/Geolocate.js
OpenLayers/Control/ZoomPanel.js
OpenLayers/Control/Attribution.js
+OpenLayers/Control/SelectFeature.js
OpenLayers/Layer/Vector.js
OpenLayers/Renderer/SVG.js
+OpenLayers/Format/GeoJSON.js
[exclude]
Modified: sandbox/cmoullet/openlayers/examples/accelerometer.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/accelerometer.html 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/examples/accelerometer.html 2011-02-25 16:28:08 UTC (rev 11528)
@@ -70,10 +70,16 @@
<h1 id="title">Accelerometer</h1>
<p id="shortdesc">
- The goal of this script is to demonstrate the usage of accelerometer.<br>
- The orientation specification can be found <a href="http://dev.w3.org/geo/api/spec-source-orientation.html">here</a>.
+ The goal of this script is to demonstrate the usage of accelerometer.
</p>
+<p>
+ The orientation specification can be found <a href="http://dev.w3.org/geo/api/spec-source-orientation.html">here</a>.
+</p>
+<div id="tags">
+ browser, vendor, mobile, orientation
+</div>
+
<h1>Device motion</h1>
<div id="resultDeviceMotion">
Modified: sandbox/cmoullet/openlayers/examples/bing.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/bing.html 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/examples/bing.html 2011-02-25 16:28:08 UTC (rev 11528)
@@ -12,9 +12,18 @@
<script>
var map;
-
+
function init(){
- map = new OpenLayers.Map("map");
+ // setting restrictedExtent so that we can use the
+ // VirtualEarth-layers, see e.g.
+ // http://dev.openlayers.org/apidocs/files/OpenLayers/Layer/VirtualEarth-js.html
+ var restrictedExtent = new OpenLayers.Bounds(-20037508, -20037508,
+ 20037508, 20037508);
+
+ map = new OpenLayers.Map("map", {
+ restrictedExtent: restrictedExtent
+ });
+
map.addControl(new OpenLayers.Control.LayerSwitcher());
var shaded = new OpenLayers.Layer.VirtualEarth("Shaded", {
Modified: sandbox/cmoullet/openlayers/examples/controls.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/controls.html 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/examples/controls.html 2011-02-25 16:28:08 UTC (rev 11528)
@@ -25,7 +25,6 @@
numZoomLevels: 6
});
-
var ol_wms = new OpenLayers.Layer.WMS(
"OpenLayers WMS",
@@ -49,7 +48,10 @@
);
map.addLayers([ol_wms, gwc, dm_wms]);
- map.zoomToMaxExtent();
+
+ if (!map.getCenter()) {
+ map.zoomToMaxExtent();
+ }
}
</script>
</head>
Copied: sandbox/cmoullet/openlayers/examples/img/locate.png (from rev 11520, trunk/openlayers/examples/img/locate.png)
===================================================================
(Binary files differ)
Copied: sandbox/cmoullet/openlayers/examples/img/mobile-layers.png (from rev 11520, trunk/openlayers/examples/img/mobile-layers.png)
===================================================================
(Binary files differ)
Copied: sandbox/cmoullet/openlayers/examples/img/mobile-loc.png (from rev 11520, trunk/openlayers/examples/img/mobile-loc.png)
===================================================================
(Binary files differ)
Copied: sandbox/cmoullet/openlayers/examples/img/openlayers.png (from rev 11520, trunk/openlayers/examples/img/openlayers.png)
===================================================================
(Binary files differ)
Modified: sandbox/cmoullet/openlayers/examples/mobile-base.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-base.js 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/examples/mobile-base.js 2011-02-25 16:28:08 UTC (rev 11528)
@@ -34,7 +34,7 @@
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.TouchNavigation({
dragPanOptions: {
- interval: 0, // non-zero kills performance on some mobile phones
+ interval: 100,
enableKinetic: true
}
}),
Modified: sandbox/cmoullet/openlayers/examples/mobile-jq.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-jq.html 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/examples/mobile-jq.html 2011-02-25 16:28:08 UTC (rev 11528)
@@ -1,8 +1,7 @@
<!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 http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>OpenLayers with jQuery Mobile</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0;">
<meta name="apple-mobile-web-app-capable" content="yes">
@@ -10,135 +9,67 @@
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
<link rel="stylesheet" href="style.mobile.css" type="text/css">
- <script src="../lib/OpenLayers.js"></script>
+ <link rel="stylesheet" href="style.mobile-jq.css" type="text/css">
+ <script src="../lib/OpenLayers.js?mobile"></script>
<script src="mobile-base.js"></script>
- <style>
- html {
- height: 100%;
- }
- body {
- margin: 0;
- padding: 0;
- height: 100%;
- }
- .ui-content {
- padding: 0;
- }
- .ui-footer, .ui-header {
- text-align: center;
- padding: 5px 0;
- }
- #map {
- width: 100%;
- height: 100%;
- }
- .olControlAttribution {
- font-size: 10px;
- bottom: 5px;
- right: 5px;
- }
- #title, #tags, #shortdesc {
- display: none;
- }
- </style>
- <script>
- $(document).ready(function() {
- // fix height of content to allow for header & footer
- function fixContentHeight() {
- var header = $("div[data-role='header']:visible");
- var footer = $("div[data-role='footer']:visible");
- var content = $("div[data-role='content']:visible:visible");
- var viewHeight = $(window).height();
-
- var contentHeight = viewHeight - header.outerHeight() - footer.outerHeight();
- if ((content.outerHeight() + header.outerHeight() + footer.outerHeight()) !== viewHeight) {
- contentHeight -= (content.outerHeight() - content.height());
- content.height(contentHeight);
- }
- if (window.map) {
- map.updateSize();
- } else {
- // initialize map
- init();
- }
- }
- $(window).bind("orientationchange resize pageshow", fixContentHeight);
- fixContentHeight();
-
- // add behavior to navigation buttons
- $("#west").click(function() {
- pan(-0.25, 0);
- });
- $("#north").click(function() {
- pan(0, -0.25);
- });
- $("#south").click(function() {
- pan(0, 0.25);
- });
- $("#east").click(function() {
- pan(0.25, 0);
- });
-
- // add behavior to drawing controls
- function deactivateControls() {
- $.each(map.getControlsByClass(/DrawFeature/), function(index, control) {
- control.deactivate();
- });
- map.getControlsBy("id", "mod-control")[0].deactivate();
- }
- $("#nav, #point, #line, #poly, #mod").change(function(event) {
- deactivateControls();
- // jquery mobile bug regarding change makes us go through all inputs
- // https://github.com/jquery/jquery-mobile/issues/issue/1088
- var val = $("input:radio[name=controls]:checked").val();
- if (val !== "nav") {
- map.getControlsBy("id", val + "-control")[0].activate();
- }
- });
-
- $("#nav").click();
- $("#nav").click(); // jquery mobile bug forces 2 calls to refresh radio ui
-
- });
-
- </script>
+ <script src="mobile-jq.js"></script>
</head>
<body>
<h1 id="title">OpenLayers with jQuery Mobile</h1>
<div id="tags">
- mobile, jquery
+ mobile, jquery
</div>
<p id="shortdesc">
- Using jQuery Mobile to display an OpenLayers map.
+ Using jQuery Mobile to display an OpenLayers map.
</p>
- <div data-role="page">
- <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>
+ <div data-role="page" id="mappage">
+ <div data-role="content">
+ <div id="map"></div>
+ </div>
- <div data-role="footer">
- <form id="controls">
- <fieldset data-role="controlgroup" data-type="horizontal" data-role="fieldcontain">
- <input id="nav" type="radio" name="controls" value="nav" checked="checked">
- <label for="nav">navigate</label>
- <input id="point" type="radio" name="controls" value="point">
- <label for="point">point</label>
- <input id="line" type="radio" name="controls" value="line">
- <label for="line">line</label>
- <input id="poly" type="radio" name="controls" value="poly">
- <label for="poly">poly</label>
- <input id="mod" type="radio" name="controls" value="mod">
- <label for="mod">modify</label>
- </fieldset>
- </form>
+ <div data-role="footer">
+ <a href="#searchpage" data-icon="search" data-role="button">Search</a>
+ <a href="#" id="locate" data-icon="locate" data-role="button">Locate</a>
+ <a href="#layerspage" data-icon="layers" data-role="button">Layers</a>
+ </div>
+ <div id="navigation" data-role="controlgroup" data-type="vertical">
+ <a href="#" data-role="button" data-icon="plus" id="plus"
+ data-iconpos="notext"></a>
+ <a href="#" data-role="button" data-icon="minus" id="minus"
+ data-iconpos="notext"></a>
+ </div>
+ </div>
+
+ <div data-role="page" id="searchpage">
+ <div data-role="header">
+ <h1>Search</h1>
+ </div>
+ <div data-role="fieldcontain">
+ <input type="search" name="query" id="query"
+ value="" placeholder="Search for places"
+ autocomplete="off"/>
+ </div>
+ <ul data-role="listview" data-inset="true" id="search_results"></ul>
+ </div>
+
+ <div data-role="page" id="layerspage">
+ <div data-role="header">
+ <h1>Layers</h1>
+ </div>
+ <div data-role="content">
+ <ul data-role="listview" data-inset="true" data-theme="d" data-dividertheme="c" id="layerslist">
+ </div>
+ </div>
+
+ <div id="popup" data-role="dialog">
+ <div data-position="inline" data-theme="d" data-role="header">
+ <h1>Details</h1>
</div>
+ <div data-theme="c" data-role="content">
+ <ul id="details-list" data-role="listview">
+ </ul>
+ </div>
</div>
</body>
</html>
Copied: sandbox/cmoullet/openlayers/examples/mobile-jq.js (from rev 11520, trunk/openlayers/examples/mobile-jq.js)
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-jq.js (rev 0)
+++ sandbox/cmoullet/openlayers/examples/mobile-jq.js 2011-02-25 16:28:08 UTC (rev 11528)
@@ -0,0 +1,213 @@
+var selectedFeature = null;
+
+$(document).ready(function() {
+
+ // Start with the map page
+ if (window.location.hash && window.location.hash!='#mappage') {
+ $.mobile.changePage('mappage');
+ }
+
+ // fix height of content
+ function fixContentHeight() {
+ var footer = $("div[data-role='footer']:visible"),
+ content = $("div[data-role='content']:visible:visible"),
+ viewHeight = $(window).height(),
+ contentHeight = viewHeight - footer.outerHeight();
+
+ if ((content.outerHeight() + footer.outerHeight()) !== viewHeight) {
+ contentHeight -= (content.outerHeight() - content.height());
+ content.height(contentHeight);
+ }
+ if (window.map) {
+ map.updateSize();
+ } else {
+ // initialize map
+ init();
+ }
+ }
+ $(window).bind("orientationchange resize pageshow", fixContentHeight);
+ fixContentHeight();
+ //init();
+
+ // Map zoom
+ $("#plus").click(function(){
+ map.zoomIn();
+ });
+ $("#minus").click(function(){
+ map.zoomOut();
+ });
+ $("#locate").click(function(){
+ var control = map.getControlsBy("id", "locate-control")[0];
+ if (control.active) {
+ control.getCurrentLocation();
+ } else {
+ control.activate();
+ }
+ });
+
+ var sprintersLayer = new OpenLayers.Layer.Vector("Sprinters", {
+ styleMap: new OpenLayers.StyleMap({
+ externalGraphic : "img/mobile-loc.png",
+ graphicOpacity : 1.0,
+ graphicWith:16,
+ graphicHeight:26
+ })
+ });
+
+ var sprinters = getFeatures();
+ sprintersLayer.addFeatures(sprinters);
+
+ map.addLayer(sprintersLayer);
+
+ var selectControl = new OpenLayers.Control.SelectFeature(sprintersLayer, {onSelect: function(feature){
+ selectedFeature = feature;
+ $.mobile.changePage($("#popup"), "pop");
+ }});
+
+ map.addControl(selectControl);
+ selectControl.activate();
+
+ $('div#popup').live('pageshow',function(event, ui){
+ var li = "";
+ for(var attr in selectedFeature.attributes){
+ li += "<li><div style='width:25%;float:left'>" + attr + "</div><div style='width:75%;float:right'>"
+ + selectedFeature.attributes[attr] + "</div></li>";
+ }
+ $("ul#details-list").empty().append(li).listview("refresh");
+ });
+
+ $('#searchpage').live('pageshow',function(event, ui){
+ $('#query').bind('change', function(e){
+ $('#search_results').empty();
+ if ($('#query')[0].value === '') {
+ return;
+ }
+ $.mobile.pageLoading();
+
+ // Prevent form send
+ e.preventDefault();
+
+ var searchUrl = 'http://ws.geonames.org/searchJSON?featureClass=P&maxRows=10';
+ searchUrl += '&name_startsWith=' + $('#query')[0].value;
+ $.getJSON(searchUrl, function(data) {
+ $.each(data.geonames, function() {
+ var place = this;
+ $('<li>')
+ .hide()
+ .append($('<h2 />', {
+ text: place.name
+ }))
+ .append($('<p />', {
+ html: '<b>' + place.countryName + '</b> ' + place.fcodeName
+ }))
+ .appendTo('#search_results')
+ .click(function() {
+ $.mobile.changePage('mappage');
+ var lonlat = new OpenLayers.LonLat(place.lng, place.lat);
+ map.setCenter(lonlat.transform(gg, sm), 10);
+ })
+ .show();
+ });
+ $('#search_results').listview('refresh');
+ $.mobile.pageLoading(true);
+ });
+ });
+ // only listen to the first event triggered
+ $('#searchpage').die('pageshow', arguments.callee);
+ });
+
+ $('#layerslist').listview();
+ $('<li>', {
+ "data-role": "list-divider",
+ text: "Base Layers"
+ })
+ .appendTo('#layerslist');
+ var baseLayers = map.getLayersBy("isBaseLayer", true);
+ $.each(baseLayers, function() {
+ addLayerToList(this);
+ });
+
+ $('<li>', {
+ "data-role": "list-divider",
+ text: "Overlay Layers"
+ })
+ .appendTo('#layerslist');
+ var overlayLayers = map.getLayersBy("isBaseLayer", false);
+ $.each(overlayLayers, function() {
+ addLayerToList(this);
+ });
+ $('#layerslist').listview('refresh');
+
+ map.events.register("addlayer", this, function(e) {
+ addLayerToList(e.layer);
+ });
+});
+
+function addLayerToList(layer) {
+ var item = $('<li>', {
+ "data-icon": "check",
+ "class": layer.visibility ? "checked" : ""
+ })
+ .append($('<a />', {
+ text: layer.name
+ })
+ .click(function() {
+ $.mobile.changePage('mappage');
+ if (layer.isBaseLayer) {
+ layer.map.setBaseLayer(layer);
+ } else {
+ layer.setVisibility(!layer.getVisibility());
+ }
+ })
+ )
+ .appendTo('#layerslist');
+ layer.events.on({
+ 'visibilitychanged': function() {
+ $(item).toggleClass('checked');
+ }
+ });
+}
+
+function getFeatures(){
+ var features = {
+ "type": "FeatureCollection",
+ "features": [
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [1332700, 7906300]},
+ "properties": {"Name": "Igor Tihonov", "Country":"Sweden", "City":"Gothenburg"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [790300, 6573900]},
+ "properties": {"Name": "Marc Jansen", "Country":"Germany", "City":"Bonn"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [568600, 6817300]},
+ "properties": {"Name": "Bart van den Eijnden", "Country":"Netherlands", "City":"Utrecht"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [-7909900, 5215100]},
+ "properties": {"Name": "Christopher Schmidt", "Country":"United States of America", "City":"Boston"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [-937400, 5093200]},
+ "properties": {"Name": "Jorge Gustavo Rocha", "Country":"Portugal", "City":"Braga"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [-355300, 7547800]},
+ "properties": {"Name": "Jennie Fletcher ", "Country":"Scotland", "City":"Edinburgh"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [657068.53608487, 5712321.2472725]},
+ "properties": {"Name": "Bruno Binet ", "Country":"France", "City":"Chambéry"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [667250.8958124, 5668048.6072737]},
+ "properties": {"Name": "Eric Lemoine", "Country":"France", "City":"Theys"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [653518.03606319, 5721118.5122914]},
+ "properties": {"Name": "Antoine Abt", "Country":"France", "City":"La Motte Servolex"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [657985.78042416, 5711862.6251028]},
+ "properties": {"Name": "Pierre Giraud", "Country":"France", "City":"Chambéry"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [742941.93818208, 5861818.9477535]},
+ "properties": {"Name": "Stéphane Brunner", "Country":"Switzerland", "City":"Paudex"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [736082.61064069, 5908165.4649505]},
+ "properties": {"Name": "Frédéric Junod", "Country":"Switzerland", "City":"Montagny"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [771595.97057525, 5912284.7041793]},
+ "properties": {"Name": "Cédric Moullet", "Country":"Switzerland", "City":"Payerne"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [744205.23922364, 5861277.319748]},
+ "properties": {"Name": "Benoit Quartier", "Country":"Switzerland", "City":"Lutry"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [1717430.147101, 5954568.7127565]},
+ "properties": {"Name": "Andreas Hocevar", "Country":"Austria", "City":"Graz"}},
+ { "type": "Feature", "geometry": {"type": "Point", "coordinates": [-12362007.067301,5729082.2365672]},
+ "properties": {"Name": "Tim Schaub", "Country":"United States of America", "City":"Bozeman"}}
+ ]
+ };
+
+ var reader = new OpenLayers.Format.GeoJSON();
+
+ return reader.read(features);
+}
Modified: sandbox/cmoullet/openlayers/examples/mobile-navigation.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-navigation.js 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/examples/mobile-navigation.js 2011-02-25 16:28:08 UTC (rev 11528)
@@ -14,7 +14,7 @@
controls: [
new OpenLayers.Control.TouchNavigation({
dragPanOptions: {
- interval: 0, // non-zero kills performance on some mobile phones
+ interval: 100,
enableKinetic: true
}
}),
Modified: sandbox/cmoullet/openlayers/examples/mobile.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile.js 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/examples/mobile.js 2011-02-25 16:28:08 UTC (rev 11528)
@@ -23,7 +23,7 @@
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.TouchNavigation({
dragPanOptions: {
- interval: 0, // non-zero kills performance on some mobile phones
+ interval: 100,
enableKinetic: true
}
}),
Modified: sandbox/cmoullet/openlayers/examples/spherical-mercator.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/spherical-mercator.html 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/examples/spherical-mercator.html 2011-02-25 16:28:08 UTC (rev 11528)
@@ -24,107 +24,111 @@
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
- // make map available for easy debugging
- var map;
+// make map available for easy debugging
+var map;
- // increase reload attempts
- OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
+// increase reload attempts
+OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
- function init(){
- var options = {
- projection: new OpenLayers.Projection("EPSG:900913"),
- displayProjection: new OpenLayers.Projection("EPSG:4326"),
- units: "m",
- numZoomLevels: 18,
- maxResolution: 156543.0339,
- maxExtent: new OpenLayers.Bounds(-20037508, -20037508,
- 20037508, 20037508.34)
- };
- map = new OpenLayers.Map('map', options);
+function init(){
+ var maxExtent = new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508),
+ restrictedExtent = maxExtent.clone(-20037508, -20037508, 20037508, 20037508),
+ maxResolution = 156543.0339;
+
+ var options = {
+ projection: new OpenLayers.Projection("EPSG:900913"),
+ displayProjection: new OpenLayers.Projection("EPSG:4326"),
+ units: "m",
+ numZoomLevels: 18,
+ maxResolution: maxResolution,
+ maxExtent: maxExtent,
+ restrictedExtent: restrictedExtent
+ };
+ map = new OpenLayers.Map('map', options);
- // create Google Mercator layers
- var gmap = new OpenLayers.Layer.Google(
- "Google Streets",
- {'sphericalMercator': true}
- );
- var gsat = new OpenLayers.Layer.Google(
- "Google Satellite",
- {type: G_SATELLITE_MAP, 'sphericalMercator': true, numZoomLevels: 22}
- );
- var ghyb = new OpenLayers.Layer.Google(
- "Google Hybrid",
- {type: G_HYBRID_MAP, 'sphericalMercator': true}
- );
+ // create Google Mercator layers
+ var gmap = new OpenLayers.Layer.Google(
+ "Google Streets",
+ {sphericalMercator: true}
+ );
+ var gsat = new OpenLayers.Layer.Google(
+ "Google Satellite",
+ {type: G_SATELLITE_MAP, sphericalMercator: true, numZoomLevels: 22}
+ );
+ var ghyb = new OpenLayers.Layer.Google(
+ "Google Hybrid",
+ {type: G_HYBRID_MAP, sphericalMercator: true}
+ );
- // create Virtual Earth layers
- var veroad = new OpenLayers.Layer.VirtualEarth(
- "Virtual Earth Roads",
- {'type': VEMapStyle.Road, 'sphericalMercator': true}
- );
- var veaer = new OpenLayers.Layer.VirtualEarth(
- "Virtual Earth Aerial",
- {'type': VEMapStyle.Aerial, 'sphericalMercator': true}
- );
- var vehyb = new OpenLayers.Layer.VirtualEarth(
- "Virtual Earth Hybrid",
- {'type': VEMapStyle.Hybrid, 'sphericalMercator': true}
- );
+ // create Virtual Earth layers
+ var veroad = new OpenLayers.Layer.VirtualEarth(
+ "Virtual Earth Roads",
+ {'type': VEMapStyle.Road, sphericalMercator: true}
+ );
+ var veaer = new OpenLayers.Layer.VirtualEarth(
+ "Virtual Earth Aerial",
+ {'type': VEMapStyle.Aerial, sphericalMercator: true}
+ );
+ var vehyb = new OpenLayers.Layer.VirtualEarth(
+ "Virtual Earth Hybrid",
+ {'type': VEMapStyle.Hybrid, sphericalMercator: true}
+ );
- // create Yahoo layer
- var yahoo = new OpenLayers.Layer.Yahoo(
- "Yahoo Street",
- {'sphericalMercator': true}
- );
- var yahoosat = new OpenLayers.Layer.Yahoo(
- "Yahoo Satellite",
- {'type': YAHOO_MAP_SAT, 'sphericalMercator': true}
- );
- var yahoohyb = new OpenLayers.Layer.Yahoo(
- "Yahoo Hybrid",
- {'type': YAHOO_MAP_HYB, 'sphericalMercator': true}
- );
+ // create Yahoo layer
+ var yahoo = new OpenLayers.Layer.Yahoo(
+ "Yahoo Street",
+ {sphericalMercator: true}
+ );
+ var yahoosat = new OpenLayers.Layer.Yahoo(
+ "Yahoo Satellite",
+ {'type': YAHOO_MAP_SAT, sphericalMercator: true}
+ );
+ var yahoohyb = new OpenLayers.Layer.Yahoo(
+ "Yahoo Hybrid",
+ {'type': YAHOO_MAP_HYB, sphericalMercator: true}
+ );
- // create OSM layer
- var mapnik = new OpenLayers.Layer.OSM();
- // create OAM layer
- var oam = new OpenLayers.Layer.XYZ(
- "OpenAerialMap",
- "http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/${z}/${x}/${y}.png",
- {
- sphericalMercator: true
- }
- );
+ // create OSM layer
+ var mapnik = new OpenLayers.Layer.OSM();
+ // create OAM layer
+ var oam = new OpenLayers.Layer.XYZ(
+ "OpenAerialMap",
+ "http://tile.openaerialmap.org/tiles/1.0.0/openaerialmap-900913/${z}/${x}/${y}.png",
+ {
+ sphericalMercator: true
+ }
+ );
- // create OSM layer
- var osmarender = new OpenLayers.Layer.OSM(
- "OpenStreetMap (Tiles at Home)",
- "http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"
- );
+ // create OSM layer
+ var osmarender = new OpenLayers.Layer.OSM(
+ "OpenStreetMap (Tiles at Home)",
+ "http://tah.openstreetmap.org/Tiles/tile/${z}/${x}/${y}.png"
+ );
- // create WMS layer
- var wms = new OpenLayers.Layer.WMS(
- "World Map",
- "http://world.freemap.in/tiles/",
- {'layers': 'factbook-overlay', 'format':'png'},
- {
- 'opacity': 0.4, visibility: false,
- 'isBaseLayer': false,'wrapDateLine': true
- }
- );
+ // create WMS layer
+ var wms = new OpenLayers.Layer.WMS(
+ "World Map",
+ "http://world.freemap.in/tiles/",
+ {'layers': 'factbook-overlay', 'format':'png'},
+ {
+ 'opacity': 0.4, visibility: false,
+ 'isBaseLayer': false,'wrapDateLine': true
+ }
+ );
- // create a vector layer for drawing
- var vector = new OpenLayers.Layer.Vector("Editable Vectors");
+ // create a vector layer for drawing
+ var vector = new OpenLayers.Layer.Vector("Editable Vectors");
- map.addLayers([gmap, gsat, ghyb, veroad, veaer, vehyb,
- yahoo, yahoosat, yahoohyb, oam, mapnik, osmarender,
- wms, vector]);
- map.addControl(new OpenLayers.Control.LayerSwitcher());
- map.addControl(new OpenLayers.Control.EditingToolbar(vector));
- map.addControl(new OpenLayers.Control.Permalink());
- map.addControl(new OpenLayers.Control.MousePosition());
- if (!map.getCenter()) {map.zoomToMaxExtent()}
- }
+ map.addLayers([gmap, gsat, ghyb, veroad, veaer, vehyb,
+ yahoo, yahoosat, yahoohyb, oam, mapnik, osmarender,
+ wms, vector]);
+ map.addControl(new OpenLayers.Control.LayerSwitcher());
+ map.addControl(new OpenLayers.Control.EditingToolbar(vector));
+ map.addControl(new OpenLayers.Control.Permalink());
+ map.addControl(new OpenLayers.Control.MousePosition());
+ if (!map.getCenter()) {map.zoomToMaxExtent()}
+}
</script>
</head>
Copied: sandbox/cmoullet/openlayers/examples/style.mobile-jq.css (from rev 11520, trunk/openlayers/examples/style.mobile-jq.css)
===================================================================
--- sandbox/cmoullet/openlayers/examples/style.mobile-jq.css (rev 0)
+++ sandbox/cmoullet/openlayers/examples/style.mobile-jq.css 2011-02-25 16:28:08 UTC (rev 11528)
@@ -0,0 +1,120 @@
+html ,
+body {
+ margin: 0;
+ padding: 0;
+ height: 100%;
+}
+.ui-content {
+ padding: 0;
+}
+.ui-footer {
+ text-align: center;
+ padding: 5px 0;
+}
+.portrait, .portrait #mappage {
+ min-height: 0;
+}
+/*.portrait, .portrait .ui-page{*/
+ /*min-height: 0;*/
+/*}*/
+#mappage, #mappage .ui-content, #map {
+ width: 100%;
+ height: 100%;
+}
+.olControlAttribution {
+ font-size: 10px;
+ bottom: 5px;
+ right: 5px;
+}
+#navigation {
+ position: absolute;
+ bottom: 70px;
+ left: 10px;
+ z-index: 1000;
+}
+#navigation .ui-btn-icon-notext {
+ display: block;
+ padding: 7px 6px 7px 8px;
+}
+#title, #tags, #shortdesc {
+ display: none;
+}
+.ui-icon-check {
+ opacity: 0.3;
+}
+.checked .ui-icon-check {
+ opacity: 1;
+}
+.ui-icon-locate {
+ background-image: url(img/locate.png);
+}
+.ui-icon-layers {
+ background-image: url(img/openlayers.png);
+}
+.ui-content .ui-listview-inset, #search_results {
+ margin: 1em;
+}
+.ui-content .ui-listview {
+ margin: 0px;
+}
+#details-list li{
+ padding:15px 10px;
+}
+html {
+ height: 100%;
+}
+body {
+ margin: 0;
+ padding: 0;
+ height: 100%;
+}
+.ui-content {
+ padding: 0;
+}
+.ui-footer {
+ text-align: center;
+ padding: 5px 0;
+}
+#map {
+ width: 100%;
+ height: 100%;
+}
+.olControlAttribution {
+ font-size: 10px;
+ bottom: 5px;
+ right: 5px;
+}
+#navigation {
+ position: absolute;
+ bottom: 70px;
+ left: 10px;
+ z-index: 1000;
+}
+#navigation .ui-btn-icon-notext {
+ display: block;
+ padding: 7px 6px 7px 8px;
+}
+#title, #tags, #shortdesc {
+ display: none;
+}
+.ui-icon-check {
+ opacity: 0.3;
+}
+.checked .ui-icon-check {
+ opacity: 1;
+}
+.ui-icon-locate {
+ background-image: url(img/locate.png);
+}
+.ui-icon-layers {
+ background-image: url(img/openlayers.png);
+}
+.ui-content .ui-listview-inset, #search_results {
+ margin: 1em;
+}
+.ui-content .ui-listview {
+ margin: 0px;
+}
+#details-list li{
+ padding:15px 10px;
+}
\ No newline at end of file
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Click.js 2011-02-25 16:28:08 UTC (rev 11528)
@@ -85,24 +85,23 @@
/**
* Property: down
- * {<OpenLayers.Pixel>} The pixel location of the last mousedown.
+ * {Object} Object that store relevant information about the last
+ * mousedown or touchstart. Its 'xy' OpenLayers.Pixel property gives
+ * the average location of the mouse/touch event. Its 'touches'
+ * property records clientX/clientY of each touches.
*/
down: null,
/**
* Property: last
- * {<OpenLayers.Pixel>} The pixel for the last touchmove. This is
- * used to
+ * {Object} Object that store relevant information about the last
+ * touchmove. Its 'xy' OpenLayers.Pixel property gives
+ * the average location of the mouse/touch event. Its 'touches'
+ * property records clientX/clientY of each touches.
*/
last: null,
/**
- * Property: touch
- * {Boolean} Are we on a touch enabled device? Default is false.
- */
- touch: false,
-
- /**
* Property: rightclickTimerId
* {Number} The id of the right mouse timeout waiting to clear the
* <delayedEvent>.
@@ -130,7 +129,7 @@
// optionally register for mouseup and mousedown
if(this.pixelTolerance != null) {
this.mousedown = function(evt) {
- this.down = evt;
+ this.down = this.getEventInfo(evt);
return true;
};
}
@@ -154,8 +153,7 @@
* {Boolean} Continue propagating this event.
*/
touchstart: function(evt) {
- this.touch = true;
- this.down = evt;
+ this.down = this.getEventInfo(evt);
this.last = null;
return true;
},
@@ -244,8 +242,9 @@
dblclick: function(evt) {
// for touch devices trigger dblclick only for
// "one finger" touch
- if(this.passesTolerance(evt) &&
- (!evt.lastTouches || evt.lastTouches.length == 1)) {
+ var last = this.down || this.last;
+ if (this.passesTolerance(evt) &&
+ (!last || !last.touches || last.touches.length == 1)) {
if(this["double"]) {
this.callback('dblclick', [evt]);
}
@@ -260,7 +259,7 @@
* an empty "touches" property.
*/
touchmove: function(evt) {
- this.last = evt;
+ this.last = this.getEventInfo(evt);
},
/**
@@ -287,13 +286,14 @@
*/
click: function(evt) {
// Sencha Touch emulates click events, see ticket 3079 for more info
- if (this.touch === true && evt.type === "click") {
+ if (this.down && this.down.touches && evt.type === "click") {
return !this.stopSingle;
}
if(this.passesTolerance(evt)) {
if(this.timerId != null) {
// already received a click
- if(evt.lastTouches) {
+ var last = this.down || this.last;
+ if (last && last.touches && last.touches.length > 0) {
// touch device - we may trigger dblclick
this.dblclick(evt);
} else {
@@ -367,6 +367,35 @@
},
/**
+ * Method: getEventInfo
+ * This method allows us to store event information without storing the
+ * actual event. In touch devices (at least), the same event is
+ * modified between touchstart, touchmove, and touchend.
+ *
+ * Returns:
+ * {Object} An object with event related info.
+ */
+ getEventInfo: function(evt) {
+ var touches;
+ if (evt.touches) {
+ var len = evt.touches.length;
+ touches = new Array(len);
+ var touch;
+ for (var i=0; i<len; i++) {
+ touch = evt.touches[i];
+ touches[i] = {
+ clientX: touch.clientX,
+ clientY: touch.clientY
+ };
+ }
+ }
+ return {
+ xy: evt.xy,
+ touches: touches
+ };
+ },
+
+ /**
* APIMethod: deactivate
* Deactivate the handler.
*
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Feature.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Feature.js 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Feature.js 2011-02-25 16:28:08 UTC (rev 11528)
@@ -29,7 +29,8 @@
'mousemove': {'in': 'over', 'out': 'out'},
'dblclick': {'in': 'dblclick', 'out': null},
'mousedown': {'in': null, 'out': null},
- 'mouseup': {'in': null, 'out': null}
+ 'mouseup': {'in': null, 'out': null},
+ 'touchstart': {'in': 'click', 'out': 'clickout'}
},
/**
@@ -117,6 +118,19 @@
this.layer = layer;
},
+ /**
+ * Method: touchstart
+ * Handle touchmove events
+ *
+ * Parameters:
+ * evt - {Event}
+ *
+ * Returns:
+ * {Boolean} Let the event propagate.
+ */
+ touchstart: function(evt) {
+ return this.mousedown(evt);
+ },
/**
* Method: mousedown
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/VirtualEarth.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/VirtualEarth.js 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/VirtualEarth.js 2011-02-25 16:28:08 UTC (rev 11528)
@@ -13,7 +13,11 @@
/**
* Class: OpenLayers.Layer.VirtualEarth
- *
+ * Instances of OpenLayers.Layer.VirtualEarth are used to display the data from
+ * the Bing Maps AJAX Control (see e.g.
+ * http://msdn.microsoft.com/library/bb429619.aspx). Create a VirtualEarth
+ * layer with the <OpenLayers.Layer.VirtualEarth> constructor.
+ *
* Inherits from:
* - <OpenLayers.Layer.EventPane>
* - <OpenLayers.Layer.FixedZoomLevels>
@@ -94,7 +98,23 @@
/**
* Constructor: OpenLayers.Layer.VirtualEarth
+ * Creates a new instance of a OpenLayers.Layer.VirtualEarth. If you use an
+ * instance of OpenLayers.Layer.VirtualEarth in you map, you should set
+ * the <OpenLayers.Map> option restrictedExtent to a meaningful value,
+ * e.g.:
+ * (code)
+ * var map = new OpenLayers.Map( 'map', {
+ * // other map options
+ * restrictedExtent : OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508)
+ * } );
*
+ * var veLayer = new OpenLayers.Layer.VirtualEarth (
+ * "Virtual Earth Layer"
+ * );
+ *
+ * map.addLayer( veLayer );
+ * (end)
+ *
* Parameters:
* name - {String}
* options - {Object}
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer.js 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer.js 2011-02-25 16:28:08 UTC (rev 11528)
@@ -815,13 +815,13 @@
// map
// 7. hope for the best!
- var i, len;
+ var i, len, p;
var props = {}, alwaysInRange = true;
// get resolution data from layer config
// (we also set alwaysInRange in the layer as appropriate)
for(i=0, len=this.RESOLUTION_PROPERTIES.length; i<len; i++) {
- var p = this.RESOLUTION_PROPERTIES[i];
+ p = this.RESOLUTION_PROPERTIES[i];
props[p] = this.options[p];
if(alwaysInRange && this.options[p]) {
alwaysInRange = false;
@@ -845,7 +845,7 @@
// in the map
if(props.resolutions == null) {
for(i=0, len=this.RESOLUTION_PROPERTIES.length; i<len; i++) {
- var p = this.RESOLUTION_PROPERTIES[i];
+ p = this.RESOLUTION_PROPERTIES[i];
props[p] = this.options[p] != null ?
this.options[p] : this.map[p];
}
@@ -960,6 +960,8 @@
*/
calculateResolutions: function(props) {
+ var viewSize, wRes, hRes;
+
// determine maxResolution
var maxResolution = props.maxResolution;
if(props.minScale != null) {
@@ -967,9 +969,9 @@
OpenLayers.Util.getResolutionFromScale(props.minScale,
this.units);
} else if(maxResolution == "auto" && this.maxExtent != null) {
- var viewSize = this.map.getSize();
- var wRes = this.maxExtent.getWidth() / viewSize.w;
- var hRes = this.maxExtent.getHeight() / viewSize.h;
+ viewSize = this.map.getSize();
+ wRes = this.maxExtent.getWidth() / viewSize.w;
+ hRes = this.maxExtent.getHeight() / viewSize.h;
maxResolution = Math.max(wRes, hRes);
}
@@ -980,9 +982,9 @@
OpenLayers.Util.getResolutionFromScale(props.maxScale,
this.units);
} else if(props.minResolution == "auto" && this.minExtent != null) {
- var viewSize = this.map.getSize();
- var wRes = this.minExtent.getWidth() / viewSize.w;
- var hRes = this.minExtent.getHeight()/ viewSize.h;
+ viewSize = this.map.getSize();
+ wRes = this.minExtent.getWidth() / viewSize.w;
+ hRes = this.minExtent.getHeight()/ viewSize.h;
minResolution = Math.max(wRes, hRes);
}
@@ -1141,14 +1143,14 @@
* value and the 'closest' specification.
*/
getZoomForResolution: function(resolution, closest) {
- var zoom;
+ var zoom, i, len;
if(this.map.fractionalZoom) {
var lowZoom = 0;
var highZoom = this.resolutions.length - 1;
var highRes = this.resolutions[lowZoom];
var lowRes = this.resolutions[highZoom];
var res;
- for(var i=0, len=this.resolutions.length; i<len; ++i) {
+ for(i=0, len=this.resolutions.length; i<len; ++i) {
res = this.resolutions[i];
if(res >= resolution) {
highRes = res;
@@ -1169,7 +1171,7 @@
} else {
var diff;
var minDiff = Number.POSITIVE_INFINITY;
- for(var i=0, len=this.resolutions.length; i<len; i++) {
+ for(i=0, len=this.resolutions.length; i<len; i++) {
if (closest) {
diff = Math.abs(this.resolutions[i] - resolution);
if (diff > minDiff) {
Modified: sandbox/cmoullet/openlayers/tests/Control/Geolocate.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/Geolocate.html 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/tests/Control/Geolocate.html 2011-02-25 16:28:08 UTC (rev 11528)
@@ -1,6 +1,6 @@
<html>
<head>
- <script src="../../lib/OpenLayers.js"></script>
+ <script src="../OLLoader.js"></script>
<script type="text/javascript">
var map, control, centerLL
watch = null,
Modified: sandbox/cmoullet/openlayers/tests/Handler/Click.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Click.html 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/tests/Handler/Click.html 2011-02-25 16:28:08 UTC (rev 11528)
@@ -316,14 +316,14 @@
log = null;
handler.touchstart({xy: {x: 1, y: 1}, touches: ["foo"]});
- handler.touchend({});
+ handler.touchend({touches: ["foo"]});
t.delay_call(1, function() {
t.ok(log != null, "click callback called");
if(log != null) {
t.eq(log.x, 1, "evt.xy.x as expected");
t.eq(log.y, 1, "evt.xy.y as expected");
- t.eq(log.lastTouches, ["foo"], "evt.lastTouches as expected");
+ t.ok(log.lastTouches, "evt.lastTouches as expected");
}
// tear down
map.destroy();
@@ -359,7 +359,7 @@
handler.touchstart({xy: {x: 1, y: 1}, touches: ["foo"]});
handler.touchend({type: "click"});
- t.eq(handler.touch, true, "Touch property should be true");
+ t.eq(!!handler.down.touches, true, "Handler down touches property should be truthy");
t.ok(log.dblclick == undefined, "dblclick callback not called with simulated click");
@@ -395,9 +395,9 @@
// test
log = {};
- handler.touchstart({xy: {x: 1, y: 1}, touches: ["foo"]});
+ handler.touchstart({xy: {x: 1, y: 1}, touches: [{clientX:0, clientY:10}]});
handler.touchend({});
- handler.touchstart({xy: {x: 1, y: 1}, touches: ["foo"]});
+ handler.touchstart({xy: {x: 1, y: 1}, touches: [{clientX:0, clientY:10}]});
handler.touchend({});
t.eq(log.click, undefined, "click callback not called");
@@ -405,7 +405,7 @@
if(log.dblclick != undefined) {
t.eq(log.dblclick.x, 1, "evt.xy.x as expected");
t.eq(log.dblclick.y, 1, "evt.xy.y as expected");
- t.eq(log.dblclick.lastTouches, ["foo"], "evt.lastTouches as expected");
+ t.ok(log.dblclick.lastTouches, "evt.lastTouches on evt");
}
// tear down
Modified: sandbox/cmoullet/openlayers/tests/Handler/Feature.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Feature.html 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/tests/Handler/Feature.html 2011-02-25 16:28:08 UTC (rev 11528)
@@ -53,7 +53,7 @@
}
function test_events(t) {
- t.plan(25);
+ t.plan(30);
var map = new OpenLayers.Map('map');
var control = new OpenLayers.Control();
@@ -64,7 +64,7 @@
// list below events that should be handled (events) and those
// that should not be handled (nonevents) by the handler
- var events = ["mousedown", "mouseup", "mousemove", "click", "dblclick"];
+ var events = ["mousedown", "mouseup", "mousemove", "click", "dblclick", "touchstart"];
var nonevents = ["mouseout", "resize", "focus", "blur"];
map.events.registerPriority = function(type, obj, func) {
var output = func();
@@ -123,7 +123,7 @@
}
function test_callbacks(t) {
- t.plan(9);
+ t.plan(13);
var map = new OpenLayers.Map('map', {controls: []});
var control = new OpenLayers.Control();
@@ -223,6 +223,36 @@
callbacks['dblclick'] = getCallback('dblclick', newFeature);
evtPx.type = "dblclick";
map.events.triggerEvent('dblclick', evtPx);
+
+ // test touchstart on a feature
+ // 'click' callback should be called
+ handler.feature = null;
+ lastFeature = null;
+ newFeature = new OpenLayers.Feature.Vector();
+ newFeature.layer = layer;
+ callbacks['click'] = getCallback('click (touch)', newFeature);
+ callbacks['clickout'] = getCallback('clickout (touch)', lastFeature);
+ evtPx.type = "touchstart";
+ map.events.triggerEvent('touchstart', evtPx);
+
+ // test touchstart in new feature and out of last feature
+ // both 'click' and 'clickout' callbacks should be called
+ lastFeature = newFeature;
+ newFeature = new OpenLayers.Feature.Vector();
+ newFeature.layer = layer;
+ callbacks['click'] = getCallback('click (touch)', newFeature);
+ callbacks['clickout'] = getCallback('clickout (touch)', lastFeature);
+ evtPx.type = "touchstart";
+ map.events.triggerEvent('touchstart', evtPx);
+
+ // test touchstart out of last feature
+ // only 'clickout' callback should be called
+ lastFeature = newFeature;
+ newFeature = null;
+ callbacks['click'] = getCallback('click (touch)', newFeature);
+ callbacks['clickout'] = getCallback('clickout (touch)', lastFeature);
+ evtPx.type = "touchstart";
+ map.events.triggerEvent('touchstart', evtPx);
}
function test_deactivate(t) {
Modified: sandbox/cmoullet/openlayers/tools/release.sh
===================================================================
--- sandbox/cmoullet/openlayers/tools/release.sh 2011-02-25 16:22:17 UTC (rev 11527)
+++ sandbox/cmoullet/openlayers/tools/release.sh 2011-02-25 16:28:08 UTC (rev 11528)
@@ -13,7 +13,9 @@
rm ../tools/closure-compiler.jar
cd ..
-
+cd tools
+python exampleparser.py
+cd ..
for i in google ie6-style style; do
csstidy theme/default/$i.css --template=highest theme/default/$i.tidy.css
done
More information about the Commits
mailing list