Add ability to straighten bezier curves #1056
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We'd like to be able to configure bezier curve connectors to make a straight line when the difference between the two anchors is negligible.
In this PR I've "hijacked" the
margin
param as an easy way to add this functionality, where if the difference between anchors is less than the margin, theminorAnchor
offset is not added.Please let me know your thoughts on this.
It might be worthwhile exposing the
minorAnchor
property through the params as well.I realize setting
minorAnchor
to0
would also cause the bezier to be straight, but we would like to keep that offset when they are different.One thought I had based on this PR is to scale the
minorAnchor
based on the difference between anchor points. So that if they are close together,minorAnchor
goes to 0, giving straight lines.