fprime-community / fprime-visual

Browser-based visualizer for F Prime
Apache License 2.0
6 stars 7 forks source link

New graph layout algorithm + ELK layout engine #5

Closed dandelany closed 1 year ago

dandelany commented 1 year ago

This PR adds a new layout method for graphs which uses the open source ELK/elkjs graph layout library. I've attached slides from a presentation I gave to the F' team describing the rationale for this effort: FPrimeVisualELKPresentation.pdf.

In short, this enables intelligent graph layout and edge routing, so that graphs may be rendered with fewer confusing visual artifacts, such as connection lines overlapping each other or drawn on top of boxes. Example old layout: image

New layout: image

Notes

Future work

Things I didn't get to...

Please let me know if you have any questions, happy to discuss it further. Thanks!

LeStarch commented 1 year ago

Closing and reopening to re-trigger CI.

dandelany commented 1 year ago

Ah - just took a peek at the failing tests from the CI build - I didn't realize they were there & my changes likely broke them because I changed which <script>s are included in the HTML template (some are loaded via import now). I can push a fix tomorrow or feel free to do it without me.

dandelany commented 1 year ago

@LeStarch yes that's correct, all of the files in lib/elkjs are copied from elkjs without any modifications - thanks for checking.

Looking at it again, we may not need to include the elk-api.js and elk-worker.js files since I think they are both included in the elk.bundled.js file. All of the .d.ts files are still useful to include, though, since they give you type hints in the IDE.

LeStarch commented 1 year ago

Works nicely!