Changeset d1c4782 in OpenWorkouts-current for ow/static/js/ow.js


Ignore:
Timestamp:
Jan 21, 2019, 10:43:20 AM (5 years ago)
Author:
borja <borja@…>
Branches:
current, feature/docs, master
Children:
be40b02
Parents:
ceae158
Message:

Show a capture of the workout map, as an image, in the dashboard:

  • Added a view to render the tracking map of a workout full screen
  • Added a small shell script that uses chrome to grabs a screenshot of the full screen map view of a workout, then uses imagemagick convert to crop/resize it and finally saves it in a given location
  • Added a static/maps directory to store maps captures
  • Added static/maps to the boring/ignore file
  • Added a tool in utilities.py to call the shell script that captures the screenshot of the map
  • Added a method to the Workout model, that returns the static path to the workout map capture (valid to use with request.static_url()). If there is no capture yet, call the tool to make one
  • Added code to dashboard.pt to show the capture of the map
  • Added a new parameter to te ow maps js code, allowing us to hide/show the zoom controls of the map when building a new one
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ow/static/js/ow.js

    rceae158 rd1c4782  
    2525    var shadow = spec.shadow;
    2626    var elevation = spec.elevation;
     27    var zoom_control = spec.zoom_control;
    2728
    2829    // OpenStreetMap urls and references
    29     var openstreetmap_url = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
    30     var openstreetmap_attr = 'Map data &copy; <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 &copy; <a href="http://www.osm.org">OpenStreetMap</a>';
    3132
    3233    // Some constants reused through the code
     
    3839    var create_map = function create_map(latitude, longitude, zoom) {
    3940        /* Create a Leaflet map, set center point and add tiles */
    40         map = L.map(map_id, {preferCanvas: true});
     41        map = L.map(map_id, {zoomControl: zoom_control});
    4142        map.setView([latitude, longitude], zoom);
    4243        var tile_layer = L.tileLayer(openstreetmap_url, {
Note: See TracChangeset for help on using the changeset viewer.