diff --git a/tnm/client/static/images/ledlightblue_16px.png b/tnm/client/static/images/ledlightblue_16px.png new file mode 100644 index 0000000..8e346fc Binary files /dev/null and b/tnm/client/static/images/ledlightblue_16px.png differ diff --git a/tnm/client/static/images/ledlightblue_48px.png b/tnm/client/static/images/ledlightblue_48px.png new file mode 100644 index 0000000..ed0dd26 Binary files /dev/null and b/tnm/client/static/images/ledlightblue_48px.png differ diff --git a/tnm/client/static/tnm.js b/tnm/client/static/tnm.js index 3ade0fc..b33b611 100644 --- a/tnm/client/static/tnm.js +++ b/tnm/client/static/tnm.js @@ -135,7 +135,11 @@ $(function() { var geolocate = function() { Transit.tryGeolocating( - function(latlng) { map.center(latlng); }, + function(latlng) { + Transit.current.set = true; + Transit.current.location = latlng; + map.center(latlng); + }, function(error) { map.center(); }); } diff --git a/tnm/client/static/transit.js b/tnm/client/static/transit.js index 33cdbfa..195de66 100644 --- a/tnm/client/static/transit.js +++ b/tnm/client/static/transit.js @@ -398,6 +398,15 @@ Transit._leafletMap.prototype.overlay = function(overlayID, overlay) { stop.layer = stop_marker; layers.addLayer(stop_marker); } + + // Build current location marker + if (Transit.current && Transit.current.set) { + var icon = new Transit._leafletMap.CurrentIcon(), + current_marker = new L.Marker(Transit.current.location, {icon : icon}), + popup_content = '


Current
location

'; + current_marker.bindPopup(popup_content); + layers.addLayer(current_marker); + } oldLayer && this.map.removeLayer(oldLayer); this.layers[overlayID] = layers; @@ -405,6 +414,10 @@ Transit._leafletMap.prototype.overlay = function(overlayID, overlay) { this.map.addLayer(layers); } +Transit.current = new Object(); +Transit.current.set = false; +Transit.current.location = new L.LatLng(0, 0); + Transit._leafletMap.prototype.radius = function(latlng, radius_m) { var radius = this.layers['radius']; if (radius) { @@ -427,3 +440,11 @@ Transit._leafletMap.TransitIcon = L.Icon.extend({ iconAnchor: new L.Point(13, 13), popupAnchor: new L.Point(0, 0) }); + +Transit._leafletMap.CurrentIcon = L.Icon.extend({ + iconUrl: '/static/images/ledlightblue_16px.png', + shadowUrl: '', + iconSize: new L.Point(16, 16), + iconAnchor: new L.Point(13, 13), + popupAnchor: new L.Point(0, 0) +});