Changeset c6219ed in OpenWorkouts-current for ow/static/js/ow.js
- Timestamp:
- Jan 22, 2019, 12:21:51 AM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- 26220ba, 2d2eb0d
- Parents:
- 02048a6 (diff), be40b02 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/static/js/ow.js
r02048a6 rc6219ed 16 16 17 17 // parameters provided when creating an "instance" of a map 18 var map_id = spec.map_id; 18 19 var latitude = spec.latitude; 19 20 var longitude = spec.longitude; … … 23 24 var end_icon = spec.end_icon; 24 25 var shadow = spec.shadow; 26 var elevation = spec.elevation; 27 var zoom_control = spec.zoom_control; 25 28 26 29 // OpenStreetMap urls and references 27 var openstreetmap_url = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' 28 var openstreetmap_attr = 'Map data © <a href="http://www.osm.org">OpenStreetMap</a>' 30 var openstreetmap_url = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; 31 var openstreetmap_attr = 'Map data © <a href="http://www.osm.org">OpenStreetMap</a>'; 29 32 30 33 // Some constants reused through the code … … 36 39 var create_map = function create_map(latitude, longitude, zoom) { 37 40 /* Create a Leaflet map, set center point and add tiles */ 38 map = L.map( 'map');41 map = L.map(map_id, {zoomControl: zoom_control}); 39 42 map.setView([latitude, longitude], zoom); 40 43 var tile_layer = L.tileLayer(openstreetmap_url, { … … 90 93 }, 91 94 }); 92 gpx.on("addline",function(e){ 93 elevation.addData(e.line); 94 // ow_charts.addData(e.line); 95 }); 95 96 gpx.on('loaded', function(e) { 97 map.fitBounds(e.target.getBounds()); 98 }); 99 100 if (elevation) { 101 gpx.on("addline",function(e){ 102 elevation.addData(e.line); 103 // ow_charts.addData(e.line); 104 }); 105 }; 106 96 107 gpx.addTo(map); 97 108 }; … … 100 111 // create the map, add elevation, load gpx 101 112 create_map(latitude, longitude, zoom); 102 add_elevation_chart(); 113 if (elevation) { 114 add_elevation_chart(); 115 } 103 116 // add_ow_charts(); 104 117 load_gpx(gpx_url);
Note: See TracChangeset
for help on using the changeset viewer.