chore(docs): use path el for transition edge example
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { TransitionPresets, useDebounceFn, useTransition, watchDebounced } from '@vueuse/core'
|
import { TransitionPresets, useDebounceFn, useTransition, watchDebounced } from '@vueuse/core'
|
||||||
import { BezierEdge, useVueFlow } from '@vue-flow/core'
|
import { getBezierPath, useVueFlow } from '@vue-flow/core'
|
||||||
import { ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: {
|
id: {
|
||||||
@@ -64,11 +64,21 @@ const showDot = ref(false)
|
|||||||
|
|
||||||
const { onNodeDoubleClick, fitBounds, fitView } = useVueFlow()
|
const { onNodeDoubleClick, fitBounds, fitView } = useVueFlow()
|
||||||
|
|
||||||
|
const path = computed(() =>
|
||||||
|
getBezierPath({
|
||||||
|
sourceX: props.sourceX,
|
||||||
|
sourceY: props.sourceY,
|
||||||
|
sourcePosition: props.sourcePosition,
|
||||||
|
targetX: props.targetX,
|
||||||
|
targetY: props.targetY,
|
||||||
|
targetPosition: props.targetPosition,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
const debouncedFitBounds = useDebounceFn(fitBounds, 1, { maxWait: 1 })
|
const debouncedFitBounds = useDebounceFn(fitBounds, 1, { maxWait: 1 })
|
||||||
|
|
||||||
onNodeDoubleClick(({ node }) => {
|
onNodeDoubleClick(({ node }) => {
|
||||||
const isSource = props.source === node.id
|
const isSource = props.source === node.id
|
||||||
|
|
||||||
const isTarget = props.target === node.id
|
const isTarget = props.target === node.id
|
||||||
|
|
||||||
if (!showDot.value && (isSource || isTarget)) {
|
if (!showDot.value && (isSource || isTarget)) {
|
||||||
@@ -140,7 +150,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<BezierEdge v-bind="props" />
|
<path :id="id" ref="curve" :style="style" class="vue-flow__edge-path" :d="path[0]" :marker-end="markerEnd" />
|
||||||
|
|
||||||
<Transition name="fade">
|
<Transition name="fade">
|
||||||
<circle
|
<circle
|
||||||
|
|||||||
Reference in New Issue
Block a user