comparison client/src/components/TimeSlider.vue @ 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
comparison
equal deleted inserted replaced
5160:c86ce16937fd 5161:1ece2e6ac754
264 }) 264 })
265 .on("drag", this.onDrag) 265 .on("drag", this.onDrag)
266 .on("end", () => { 266 .on("end", () => {
267 d3.select(".line").classed("active", false); 267 d3.select(".line").classed("active", false);
268 const now = new Date(); 268 const now = new Date();
269 if (this.selectedTime > now) this.selectedTime = now; 269 if (this.selectedTime > now) {
270 d3.select(".line").attr( 270 this.selectedTime = now;
271 "x", 271 d3.select(".line").attr(
272 xAxis.scale()(d3.isoParse(this.selectedTime)) 272 "x",
273 ); 273 xAxis.scale()(d3.isoParse(this.selectedTime))
274 );
275 }
274 }); 276 });
275
276 const main = svg 277 const main = svg
277 .append("g") 278 .append("g")
278 .attr("id", "zoom") 279 .attr("id", "zoom")
279 .attr("class", "zoom") 280 .attr("class", "zoom")
280 .attr("width", svgWidth) 281 .attr("width", svgWidth)