Hacker News new | ask | show | jobs
by escot 21 days ago
I have actually spent a lot of time on this. But it was for an old version of my flowchart editor that did full relayout on every edit. I tried many variations, including a fork I made of dagrejs to shoehorn it into discrete coordinates.

In the end I decided to go a different route. The current version only does incremental relayout — it tries to move only a small number of nodes to make space for the current edit. And I wrote a custom algorithm that shifts nodes out of the way to make space on edits, and trys best effort to keep edges in the same direction by detecting which got bent and iteratively moving one of their nodes.

1 comments

Smart! I've found that the UX is awful when nodes jump around too much, your approach is much better!