react-lineto icon indicating copy to clipboard operation
react-lineto copied to clipboard

Change the break point in SteppedLine

Open iagows opened this issue 4 years ago • 0 comments

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);

iagows avatar Mar 26 '21 15:03 iagows