From 6118a0cc222308c5964e0b15dacdf3eed697f5a4 Mon Sep 17 00:00:00 2001 From: lowlighter <22963968+lowlighter@users.noreply.github.com> Date: Thu, 27 Jan 2022 20:12:49 -0500 Subject: [PATCH] fix(app/metrics): force dimensions to be at least one --- source/app/metrics/utils.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/app/metrics/utils.mjs b/source/app/metrics/utils.mjs index 97aa6e07..94815614 100644 --- a/source/app/metrics/utils.mjs +++ b/source/app/metrics/utils.mjs @@ -457,8 +457,8 @@ export const svg = { //Get bounds and resize let {y:height, width} = document.querySelector("svg #metrics-end").getBoundingClientRect() console.debug(`bounds width=${width}, height=${height}`) - height = Math.ceil(height * padding.height + padding.absolute.height) - width = Math.ceil(width * padding.width + padding.absolute.width) + height = Math.max(1, Math.ceil(height * padding.height + padding.absolute.height)) + width = Math.max(1, Math.ceil(width * padding.width + padding.absolute.width)) console.debug(`bounds after applying padding width=${width} (*${padding.width}+${padding.absolute.width}), height=${height} (*${padding.height}+${padding.absolute.height})`) //Resize svg if (document.querySelector("svg").getAttribute("height") === "auto")