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

[Feature] Local direction inside containers #1559

Closed
zzgab opened this issue Aug 20, 2023 · 8 comments
Closed

[Feature] Local direction inside containers #1559

zzgab opened this issue Aug 20, 2023 · 8 comments

Comments

@zzgab
Copy link

zzgab commented Aug 20, 2023

Currently the direction is only on root-level.

I would like to obtain this result:

  A
  |
  B — E
  |
  C
  |
  D

I tried with direction: down but the layout will put C and E on an equal row.
I tried to make a transparent container for B and E, but even inside this container, the applied direction is down, yet I would like it to be right.

(I also tried using imports, where the desired direction is specified inside the imported file, but it is ignored.)

I wonder if it is possible to implement inner-direction for a container.

Thanks

@cyborg-ts cyborg-ts added this to D2 Aug 20, 2023
@bo-ku-ra
Copy link
Contributor

i hope this and #949 are resolved together.

@zzgab
Copy link
Author

zzgab commented Aug 21, 2023

Thanks 🙏 Sorry for the kind of duplicate!
Awesome work.

@AndreiPashkin
Copy link

@zzgab

It seems like ELK.js layout engine doesn't support this:
kieler/elkjs#26

@alixander
Copy link
Collaborator

yeah that's right. works in TALA but not for other layout engines, fundamental restrictions with their algorithms unfortunately

@alixander alixander closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2023
@github-project-automation github-project-automation bot moved this to Done in D2 Dec 8, 2023
@AndreiPashkin
Copy link

This thing made me moving to Mermaid.js

@alixander
Copy link
Collaborator

alixander commented Dec 9, 2023

@AndreiPashkin Mermaid.js can't do it either, they use dagre too.

@bo-ku-ra
Copy link
Contributor

bo-ku-ra commented Dec 9, 2023

It's not impossible.

https://play.d2lang.com/?l=&script=VIxBCoMwEEX3OcXHZSGDUVdzmzQJ6YA1ElOKSO9eRty4ebzhDT9XiTaU-fNeNoYz5539yuhNLV-nGBhHlJpCk7IwquRX-2kYFZPiweg6HFvb50Rl9UHazujPL0ce1kKH6HnZSOGyiaK5pYGS-QcAAP__&

grid-columns: 1
grid-gap: 0
row1
row2: {direction: right}
row3
row4
row*: "" {style.opacity: 0}
row1.a -- row2.b -- row3.c -- row4.d
row2.b -- row2.e

@zzgab
Copy link
Author

zzgab commented Dec 9, 2023

@bo-ku-ra Thank you for the snippet.
Indeed, it gets close, with two reservations:

  1. At the time of my post, D2 did not yet allow for arrows on a Grid diagram.
  2. It is still a Grid diagram... now I have to do everything according to this peculiar layout, which is not wat I intended initially.

In my eyes it remains a major drawback of the engine.

But, thanks for the example really!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

4 participants