refactor(core): throw warning if dimensions of viewport are 0

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
braks
2023-02-01 21:16:41 +01:00
committed by Braks
parent 2f81f2a9c6
commit 522efd4c94

View File

@@ -72,8 +72,11 @@ const setDimensions = () => {
if (!viewportEl.value) return
const { width, height } = getDimensions(viewportEl.value)
dimensions.width = width
dimensions.height = height
if (width === 0 || height === 0) warn('The Vue Flow parent container needs a width and a height to render the graph.')
dimensions.width = width || 500
dimensions.height = height || 500
}
const isWrappedWithClass = (event: Event, className: string | undefined) => (event.target as Element).closest(`.${className}`)