Skip to content

Commit

Permalink
chore(build): update
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Aug 1, 2019
1 parent 8fee391 commit 22938ba
Showing 1 changed file with 38 additions and 80 deletions.
118 changes: 38 additions & 80 deletions dist/ReactGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -30381,6 +30381,25 @@
}, style)));
});

function getEdgePositions(sourceNode, targetNode) {
var hasSourceHandle = !!sourceNode.__rg.handleBounds.source;
var hasTargetHandle = !!targetNode.__rg.handleBounds.target;
var sourceHandleX = hasSourceHandle ? sourceNode.__rg.handleBounds.source.x + sourceNode.__rg.handleBounds.source.width / 2 : sourceNode.__rg.width / 2;
var sourceHandleY = hasSourceHandle ? sourceNode.__rg.handleBounds.source.y + sourceNode.__rg.handleBounds.source.height / 2 : sourceNode.__rg.height;
var sourceX = sourceNode.__rg.position.x + sourceHandleX;
var sourceY = sourceNode.__rg.position.y + sourceHandleY;
var targetHandleX = hasTargetHandle ? targetNode.__rg.handleBounds.target.x + targetNode.__rg.handleBounds.target.width / 2 : targetNode.__rg.width / 2;
var targetHandleY = hasTargetHandle ? targetNode.__rg.handleBounds.target.y + targetNode.__rg.handleBounds.target.height / 2 : 0;
var targetX = targetNode.__rg.position.x + targetHandleX;
var targetY = targetNode.__rg.position.y + targetHandleY;
return {
sourceX: sourceX,
sourceY: sourceY,
targetX: targetX,
targetY: targetY
};
}

function renderEdge(e, props, graphContext) {
var edgeType = e.type || 'default';
var sourceNode = graphContext.state.nodes.find(function (n) {
Expand All @@ -30399,8 +30418,13 @@
}

var EdgeComponent = props.edgeTypes[edgeType] || props.edgeTypes["default"];
var hasSourceHandle = !!sourceNode.__rg.handleBounds.source;
var hasTargetHandle = !!sourceNode.__rg.handleBounds.target;

var _getEdgePositions = getEdgePositions(sourceNode, targetNode),
sourceX = _getEdgePositions.sourceX,
sourceY = _getEdgePositions.sourceY,
targetX = _getEdgePositions.targetX,
targetY = _getEdgePositions.targetY;

return React__default.createElement(EdgeComponent, {
key: e.id,
id: e.id,
Expand All @@ -30412,24 +30436,10 @@
style: e.style,
source: e.source,
target: e.target,
sourceNodeX: sourceNode.__rg.position.x,
sourceNodeY: sourceNode.__rg.position.y,
sourceNodeWidth: sourceNode.__rg.width,
sourceNodeHeight: sourceNode.__rg.height,
targetNodeX: targetNode.__rg.position.x,
targetNodeY: targetNode.__rg.position.y,
targetNodeWidth: targetNode.__rg.width,
targetNodeHeight: targetNode.__rg.height,
hasSourceHandle: hasSourceHandle,
hasTargetHandle: hasTargetHandle,
sourceHandleX: sourceNode.__rg.handleBounds.source.x,
sourceHandleY: sourceNode.__rg.handleBounds.source.y,
sourceHandleWidth: sourceNode.__rg.handleBounds.source.width,
sourceHandleHeight: sourceNode.__rg.handleBounds.source.height,
targetHandleX: targetNode.__rg.handleBounds.target.x,
targetHandleY: targetNode.__rg.handleBounds.target.y,
targetHandleWidth: targetNode.__rg.handleBounds.target.width,
targetHandleHeight: targetNode.__rg.handleBounds.target.height
sourceX: sourceX,
sourceY: sourceY,
targetX: targetX,
targetY: targetY
});
}

Expand Down Expand Up @@ -33396,40 +33406,12 @@
}

var BezierEdge = React.memo(function (props) {
var sourceNodeX = props.sourceNodeX,
sourceNodeY = props.sourceNodeY,
sourceNodeWidth = props.sourceNodeWidth,
sourceNodeHeight = props.sourceNodeHeight,
targetNodeX = props.targetNodeX,
targetNodeY = props.targetNodeY,
targetNodeWidth = props.targetNodeWidth,
targetNodeHeight = props.targetNodeHeight,
sourceHandleX = props.sourceHandleX,
sourceHandleY = props.sourceHandleY,
sourceHandleWidth = props.sourceHandleWidth,
sourceHandleHeight = props.sourceHandleHeight,
targetHandleX = props.targetHandleX,
targetHandleY = props.targetHandleY,
targetHandleWidth = props.targetHandleWidth,
targetHandleHeight = props.targetHandleHeight,
hasSourceHandle = props.hasSourceHandle,
hasTargetHandle = props.hasTargetHandle,
var sourceX = props.sourceX,
sourceY = props.sourceY,
targetX = props.targetX,
targetY = props.targetY,
_props$style = props.style,
style = _props$style === void 0 ? {} : _props$style;

var _sourceHandleX = hasSourceHandle ? sourceHandleX + sourceHandleWidth / 2 : sourceNodeWidth / 2;

var _sourceHandleY = hasSourceHandle ? sourceHandleY + sourceHandleHeight / 2 : sourceNodeHeight;

var sourceX = sourceNodeX + _sourceHandleX;
var sourceY = sourceNodeY + _sourceHandleY;

var _targetHandleX = hasTargetHandle ? targetHandleX + targetHandleWidth / 2 : targetNodeWidth / 2;

var _targetHandleY = hasTargetHandle ? targetHandleY + targetHandleHeight / 2 : 0;

var targetX = targetNodeX + _targetHandleX;
var targetY = targetNodeY + _targetHandleY;
var yOffset = Math.abs(targetY - sourceY) / 2;
var centerY = targetY < sourceY ? targetY + yOffset : targetY - yOffset;
var dAttr = "M".concat(sourceX, ",").concat(sourceY, " C").concat(sourceX, ",").concat(centerY, " ").concat(targetX, ",").concat(centerY, " ").concat(targetX, ",").concat(targetY);
Expand All @@ -33439,36 +33421,12 @@
});

var StraightEdge = React.memo(function (props) {
var sourceNodeX = props.sourceNodeX,
sourceNodeY = props.sourceNodeY,
sourceNodeWidth = props.sourceNodeWidth,
sourceNodeHeight = props.sourceNodeHeight,
targetNodeX = props.targetNodeX,
targetNodeY = props.targetNodeY,
targetNodeWidth = props.targetNodeWidth,
targetNodeHeight = props.targetNodeHeight,
sourceHandleX = props.sourceHandleX,
sourceHandleY = props.sourceHandleY,
sourceHandleWidth = props.sourceHandleWidth,
sourceHandleHeight = props.sourceHandleHeight,
targetHandleX = props.targetHandleX,
targetHandleY = props.targetHandleY,
targetHandleWidth = props.targetHandleWidth,
targetHandleHeight = props.targetHandleHeight,
hasSourceHandle = props.hasSourceHandle,
hasTargetHandle = props.hasTargetHandle,
var sourceX = props.sourceX,
sourceY = props.sourceY,
targetX = props.targetX,
targetY = props.targetY,
_props$style = props.style,
style = _props$style === void 0 ? {} : _props$style;

var _sourceHandleX = hasSourceHandle ? sourceHandleX + sourceHandleWidth / 2 : sourceNodeWidth / 2;

var sourceX = sourceNodeX + _sourceHandleX;
var sourceY = sourceNodeY + sourceNodeHeight;

var _targetHandleX = hasTargetHandle ? targetHandleX + targetHandleWidth / 2 : targetNodeWidth / 2;

var targetX = targetNodeX + _targetHandleX;
var targetY = targetNodeY;
return React__default.createElement("path", _extends({}, style, {
d: "M ".concat(sourceX, ",").concat(sourceY, "L ").concat(targetX, ",").concat(targetY)
}));
Expand Down

0 comments on commit 22938ba

Please sign in to comment.