Merge pull request #4181 from ischanx/fix-getbbox-cache

fix(squence): getBBox() returns zero
This commit is contained in:
Sidharth Vinod
2023-03-07 11:16:42 +05:30
committed by GitHub

View File

@@ -772,6 +772,9 @@ export const calculateTextDimensions: (
.style('font-family', fontFamily);
const bBox = (textElem._groups || textElem)[0][0].getBBox();
if (bBox.width === 0 && bBox.height === 0) {
throw new Error('svg element not in render tree');
}
dim.width = Math.round(Math.max(dim.width, bBox.width));
cheight = Math.round(bBox.height);
dim.height += cheight;