commit 243c6503ab92396f403019c154273c52b41e04b8
parent 563f897c10f6f93436ef47a18bb64aedf265c624
Author: Sergej Orlov <wladimirych@gmail.com>
Date: Wed, 5 Feb 2020 22:40:47 +0100
add logging for used map layers
Diffstat:
1 file changed, 20 insertions(+), 0 deletions(-)
diff --git a/src/App.js b/src/App.js
@@ -197,7 +197,27 @@ function setUp() {
tracklist.stopEditLine();
});
azimuthControl.on('elevation-shown', () => tracklist.hideElevationProfile());
+
+ function logUsedMaps() {
+ const layers = [];
+ map.eachLayer((layer) => {
+ if (layer.meta) {
+ layers.push({title: layer.meta.title});
+ } else if (layer.__customLayer) {
+ layers.push({custom: true, title: layer.__customLayer.title, url: layer._url});
+ }
+ });
+ const bounds = map.getBounds();
+ logging.logEvent('activeLayers', {
+ layers,
+ view: {west: bounds.getWest(), south: bounds.getSouth(), east: bounds.getEast(), north: bounds.getNorth()},
+ });
+ }
+
+ L.DomEvent.on(document, 'mousemove click touchend', L.Util.throttle(logUsedMaps, 10000));
+
logging.logEvent('start', startInfo);
+ logUsedMaps();
}
export default {setUp};