From 72a1070e87286a71bbde14b17a37de622822052c Mon Sep 17 00:00:00 2001 From: Mourner Date: Thu, 19 May 2011 15:27:59 +0300 Subject: [PATCH] Improved geolocation error handling, explicit timeout, fixes #61 --- CHANGELOG.md | 6 ++++-- debug/map/map-mobile.html | 7 ++++++- dist/leaflet.js | 4 ++-- src/map/ext/Map.Geolocation.js | 21 +++++++++++++++++---- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 10c8ef76..93f634bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,12 @@ Leaflet Changelog ================= ## 0.2 (master) - - * Added WMS support (L.TileLayer.WMS), currently EPSG:3857 only ([#50](https://github.com/CloudMade/Leaflet/issues/50)). + + * Added **WMS support** (L.TileLayer.WMS), currently EPSG:3857 only ([#50](https://github.com/CloudMade/Leaflet/issues/50)). + * Added `maxZoom` argument to `map.locateAndSetView` method * Disabled zoom animation on Android by default because it's buggy on some devices (will be enabled back when it's stable enough) ([#32](https://github.com/CloudMade/Leaflet/issues/32)). * Fixed a bug where zooming is broken if the map contains a polygon and you zoom to an area where it's not visible ([#47](https://github.com/CloudMade/Leaflet/issues/47)). + * Improved geolocation error handling, explicit timeout. ([#61](https://github.com/CloudMade/Leaflet/issues/61)) * Fixed a bug where map isn't displayed in Firefox when there's an `img { max-width: 100% }` rule. ## 0.1 (2011-05-13) diff --git a/debug/map/map-mobile.html b/debug/map/map-mobile.html index 9d9db626..135ec142 100644 --- a/debug/map/map-mobile.html +++ b/debug/map/map-mobile.html @@ -22,7 +22,7 @@ cloudmadeAttribution = 'Map data © 2011 OpenStreetMap contributors, Imagery © 2011 CloudMade', cloudmade = new L.TileLayer(cloudmadeUrl, {maxZoom: 18, attribution: cloudmadeAttribution}); - var map = new L.Map('map').addLayer(cloudmade).setView(new L.LatLng(50.5, 30.51), 15); + var map = new L.Map('map').addLayer(cloudmade); map.on('locationfound', function(e) { var marker = new L.Marker(e.latlng); @@ -31,6 +31,11 @@ marker.bindPopup("

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.

Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis.

"); }); + map.on('locationerror', function(e) { + alert(e.message); + map.fitWorld(); + }); + map.locateAndSetView(); diff --git a/dist/leaflet.js b/dist/leaflet.js index 29fb36db..79fc9313 100644 --- a/dist/leaflet.js +++ b/dist/leaflet.js @@ -86,8 +86,8 @@ a,b||this._objectsPane)},_resetView:function(a,b,c){var d=this._zoom!=b;this.fir {};for(var b=0,c=a.length;b