Node<NodeData, NodeType>
Node
型は、Svelte Flowが特定のノードについて知る必要があるすべての情報を表します。これらのプロパティの多くは、Svelte Flowとユーザーの両方によって操作できますが、width
やheight
など、読み取り専用とみなすべきものもあります。
export type Node<
NodeData extends Record<string, unknown>,
NodeType extends string,
> = {
id: string;
position: XYPosition;
data: NodeData;
type?: NodeType;
sourcePosition?: Position;
targetPosition?: Position;
hidden?: boolean;
selected?: boolean;
dragging?: boolean;
draggable?: boolean;
selectable?: boolean;
connectable?: boolean;
resizing?: boolean;
deletable?: boolean;
dragHandle?: string;
width?: number;
height?: number;
parentId?: string;
zIndex?: number;
extent?: 'parent' | CoordinateExtent;
ariaLabel?: string;
origin?: NodeOrigin;
style?: string;
class?: string;
measured?: {
width?: number;
height?: number;
};
};
フィールド
名前 | 型 |
---|---|
# id | 文字列 |
# position | XYPosition |
# data | T |
# type? | U |
# sourcePosition? | Position |
# targetPosition? | Position |
# hidden? | 論理値 |
# selected? | 論理値 |
# dragging? | 論理値 |
# draggable? | 論理値 |
# selectable? | 論理値 |
# connectable? | 論理値 |
# resizing? | 論理値 |
# deletable? | 論理値 |
# dragHandle? | 文字列 |
# width? | 数値 | null |
# height? | 数値 | null |
# parentId? | 文字列 |
# zIndex? | 数値 |
# extent? | "親" | CoordinateExtent |
# expandParent? | 論理値 |
# ariaLabel? | 文字列 |
# origin? | NodeOrigin |
# style? | 文字列 |
# class? | 文字列 |
備考
- ノードの
measured.width
またはmeasured.height
を直接設定しようとしないでください。これはSvelte Flowによって内部的に測定され、ビューポートにノードをレンダリングする際に使用されます。ノードのサイズを制御するには、width
とheight
属性を使用してください。