chore(core): remove unnecessary type annotations
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { GraphNode, HandleElement } from '../../types'
|
import type { GraphNode } from '../../types'
|
||||||
import { ConnectionLineType, ConnectionMode, Position } from '../../types'
|
import { ConnectionLineType, ConnectionMode, Position } from '../../types'
|
||||||
import { getMarkerId } from '../../utils'
|
import { getMarkerId } from '../../utils'
|
||||||
|
|
||||||
@@ -28,10 +28,9 @@ const type = connectionStartHandle!.type
|
|||||||
|
|
||||||
const sourceHandle =
|
const sourceHandle =
|
||||||
(connectionMode === ConnectionMode.Strict
|
(connectionMode === ConnectionMode.Strict
|
||||||
? sourceNode.handleBounds[type]?.find((d: HandleElement) => d.id === handleId)
|
? sourceNode.handleBounds[type]?.find((d) => d.id === handleId)
|
||||||
: [...(sourceNode.handleBounds.source || []), ...(sourceNode.handleBounds.target || [])]?.find(
|
: [...(sourceNode.handleBounds.source || []), ...(sourceNode.handleBounds.target || [])]?.find((d) => d.id === handleId)) ||
|
||||||
(d: HandleElement) => d.id === handleId,
|
sourceNode.handleBounds[type ?? 'source']?.[0]
|
||||||
)) || sourceNode.handleBounds[type ?? 'source']?.[0]
|
|
||||||
|
|
||||||
const sourceHandleX = sourceHandle ? sourceHandle.x + sourceHandle.width / 2 : sourceNode.dimensions.width / 2
|
const sourceHandleX = sourceHandle ? sourceHandle.x + sourceHandle.width / 2 : sourceNode.dimensions.width / 2
|
||||||
const sourceHandleY = sourceHandle ? sourceHandle.y + sourceHandle.height / 2 : sourceNode.dimensions.height
|
const sourceHandleY = sourceHandle ? sourceHandle.y + sourceHandle.height / 2 : sourceNode.dimensions.height
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ interface GetControlWithCurvatureParams {
|
|||||||
c: number
|
c: number
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateControlOffset(distance: number, curvature: number): number {
|
function calculateControlOffset(distance: number, curvature: number) {
|
||||||
if (distance >= 0) {
|
if (distance >= 0) {
|
||||||
return 0.5 * distance
|
return 0.5 * distance
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ function getPoints({
|
|||||||
return [pathPoints, centerX, centerY, defaultOffsetX, defaultOffsetY]
|
return [pathPoints, centerX, centerY, defaultOffsetX, defaultOffsetY]
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBend(a: XYPosition, b: XYPosition, c: XYPosition, size: number): string {
|
function getBend(a: XYPosition, b: XYPosition, c: XYPosition, size: number) {
|
||||||
const bendSize = Math.min(distance(a, b) / 2, distance(b, c) / 2, size)
|
const bendSize = Math.min(distance(a, b) / 2, distance(b, c) / 2, size)
|
||||||
const { x, y } = b
|
const { x, y } = b
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ export function getSmoothStepPath({
|
|||||||
offset,
|
offset,
|
||||||
})
|
})
|
||||||
|
|
||||||
const path = points.reduce<string>((res, p, i) => {
|
const path = points.reduce((res, p, i) => {
|
||||||
let segment = ''
|
let segment = ''
|
||||||
|
|
||||||
if (i > 0 && i < points.length - 1) {
|
if (i > 0 && i < points.length - 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user