comparison client/src/components/fairway/Fairwayprofile.vue @ 3682:c086f5176ef2

client: diagrams: fixed removal of resize listener listeners were not removed so diagrams were redrawn even if they were closed/not visible/mounted, leading to console errors.
author Markus Kottlaender <markus@intevation.de>
date Tue, 18 Jun 2019 12:53:05 +0200
parents c91bcb92e0b7
children 4a00ff7e44f0
comparison
equal deleted inserted replaced
3681:c9e1848a516a 3682:c086f5176ef2
163 components: { 163 components: {
164 DiagramLegend: () => import("@/components/DiagramLegend") 164 DiagramLegend: () => import("@/components/DiagramLegend")
165 }, 165 },
166 data() { 166 data() {
167 return { 167 return {
168 resizeListenerFunction: null,
168 width: null, 169 width: null,
169 height: null, 170 height: null,
170 margin: { 171 margin: {
171 top: 20, 172 top: 20,
172 right: 80, 173 right: 80,
800 this.height = clientHeight; 801 this.height = clientHeight;
801 this.width = clientWidth; 802 this.width = clientWidth;
802 } 803 }
803 }, 804 },
804 created() { 805 created() {
805 window.addEventListener("resize", debounce(this.drawDiagram), 100); 806 this.resizeListenerFunction = debounce(this.drawDiagram, 100);
807 window.addEventListener("resize", this.resizeListenerFunction);
806 }, 808 },
807 mounted() { 809 mounted() {
808 this.drawDiagram(); 810 this.drawDiagram();
809 this.templates[0] = this.defaultTemplate; 811 this.templates[0] = this.defaultTemplate;
810 this.form.template = this.templates[0]; 812 this.form.template = this.templates[0];
833 }, 835 },
834 updated() { 836 updated() {
835 this.drawDiagram(); 837 this.drawDiagram();
836 }, 838 },
837 destroyed() { 839 destroyed() {
838 window.removeEventListener("resize", debounce(this.drawDiagram)); 840 window.removeEventListener("resize", this.resizeListenerFunction);
839 } 841 }
840 }; 842 };
841 </script> 843 </script>