feat(edges): add Bezier Edge

This commit is contained in:
moklick
2019-07-25 15:46:45 +02:00
parent bfeefd51b2
commit d094f5f312
7 changed files with 85 additions and 42 deletions
+6 -6
View File
@@ -33,25 +33,25 @@ export default NodeComponent => memo((props) => {
return false;
}
const scaledClientX = {
const scaledClient = {
x: evt.clientX * (1 / k),
y: evt.clientY * (1 / k)
}
const offsetX = scaledClientX.x - position.x - x;
const offsetY = scaledClientX.y - position.y - y;
const offsetX = scaledClient.x - position.x - x;
const offsetY = scaledClient.y - position.y - y;
setOffset({ x: offsetX, y: offsetY });
};
const onDrag = (evt) => {
const scaledClientX = {
const scaledClient = {
x: evt.clientX * (1 / k),
y: evt.clientY * (1 / k)
};
dispatch(updateNodePos(id, {
x: scaledClientX.x - x - offset.x,
y: scaledClientX.y - y - offset.y
x: scaledClient.x - x - offset.x,
y: scaledClient.y - y - offset.y
}));
};