refactor(pathfinding-edge): remove getEdgeCenter usage
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { EdgeText, getEdgeCenter } from '@vue-flow/core'
|
import { EdgeText, getSimpleBezierPath } from '@vue-flow/core'
|
||||||
import type { CSSProperties } from 'vue'
|
import type { CSSProperties } from 'vue'
|
||||||
import { getArrow } from 'perfect-arrows'
|
import { getArrow } from 'perfect-arrows'
|
||||||
import type { PerfectArrowProps } from '../types'
|
import type { PerfectArrowProps } from '../types'
|
||||||
@@ -13,7 +13,7 @@ const props = withDefaults(defineProps<PerfectArrowProps>(), {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const centered = computed(() =>
|
const centered = computed(() =>
|
||||||
getEdgeCenter({
|
getSimpleBezierPath({
|
||||||
...props,
|
...props,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
@@ -44,8 +44,8 @@ export default {
|
|||||||
/>
|
/>
|
||||||
<EdgeText
|
<EdgeText
|
||||||
v-if="props.label"
|
v-if="props.label"
|
||||||
:x="centered[0]"
|
:x="centered[1]"
|
||||||
:y="centered[1]"
|
:y="centered[2]"
|
||||||
:label="props.label"
|
:label="props.label"
|
||||||
:label-style="props.labelStyle"
|
:label-style="props.labelStyle"
|
||||||
:label-show-bg="props.labelShowBg"
|
:label-show-bg="props.labelShowBg"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { Position } from '@vue-flow/core'
|
import type { Position } from '@vue-flow/core'
|
||||||
import { BezierEdge, EdgeText, getEdgeCenter, useVueFlow } from '@vue-flow/core'
|
import { BezierEdge, EdgeText, getSimpleBezierPath, useVueFlow } from '@vue-flow/core'
|
||||||
import type { PathFindingEdgeProps } from '../types'
|
import type { PathFindingEdgeProps } from '../types'
|
||||||
import { createGrid, gridRatio } from './createGrid'
|
import { createGrid, gridRatio } from './createGrid'
|
||||||
import { drawSmoothLinePath } from './drawSvgPath'
|
import { drawSmoothLinePath } from './drawSvgPath'
|
||||||
@@ -24,7 +24,7 @@ const roundCoordinatesTo = gridRatio
|
|||||||
const { getNodes } = useVueFlow()
|
const { getNodes } = useVueFlow()
|
||||||
|
|
||||||
const centered = computed(() =>
|
const centered = computed(() =>
|
||||||
getEdgeCenter({
|
getSimpleBezierPath({
|
||||||
...props,
|
...props,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
@@ -33,6 +33,7 @@ const source = computed(() => ({
|
|||||||
y: props.sourceY,
|
y: props.sourceY,
|
||||||
position: props.sourcePosition,
|
position: props.sourcePosition,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const target = computed(() => ({
|
const target = computed(() => ({
|
||||||
x: props.targetX,
|
x: props.targetX,
|
||||||
y: props.targetY,
|
y: props.targetY,
|
||||||
@@ -95,8 +96,8 @@ export default {
|
|||||||
/>
|
/>
|
||||||
<EdgeText
|
<EdgeText
|
||||||
v-if="props.label"
|
v-if="props.label"
|
||||||
:x="centered[0]"
|
:x="centered[1]"
|
||||||
:y="centered[1]"
|
:y="centered[2]"
|
||||||
:label="props.label"
|
:label="props.label"
|
||||||
:label-style="props.labelStyle"
|
:label-style="props.labelStyle"
|
||||||
:label-show-bg="props.labelShowBg"
|
:label-show-bg="props.labelShowBg"
|
||||||
|
|||||||
Reference in New Issue
Block a user