feat(svelte): edge types, use edge-utils

This commit is contained in:
moklick
2023-02-22 10:38:32 +01:00
parent b3de45ce1a
commit a0bdd9574e
15 changed files with 219 additions and 82 deletions
@@ -0,0 +1,21 @@
<script lang="ts">
import { getSmoothStepPath } from '@reactflow/edge-utils';
import type { EdgeProps } from '$lib/types';
interface $$Props extends EdgeProps {}
export let id: $$Props['id'];
export let sourceX: $$Props['sourceX'] = 0;
export let sourceY: $$Props['sourceY'] = 0;
export let targetX: $$Props['targetX'] = 0;
export let targetY: $$Props['targetY'] = 0;
export let sourcePosition: $$Props['sourcePosition'] = undefined;
export let targetPosition: $$Props['targetPosition'] = undefined;
$: [path] = getSmoothStepPath({ sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition });
</script>
<path
d={path}
class="react-flow__edge-path"
/>