getNodesBounds()
与えられたノードの配列を含むバウンディングボックスを返します。これは、getViewportForBounds
と組み合わせて、与えられたノードをビューポートに収めるための正しい変換を計算する場合に役立ちます。
ℹ️
この関数は以前 getRectOfNodes
と呼ばれていましたが、v12 で削除されます。
import { getNodesBounds } from '@xyflow/svelte';
const nodes = [
{
id: 'a',
position: { x: 0, y: 0 },
data: { label: 'a' },
width: 50,
height: 25,
},
{
id: 'b',
position: { x: 100, y: 100 },
data: { label: 'b' },
width: 50,
height: 25,
},
];
const bounds = getNodesBounds(nodes);
シグネチャ
名前 | 型 |
---|---|
#パラメータ |
|
# nodes | Node[] |
#戻り値 |
|
Rect |