chore(examples): add easy connect example
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
<script lang="ts" setup>
|
||||
import type { GraphNode } from '@vue-flow/core'
|
||||
import { getStraightPath } from '@vue-flow/core'
|
||||
import { computed } from 'vue'
|
||||
|
||||
import { getEdgeParams } from './utils'
|
||||
|
||||
const props = defineProps<{ id: string; sourceNode: GraphNode; targetNode: GraphNode; markerEnd: string; style: any }>()
|
||||
|
||||
const edgeParams = computed(() => getEdgeParams(props.sourceNode, props.targetNode))
|
||||
|
||||
const edgePath = computed(() =>
|
||||
getStraightPath({
|
||||
sourceX: edgeParams.value.sx,
|
||||
sourceY: edgeParams.value.sy,
|
||||
targetX: edgeParams.value.tx,
|
||||
targetY: edgeParams.value.ty,
|
||||
}),
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<path :id="id" class="vue-flow__edge-path" :d="edgePath[0]" :marker-end="markerEnd" :style="style" />
|
||||
</template>
|
||||
Reference in New Issue
Block a user