Mercurial > gemma
changeset 4462:2793893bc7f5
clinet: Waterlevels: fix resizing problem for diagram
* In order to circumvent scoping issues, instead of passing a function to "debounce", pass an anonymous function calling said function.
* pass the stored zoom level after resizing to draw the diagram correctly
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Mon, 23 Sep 2019 14:24:02 +0200 |
parents | 7128741faeb9 |
children | 1cdd246860ae |
files | client/src/components/gauge/Waterlevel.vue |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/gauge/Waterlevel.vue Mon Sep 23 12:59:48 2019 +0200 +++ b/client/src/components/gauge/Waterlevel.vue Mon Sep 23 14:24:02 2019 +0200 @@ -1167,7 +1167,11 @@ } }, created() { - this.resizeListenerFunction = debounce(this.drawDiagram, 100); + this.resizeListenerFunction = debounce(() => { + this.zoomStore // restore last zoom level + ? this.drawDiagram({ ...this.zoomStore }) + : this.drawDiagram(); + }, 100); window.addEventListener("resize", this.resizeListenerFunction); }, mounted() {