Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

link insets #924

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

link insets #924

wants to merge 1 commit into from

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Jun 8, 2022

For parity with Plot.arrow. I don't think it's possible to do a good job with insets and curves other than linear (step-* and bump-x/y), so I've restricted insets to the linear curve.

cc: @yurivish

closes #920

@Fil Fil requested a review from mbostock June 8, 2022 09:06
Copy link
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think we should limit this to the linear curve. We should just inset the control points regardless of curve. Or we should not do this and tell people to use the arrow mark instead.

@Fil
Copy link
Contributor Author

Fil commented Jun 8, 2022

Here's a build of the current code with the error removed:
https://observablehq.com/@fil/link-inset-924

Various curves on the link with inset points

Is it acceptable? Is there any way we could make it better? (I don't think evaluating the tangent with getPointAtLength is an option—at least, it's not available with jsdom).

We can decide to punt on this until someone figures how to solve this.

@mbostock
Copy link
Member

mbostock commented Jun 9, 2022

Is it acceptable? Is there any way we could make it better?

I think it’s probably fine, and better that throwing an error. If we wanted to be fancier, you could do a switch statement on the curves and special case a few of them. e.g., bump-x and step should inset horizontally, while bump-y should inset vertically.

If you prefer, we could also ignore the inset option for unknown/unsupported (custom) curves. But I don’t think we should error.

@Fil Fil marked this pull request as draft June 9, 2022 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inset for Plot.link
2 participants