Changeset d33326a in OpenWorkouts-current for ow/static/js/ow.js
- Timestamp:
- Jan 19, 2019, 5:47:10 PM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- b22a9d2
- Parents:
- b030195
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ow/static/js/ow.js
rb030195 rd33326a 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; 25 27 26 28 // OpenStreetMap urls and references … … 36 38 var create_map = function create_map(latitude, longitude, zoom) { 37 39 /* Create a Leaflet map, set center point and add tiles */ 38 map = L.map( 'map');40 map = L.map(map_id, {preferCanvas: true}); 39 41 map.setView([latitude, longitude], zoom); 40 42 var tile_layer = L.tileLayer(openstreetmap_url, { … … 90 92 }, 91 93 }); 92 gpx.on("addline",function(e){ 93 elevation.addData(e.line); 94 // ow_charts.addData(e.line); 95 }); 94 95 gpx.on('loaded', function(e) { 96 map.fitBounds(e.target.getBounds()); 97 }); 98 99 if (elevation) { 100 gpx.on("addline",function(e){ 101 elevation.addData(e.line); 102 // ow_charts.addData(e.line); 103 }); 104 }; 105 96 106 gpx.addTo(map); 97 107 }; … … 100 110 // create the map, add elevation, load gpx 101 111 create_map(latitude, longitude, zoom); 102 add_elevation_chart(); 112 if (elevation) { 113 add_elevation_chart(); 114 } 103 115 // add_ow_charts(); 104 116 load_gpx(gpx_url);
Note: See TracChangeset
for help on using the changeset viewer.