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

idea: rounded connections? #673

Closed
alixander opened this issue Jan 16, 2023 · 5 comments
Closed

idea: rounded connections? #673

alixander opened this issue Jan 16, 2023 · 5 comments
Assignees
Labels
good first issue Good for newcomers render

Comments

@alixander
Copy link
Collaborator

maybe border-radius can be set for connections too, and determines the rounding of bend corners.

Screen Shot 2023-01-16 at 1 26 49 PM

@alixander alixander changed the title rounded connections? idea: rounded connections? Jan 16, 2023
@cyborg-ts cyborg-ts added this to D2 Jan 16, 2023
@alixander alixander added good first issue Good for newcomers render labels Jan 20, 2023
@ShupingHe
Copy link
Contributor

@alixander i'd love to try working on this issue

@alixander
Copy link
Collaborator Author

alixander commented Feb 20, 2023

@donglixiaoche awesome!

I'd probably start by adding to this test:

name: "border-radius",

See a visual delta: ./ci/e2ereport.sh -delta -test-case=border-radius

And then keep making changes to https://github.com/terrastruct/d2/blob/master/d2renderers/d2svg/d2svg.go, rerunning the above to see what's changed, until the connections look good.

@ShupingHe
Copy link
Contributor

ShupingHe commented Feb 23, 2023

@alixander
after reading some codes, although the description above is quite concise, there are lots of details i want to confirm with you.
so, for drawing connection between shapes, basically there are these steps:

  1. use the input script to calc layout(by darge/elk layout engine), then we can get route path(points) of those connections
  2. convert these points to the actual points used by a curve
  3. construct the svg path string of these curves(bezier curve)

and below are my questions:

  1. in which condition, could a connection not be a curve?
  2. should i consider ELK graph as well?
  3. suppose our user set border-radius: 3px to a connection, how can we apply this to a bezier curve? by set an offset to those points that draw the curve?

@alixander
Copy link
Collaborator Author

alixander commented Feb 23, 2023

@donglixiaoche

  1. Depends on layout engine, continued in 2.
  2. ELK and TALA are the only ones that give orthogonal paths. Dagre's (the default) uses curves by default, and this property wouldn't make sense on them. You would just look at the ELK tests.
  3. Yeah I don't think it should have an effect on a curve.

@ShupingHe
Copy link
Contributor

@alixander cool, i will just look at ELK tests then, thx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers render
Projects
Status: Done
Development

No branches or pull requests

2 participants