terrastruct / TALA

A diagram layout engine designed specifically for software architecture diagrams
https://terrastruct.com/tala
Other
194 stars 4 forks source link

specify direction per connection #35

Open alixander opened 1 year ago

alixander commented 1 year ago
          Here a variation on this problem. There is probably no way to decide algorythmically whether the photosynthesis box should be on top or on the side of the nitrogen fixation box (except that this solution would use less space).  When I was thinking of a layout grammar (for another project), I though of having syntax along the following lines:

Ocean.Surface.Nitrogen Fixation -> Ocean.Surface.Photosynthesis: NH4: right

i.e. each connection would have an optional direction keyword. Is that a feature that could be considered in the future?

direction: up

# Atmosphere -> Ocean.Surface.Nitrogen Fixation: N2
Ocean.Surface.Nitrogen Fixation -> Ocean.Surface.Photosynthesis: NH4

Ocean.Surface.Photosynthesis -> Ocean.Deep.Nitrification: Org. N
Ocean.Deep.Nitrification -> Ocean.Deep.Denitrification/Anammox: NH3
# Ocean.Deep.Denitrification/Anammox -> Atmosphere: N2
Ocean.Deep.Nitrification -> Ocean.Surface.Photosynthesis: NH3

Originally posted by @uliw in https://github.com/terrastruct/TALA/issues/32#issuecomment-1435708732

uliw commented 1 year ago

I played a bit with the new position keywords, which are really helpful. Looking at this graph

https://play.d2lang.com/?script=jJLBaoQwEIbv8xTzArW2aS-hFAQpPcVCnyDIqDmYSJIFl2XffcmysEGN8Sb4_fP__2QqPxo3DWQJv16-8f9kO9kSNi1JXQjlrelJ44-aZXgYjuIdMgyuxvwNxht31n4gpxxH8fsBe0SYUBNNkYPqVPtI0Ni-QAEpYCGuScd_Xystx9HMIQSDPLcus72TvTS5ZTA4EITjBRC9mTiWgBiONHxdIWm9qWDlXZOtlDLb73LQMALfymSbiGKfC-p5tcmotwAAAP__&layout=tala&sketch=0&

From a design view, would it be difficult to have an option to render boxes that share a hirarchy to be of equal dimension? I.e., the outer boxes would be off equal size, and thus appear much more harmonious and aligned with each other.

I haven't thought this through, but probably something like a size_ref: keyword so 'Atmospherecould referencesurface ocean. If set togroup` it would use the size of the largest box in a given hirarchy