plot icon indicating copy to clipboard operation
plot copied to clipboard

link insets

Open Fil opened this issue 3 years ago • 2 comments

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 avatar Jun 08 '22 09:06 Fil

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.

Fil avatar Jun 08 '22 16:06 Fil

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.

mbostock avatar Jun 09 '22 00:06 mbostock