Author: kake Date: 2012-05-11 12:39:06 +0100 (Fri, 11 May 2012) New Revision: 1399
Modified: trunk/static/map-leaflet.js Log: Make sure map is centred and zoomed properly when there's only one point on it.
Modified: trunk/static/map-leaflet.js =================================================================== --- trunk/static/map-leaflet.js 2012-05-07 14:15:42 UTC (rev 1398) +++ trunk/static/map-leaflet.js 2012-05-11 11:39:06 UTC (rev 1399) @@ -27,10 +27,12 @@ layers: [ osm_layer ], } );
- if ( min_lat ) { + if ( min_lat && ( min_lat != max_lat ) ) { var bounds = new L.LatLngBounds( new L.LatLng( min_lat, min_long ), new L.LatLng( max_lat, max_long ) ); map.fitBounds( bounds ); + } else if ( min_lat == max_lat ) { + map.setView( new L.LatLng( min_lat, min_long ), 18 ); } else { map.setView( map_centre, 13 ); }
openguides-commits@lists.openguides.org