changeset 5161:1ece2e6ac754

timeslide: fix unexpected jumping of scrubber when drag event ends
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 03 Apr 2020 10:23:13 +0200
parents c86ce16937fd
children eb4683befb39
files client/src/components/TimeSlider.vue
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/TimeSlider.vue	Fri Apr 03 09:55:02 2020 +0200
+++ b/client/src/components/TimeSlider.vue	Fri Apr 03 10:23:13 2020 +0200
@@ -266,13 +266,14 @@
         .on("end", () => {
           d3.select(".line").classed("active", false);
           const now = new Date();
-          if (this.selectedTime > now) this.selectedTime = now;
-          d3.select(".line").attr(
-            "x",
-            xAxis.scale()(d3.isoParse(this.selectedTime))
-          );
+          if (this.selectedTime > now) {
+            this.selectedTime = now;
+            d3.select(".line").attr(
+              "x",
+              xAxis.scale()(d3.isoParse(this.selectedTime))
+            );
+          }
         });
-
       const main = svg
         .append("g")
         .attr("id", "zoom")