#11490 fixed calculate text in firefox

This commit is contained in:
Daniel Cebrian 2023-09-01 09:30:22 +02:00
parent 075cc1d372
commit 7e049cb1b5
1 changed files with 4 additions and 3 deletions

View File

@ -648,15 +648,16 @@ function treeMap(recipient, data, width, height, childLinks = false) {
const originalFontSize = 12;
textElement.style.fontSize = "16px";
const textWidth = textElement.getComputedTextLength() + 8;
textElement.style.fontSize = originalFontSize;
const computedTextLength = textElement.getComputedTextLength();
const textWidth = computedTextLength + 8;
textElement.style.fontSize = originalFontSize + "px";
const scaleFactor = containerWidth / textWidth;
let scaledFontSize = parseFloat(originalFontSize) * scaleFactor;
scaledFontSize = scaledFontSize > 12 ? 12 : scaledFontSize;
textElement.style.fontSize = scaledFontSize;
textElement.style.fontSize = scaledFontSize + "px";
});
}