feat(edges): calc y handle pos
This commit is contained in:
@@ -6,13 +6,15 @@ export default (props) => {
|
||||
|
||||
const sourceHandle = sourceNode.__rg.handleBounds.source;
|
||||
const sourceHandleX = sourceHandle ? sourceHandle.x + (sourceHandle.width / 2) : sourceNode.__rg.width / 2;
|
||||
const sourceHandleY = sourceHandle ? sourceHandle.y + (sourceHandle.height / 2) : sourceNode.__rg.height;
|
||||
const sourceX = sourceNode.__rg.position.x + sourceHandleX;
|
||||
const sourceY = sourceNode.__rg.position.y + sourceNode.__rg.height;
|
||||
const sourceY = sourceNode.__rg.position.y + sourceHandleY;
|
||||
|
||||
const targetHandle = targetNode.__rg.handleBounds.target;
|
||||
const targetHandleX = targetHandle ? targetHandle.x + (targetHandle.width / 2) : targetNode.__rg.width / 2;
|
||||
const targetHandleY = targetHandle ? targetHandle.y + (targetHandle.height / 2) : 0;
|
||||
const targetX = targetNode.__rg.position.x + targetHandleX;
|
||||
const targetY = targetNode.__rg.position.y;
|
||||
const targetY = targetNode.__rg.position.y + targetHandleY;
|
||||
|
||||
const yOffset = Math.abs(targetY - sourceY) / 2;
|
||||
const centerY = targetY < sourceY ? targetY + yOffset : targetY - yOffset;
|
||||
|
||||
Reference in New Issue
Block a user