Fix fit to content (#841)

* Fix: avoid to select defs or title as parentElement

* Fix: fix problem when nothing is drawing
master
cg-scorpio 2022-10-16 15:43:58 +02:00 committed by GitHub
parent aabd593123
commit cb2fe733dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -974,13 +974,15 @@ export const getVisibleElements = (parentElement) => {
} }
const contentElems = [] const contentElems = []
const children = parentElement.children if (parentElement) {
// eslint-disable-next-line array-callback-return const children = parentElement.children
Array.from(children, (elem) => { // eslint-disable-next-line array-callback-return
if (elem.getBBox) { Array.from(children, (elem) => {
contentElems.push(elem) if (elem.getBBox) {
} contentElems.push(elem)
}) }
})
}
return contentElems.reverse() return contentElems.reverse()
} }