+
Cost |
Mean cost factor
diff --git a/js/Map.js b/js/Map.js
index a05a762..db29f68 100644
--- a/js/Map.js
+++ b/js/Map.js
@@ -12,12 +12,15 @@ BR.Map = {
minZoom: 0,
maxZoom: maxZoom
});
- L.control
- .zoom({
- zoomInTitle: i18next.t('map.zoomInTitle'),
- zoomOutTitle: i18next.t('map.zoomOutTitle')
- })
- .addTo(map);
+
+ if (BR.Util.getResponsiveBreakpoint() >= '3md') {
+ L.control
+ .zoom({
+ zoomInTitle: i18next.t('map.zoomInTitle'),
+ zoomOutTitle: i18next.t('map.zoomOutTitle')
+ })
+ .addTo(map);
+ }
if (!map.restoreView()) {
map.setView(BR.conf.initialMapLocation || [50.99, 9.86], BR.conf.initialMapZoom || 5);
}
diff --git a/js/Util.js b/js/Util.js
index 8dbbd31..643ae0d 100644
--- a/js/Util.js
+++ b/js/Util.js
@@ -48,5 +48,24 @@ BR.Util = {
} catch (e) {
return false;
}
+ },
+
+ // see https://stackoverflow.com/a/37141090/1906123
+ getResponsiveBreakpoint: function() {
+ var envs = { '1xs': 'd-none', '2sm': 'd-sm-none', '3md': 'd-md-none', '4lg': 'd-lg-none', '5xl': 'd-xl-none' };
+ var env = '';
+
+ var $el = $('
');
+ $el.appendTo($('body'));
+
+ for (var i = Object.keys(envs).length - 1; i >= 0; i--) {
+ env = Object.keys(envs)[i];
+ $el.addClass(envs[env]);
+ if ($el.is(':hidden')) {
+ break; // env detected
+ }
+ }
+ $el.remove();
+ return env;
}
};
diff --git a/js/control/TrackStats.js b/js/control/TrackStats.js
index 41c75b0..f5b281b 100644
--- a/js/control/TrackStats.js
+++ b/js/control/TrackStats.js
@@ -1,21 +1,18 @@
BR.TrackStats = L.Class.extend({
update: function(polyline, segments) {
if (segments.length == 0) {
- $('#distance').html('-');
- $('#distance').attr('title', '');
- $('#ascend').html('-');
- $('#plainascend').html('-');
- $('#cost').html('-');
- $('#meancostfactor').html('-');
- $('#totaltime').html('-');
- $('#totalenergy').html('-');
- $('#meanenergy').html('-');
+ $('#stats-container').hide();
+ $('#stats-info').show();
return;
}
+ $('#stats-container').show();
+ $('#stats-info').hide();
var stats = this.calcStats(polyline, segments),
length1 = L.Util.formatNum(stats.trackLength / 1000, 1).toLocaleString(),
- length3 = L.Util.formatNum(stats.trackLength / 1000, 3).toLocaleString(),
+ length3 = L.Util.formatNum(stats.trackLength / 1000, 3).toLocaleString(undefined, {
+ minimumFractionDigits: 3
+ }),
formattedAscend = stats.filteredAscend.toLocaleString(),
formattedPlainAscend = stats.plainAscend.toLocaleString(),
formattedCost = stats.cost.toLocaleString(),
diff --git a/locales/en.json b/locales/en.json
index 364c413..8cd6a5d 100644
--- a/locales/en.json
+++ b/locales/en.json
@@ -51,6 +51,7 @@
"meter": "meters",
"meter-abbrev": "m",
"plain-ascend": "Plain ascend",
+ "stats-info": "Start drawing a route to get stats.",
"total-energy": "Total Energy",
"travel-time": "Travel time"
},