-
Notifications
You must be signed in to change notification settings - Fork 13
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
Allow enclosing nodes to be enclosed #45
Comments
Hmm. I'm actually surprised that it worked in 0.5.0 at all. Officially, nested enclosed nodes aren't supported - nodes can only enclose other "normal" nodes. Even though no error is produced with 0.5.0, nesting enclosed nodes doesn't work correctly in general. For example: #import "@preview/fletcher:0.5.0" as fletcher: node, edge
#fletcher.diagram(
node(enclose: ((0,0), (1,1)), stroke: red, name:<nodeenclosingcoordinates>)[Inner],
node(name:<thisnodeistheproblem>, stroke: blue, enclose: (<nodeenclosingcoordinates>, (0,3),))[Outer],
) To support nested enclose nodes, I suppose fletcher would need to resolve a dependency graph controlling the order in which nodes should be placed and sized. This is more complicated than what it does currently, which is to just place all normal nodes first and then all enclose nodes. Before considering adding such a feature, it's probably worth asking: what kind of diagram are you wanting to create that could use nesting like this? I'm interested in what users really get up to!:) |
Thanks for the quick reply. #import "@preview/fletcher:0.5.0" as fletcher: node, edge
#fletcher.diagram(
node-stroke: 1pt,
spacing: (0.5em, 1em),
node((0,1), height:2em, width:3.5em, corner-radius:8pt, "Library"),
node((1,1), height:2em, width:3.5em, corner-radius:8pt, "Library"),
node((2,1), height:2em, width:3.5em, corner-radius:8pt, "Library"),
node(name:<code>, height:2em, width:3.5em, corner-radius:8pt, enclose: ((0,0),(1,0),(2,0)), "Code"),
node(stroke: blue, enclose: (<code>, (0,1),(2,1)),),
node((1,-1), stroke:none, "Application")
) |
I'm not sure how hard it would be to allow recursively enclosed nodes, and probably won't prioritise it, but will leave this issue open. |
Thank you for the great package!
While upgrading from 0.5.0 to 0.5.1 I noticed a problem.
In 0.5.0 it is possible to enclose a node by name which already encloses coordinates with another coordinate:
Doing the same with 0.5.1 results in an error:
If the first node does not enclose coordinates there is no problem:
The text was updated successfully, but these errors were encountered: