react-lineto
react-lineto copied to clipboard
Change the break point in SteppedLine
There is a const x2 = (x0 + x1) / 2; and a const y2 = (y0 + y1) / 2;.
Maybe this / 2 could be an parameter (defaults to 0.5) so the user could change this to avoid overlaping with some other elements in screen.
Something like this:
const defaultPercentBreakPoint = 0.5;
...
renderVertical() {
...
const y2 = (y0 + y1) * (percentBreak ?? this.defaultPercentBreakPoint);
...
}
renderHorizontal(){
...
const x2 = (x0 + x1) * (percentBreak ?? this.defaultPercentBreakPoint);
...
}
SteppedLine.propTypes = Object.assign({}, {
x0: PropTypes.number.isRequired,
y0: PropTypes.number.isRequired,
x1: PropTypes.number.isRequired,
y1: PropTypes.number.isRequired,
orientation: PropTypes.oneOf(['h', 'v']),
percentBreak: PropTypes.number,
}, optionalStyleProps);