chore(astro): use width/height attrs

This commit is contained in:
moklick
2023-11-21 15:18:35 +01:00
parent d812dbbe53
commit 24c999a335
4 changed files with 15 additions and 25 deletions
@@ -170,7 +170,9 @@
style:z-index={zIndex}
style:transform="translate({positionOriginX}px, {positionOriginY}px)"
style:visibility={initialized ? 'visible' : 'hidden'}
style="{style} {width ? `;width=${width}px` : ''} {height ? `;height=${height}px;` : ''}"
style:width={width === undefined ? undefined : `${width}px`}
style:height={height === undefined ? undefined : `${height}px`}
{style}
on:click={onSelectNodeHandler}
on:mouseenter={(event) => dispatch('nodemouseenter', { node, event })}
on:mouseleave={(event) => dispatch('nodemouseleave', { node, event })}
@@ -76,11 +76,7 @@ export const getInitialStore = ({
let viewport: Viewport = { x: 0, y: 0, zoom: 1 };
if (fitView && width && height) {
const nodesWithDimensions = nextNodes.map((node) => ({
...node,
width: node.size?.width,
height: node.size?.height
}));
const nodesWithDimensions = nextNodes.filter((node) => node.width && node.height);
const bounds = getNodesBounds(nodesWithDimensions, [0, 0]);
viewport = getViewportForBounds(bounds, width, height, 0.5, 2, 0.1);
}