From 938ea11f681060ff1285df3a40856ee9310cb308 Mon Sep 17 00:00:00 2001 From: Joerg Lehmann Date: Sat, 13 Mar 2021 20:08:01 +0100 Subject: [PATCH] mal ein zwischenstand... --- snippets/map.html | 2 +- static/js/map.js | 31 +++++++++---------------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/snippets/map.html b/snippets/map.html index f90da26..8f8edeb 100644 --- a/snippets/map.html +++ b/snippets/map.html @@ -34,7 +34,7 @@
- +
{{ else }}

Bitte zuerst einloggen

diff --git a/static/js/map.js b/static/js/map.js index 9a4bf4f..177ec29 100644 --- a/static/js/map.js +++ b/static/js/map.js @@ -5,6 +5,7 @@ var stop = urlParams.get('stop'); var lon = urlParams.get('lon'); var lat = urlParams.get('lat'); var map; +var last_slider_position; if (start == null) { var dstart = moment({hour: 0}); @@ -47,6 +48,7 @@ function refreshDatapoints(deveui, start, stop) { datapoints = mydata; $('#datetimeslider').attr('max', mydata.length - 1); $('#datetimeslider').val(mydata.length - 1); + last_slider_position = mydata.length - 1; var unix_timestamp = mydata[mydata.length - 1][0]; var date = new Date(unix_timestamp * 1000); var myhtml = moment(date).format('DD.MM.YYYY HH:mm') + ' / ' + mydata[mydata.length - 1][3] + '% '; @@ -54,27 +56,8 @@ function refreshDatapoints(deveui, start, stop) { }); } -function updateSlider(c) -{ - if(c.value <= 50000) - { - if(c.step != 1) - c.step = 1; - //alert(c.value); - } - else - { - if(c.step != 3) - c.step = 3; - //alert(c.value); - } -} - - $(document).ready(function() { var position = ol.proj.fromLonLat([lon, lat], "EPSG:2056"); - console.log("Document Ready Position:"); - console.log(position); var layer = ga.layer.create('ch.swisstopo.pixelkarte-farbe'); map = new ga.Map({ @@ -184,6 +167,13 @@ $(function() { function updateSliderTooltip(c) { + if (c.value == last_slider_position) { + // we don't do anything if slider position did not change... + return + } + + last_slider_position = c.value; + console.log("Slider position changed..."); var unix_timestamp = datapoints[c.value][0]; var date = new Date(unix_timestamp * 1000); var myhtml = moment(date).format('DD.MM.YYYY HH:mm') + ' / ' + datapoints[c.value][3] + '% '; @@ -191,9 +181,6 @@ function updateSliderTooltip(c) var position = ol.proj.fromLonLat([datapoints[c.value][2], datapoints[c.value][1]], "EPSG:2056"); - console.log("updateSliderTooltip Position:"); - console.log(position); - // Create the layer with the icon var vectorLayer2 = new ol.layer.Vector({ source: new ol.source.Vector({