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
commit 141d38b4e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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;