From 1ab02e6905a222553990d36cf43f58b4079793a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Thu, 2 Feb 2023 22:55:30 +0000 Subject: [PATCH] parent_aspect_ratio suspicious value handling --- ui/src/components/rects/SVGRectText.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/src/components/rects/SVGRectText.vue b/ui/src/components/rects/SVGRectText.vue index ad13d70..4eb7490 100644 --- a/ui/src/components/rects/SVGRectText.vue +++ b/ui/src/components/rects/SVGRectText.vue @@ -33,7 +33,18 @@ export default class extends Vue { } const parent = this.$el.parentElement; - return parent.clientWidth / parent.clientHeight; + const result = parent.clientWidth / parent.clientHeight; + + // force recompute for suspicious results + if (result === 0 || result === Infinity) { + // don't loop endlessly + if (this.refreshKey < 10000) { + this.refreshKey++; + } + return 1; + } + + return result; } public mounted() {