Changeset d33326a in OpenWorkouts-current
- Timestamp:
- Jan 19, 2019, 5:47:10 PM (5 years ago)
- Branches:
- current, feature/docs, master
- Children:
- b22a9d2
- Parents:
- b030195
- Location:
- ow
- Files:
-
- 2 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); -
ow/templates/workout.pt
rb030195 rd33326a 152 152 <script type="text/javascript" tal:condition="context.has_gpx"> 153 153 var workout_map = owjs.map({ 154 map_id: 'map', 154 155 latitude: ${start_point['latitude']}, 155 156 longitude: ${start_point['longitude']}, … … 159 160 end_icon: '${request.static_url('ow:static/components/leaflet-gpx/pin-icon-end.png')}', 160 161 shadow: '${request.static_url('ow:static/components/leaflet-gpx/pin-shadow.png')}', 162 elevation: true 161 163 }); 162 164 workout_map.render();
Note: See TracChangeset
for help on using the changeset viewer.