Feat(nodes): add initialWidth and initialHeight (#3953)

* feat(react/svelte): add initialWidth/initialHeight closes #3793

* chore(packages): update changelogs
This commit is contained in:
Moritz Klack
2024-02-27 15:21:35 +01:00
committed by GitHub
parent 14516ab061
commit e5c667d068
28 changed files with 362 additions and 60 deletions
@@ -7,7 +7,13 @@
<script lang="ts">
import cc from 'classcat';
import { getBoundsOfRects, getNodePositionWithOrigin, getNodesBounds } from '@xyflow/system';
import {
getBoundsOfRects,
getNodeDimensions,
getNodePositionWithOrigin,
getNodesBounds,
nodeHasDimensions
} from '@xyflow/system';
import { useStore } from '$lib/store';
import { Panel } from '$lib/container/Panel';
@@ -116,13 +122,13 @@
{#if ariaLabel}<title id={labelledBy}>{ariaLabel}</title>{/if}
{#each $nodes as node (node.id)}
{#if (node.computed?.width || node?.width) && (node.computed?.height || node.height)}
{#if nodeHasDimensions(node)}
{@const pos = getNodePositionWithOrigin(node).positionAbsolute}
{@const nodeDimesions = getNodeDimensions(node)}
<MinimapNode
x={pos.x}
y={pos.y}
width={node.computed?.width ?? node.width ?? 0}
height={node.computed?.height ?? node.height ?? 0}
{...nodeDimesions}
selected={node.selected}
color={nodeColorFunc?.(node)}
borderRadius={nodeBorderRadius}