Add node id to MiniMapNodeProps and MiniMapNode in Svelte Flow.

This commit is contained in:
Alessandro
2025-10-23 11:04:26 +02:00
parent 127c880e16
commit 6c7de33513
4 changed files with 26 additions and 18 deletions

View File

@@ -1,22 +1,25 @@
<script lang="ts">
let {
x,
y,
width,
height,
selected,
}: {
x: number;
y: number;
width: number;
height: number;
selected?: boolean;
} = $props();
import type { MiniMapNodeProps } from '@xyflow/svelte';
let { id, x, y, width, height, selected }: MiniMapNodeProps = $props();
</script>
<circle
<circle
cx={x + width / 2}
cy={y + height / 2}
r={Math.min(width, height) - 2}
fill={selected ? "#ff6b6b" : "#ffcc00"}
/>
cy={y + height / 2}
r={Math.min(width, height) - 2}
fill={selected ? '#ff6b6b' : '#ffcc00'}
/>
<text
x={x + width / 2}
y={y + height / 2}
text-anchor="middle"
dominant-baseline="middle"
fill="blue"
stroke-width="0.5"
font-size="100"
font-family="Arial, sans-serif"
font-weight="bold"
>
{id}
</text>