Fix fit to content (#841)

* Fix: avoid to select defs or title as parentElement

* Fix: fix problem when nothing is drawing
This commit is contained in:
cg-scorpio
2022-10-16 15:43:58 +02:00
committed by GitHub
parent aabd593123
commit cb2fe733dd

View File

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