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

arrowFromLocatedTrail doesn't do what the name seems to imply #320

Open
robx opened this issue Dec 3, 2018 · 2 comments
Open

arrowFromLocatedTrail doesn't do what the name seems to imply #320

robx opened this issue Dec 3, 2018 · 2 comments

Comments

@robx
Copy link
Contributor

robx commented Dec 3, 2018

If I ask for an arrow given a located trail, I'd expect the arrow to follow that trail. Instead, what seems to happen is that we take the located trail's shape, then append an arrowhead to the end, and then scale and rotate the whole arrow such that it starts at the intended start, and such that the tip of the arrow is at the original trail's end. That seems wrong.

In the example below, the arrows are drawn from located trails between centers of grid cells.

arrows-bug

What might help as a work-around is to shift the arrow-head back by its length, but I couldn't find a way to do that with the Arrows module.

@byorgey
Copy link
Member

byorgey commented Feb 10, 2019

I agree this seems wrong, but it is tricky to figure out how to do "the right thing" in a way that works sensibly in all situations. Adjusting the end of the trail by the length of the arrowhead is relatively easy to do using Diagrams.Parametric.Adjust --- IF you know the length of the arrowhead. The problem is that arrowhead sizes can scale dynamically with the size of the diagram so it is impossible to know how big the arrowhead is going to be until late in the diagram compilation process. Still, at that point it should be possible to adjust the trail. But it is unclear what to do if (a) the trail is curved or (b) the arrowhead is longer than the final segment of the trail. Thoughts welcome!

@robx
Copy link
Contributor Author

robx commented Mar 6, 2019

Don't think I know enough about the diagrams internals or the background of the arrow library design to have concrete input. Two ideas, though:

  • I originally expected to be able to place arrow heads/tails similarly to setting line caps. I.e., allowing to style not just LineCap, but maybe also the LineEndCap/LineStartCap, with arrow caps.
  • For my own purposes, I'd be happy if there were some lower level of arrows library which would allow drawing arrows (or even just arrowheads) that aren't dynamically sized. If it's just arrow heads, some helper to easily align them to the end of a trail.

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

No branches or pull requests

2 participants