Need help with flowchart (compare 2 coordinates, code optimization) #155
Andrew15-5
started this conversation in
General
Replies: 1 comment 2 replies
-
For getting the lowest of the two coordinates, you can use a coordinate callback:
If you pass an array of a function + coordinates as coordinate, the function gets called with all Your code looks totally fine to me. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to make a flowchart from scratch, since there is no such library in Typst yet. The first time was a complete failure, as I couldn't use relative and absolute coordinates efficiently. But the second time is actually pretty good, but I still think that there could be a lot of improvements. Right now, I didn't add any functions or logic as to how flowchart elements connect or position. But they all do depend on each other, and I used relative coordinates almost everywhere.
My main concern right now is to how find the lowest of the 2 coordinates in Cartesian coordinate system. I want to put a finish block to the bottom center, but I have 2 branches of different lengths. I need to draw 1 line per branch so that both lines will be parallel and stop at the same height (Y coordinate). Here are my mock-up + how it roughly should look.
2 branches problem source
The second problem is optimization. I feel that my code can be optimized so that relative positioning and/or line connection would be more natural/universal/smart. In other words, how can I generalize the elements and their connection for easier use in any part of any flowchart. Maybe there is nothing to improve, but I want to hear some thoughts and pointers from someone who is fluent in the library. :)
Beta Was this translation helpful? Give feedback.
All reactions