UNPKG

@rxflow/base

Version:

BaseFlow - 核心 Flow 组件库

52 lines 1.4 kB
/** * @author: yanxianliang * @date: 2025-10-20 09:19 * @modified:2025/10/20 09:19 by yanxianliang * @desc: 智能边 * * Copyright (c) 2025 by yanxianliang, All Rights Reserved. */ import { BaseEdge, useStoreApi } from '@xyflow/react'; import { memo } from "react"; import { getManHattanPath } from '@rxflow/manhattan'; import { jsx as _jsx } from "react/jsx-runtime"; export var ManhattanEdge = /*#__PURE__*/memo(function (_ref) { var source = _ref.source, target = _ref.target, sourceX = _ref.sourceX, sourceY = _ref.sourceY, targetX = _ref.targetX, targetY = _ref.targetY, sourcePosition = _ref.sourcePosition, targetPosition = _ref.targetPosition; var _useStoreApi = useStoreApi(), getState = _useStoreApi.getState; var nodeLookup = getState().nodeLookup; var path = getManHattanPath({ sourceNodeId: source, targetNodeId: target, sourceX: sourceX, sourceY: sourceY, sourcePosition: sourcePosition, targetX: targetX, targetY: targetY, targetPosition: targetPosition, // // sourcePosition: { // x: sourceX, // y: sourceY // }, // targetPosition: { // x: targetX, // y: targetY // }, nodeLookup: nodeLookup // options: { // padding: 10 // } }); return /*#__PURE__*/_jsx(BaseEdge, { path: path }); }); ManhattanEdge.displayName = 'manhattan';