Skip to content

Commit

Permalink
Fix fit to content (SVG-Edit#841)
Browse files Browse the repository at this point in the history
* Fix: avoid to select defs or title as parentElement

* Fix: fix problem when nothing is drawing
  • Loading branch information
cg-scorpio authored Oct 16, 2022
1 parent aabd593 commit cb2fe73
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/svgcanvas/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit cb2fe73

Please sign in to comment.