This commit is contained in:
Viktor Rådberg
2023-12-27 19:49:38 +01:00
parent 183fd9c079
commit 808c55109d
15 changed files with 687 additions and 630 deletions

View File

@@ -151,6 +151,7 @@ const Health = ({
const textContainer = textContainerRef.current;
const resizeObserver = new ResizeObserver(() => {
const calcFontSize = calculateFontSize(textContainer);
console.log(calcFontSize);
setFontSize(calcFontSize);
});
@@ -180,9 +181,9 @@ const Health = ({
const minRatio = Math.min(widthRatio, heightRatio);
const heightIsLarger = heightRatio > widthRatio;
const heightIs40PercentSmaller = heightRatio > widthRatio * 0.6;
const scaleFactor = heightIsLarger ? 0.8 : 1;
const scaleFactor = heightIs40PercentSmaller ? 0.8 : 1;
return minRatio * scaleFactor * 1;
};