feat(canvas): 自由画布 - 增强空白起点、外观设置与节点连接体验 (#356)
This commit is contained in:
13
web/src/lib/canvas/canvas-connected-node-placement.ts
Normal file
13
web/src/lib/canvas/canvas-connected-node-placement.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import type { Position } from "@/types/canvas";
|
||||
|
||||
type NodeSize = {
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
|
||||
export function connectedNodeCenterFromEdgeDrop(dropPosition: Position, nodeSize: NodeSize, handleType: "source" | "target"): Position {
|
||||
return {
|
||||
x: dropPosition.x + (handleType === "source" ? nodeSize.width / 2 : -nodeSize.width / 2),
|
||||
y: dropPosition.y,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user