feat(edges): calc y handle pos

This commit is contained in:
moklick
2019-07-29 19:06:38 +02:00
parent 06a7bad23a
commit a681bab94e
5 changed files with 16 additions and 10 deletions
+4 -2
View File
@@ -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;