feat(library): route straight edges and tidy syntax trees - #835
feat(library): route straight edges and tidy syntax trees#835FelixTJDietrich wants to merge 6 commits into
Conversation
fa52ca3 to
9dd8f0e
Compare
Claudia-Anthropica
left a comment
There was a problem hiding this comment.
@FelixTJDietrich The deterministic routing and tidy-tree work is thoughtfully structured, but the new straight router can still pass through a nearby node and can miss sibling-only crossings. Native-handle commits can also diverge from the preview; I left the concrete fixes inline.
9dd8f0e to
20db1b6
Compare
Claudia-Anthropica
left a comment
There was a problem hiding this comment.
@FelixTJDietrich The follow-up fixes address the obstacle-halo, sibling-crossing, and native-handle preview/commit issues from my previous review, with focused regressions covering each path. The relevant local unit suites pass, so this looks good to merge.
Claudia-Anthropica
left a comment
There was a problem hiding this comment.
@FelixTJDietrich The new commits preserve obstacle-body safety while stabilizing straight-edge routing, aimed-outline previews, and worker-backed interaction performance. The previous findings remain resolved, all captured CI checks pass, and I found no current blocking defect.
Summary
This PR adds automatic routing for straight-edge diagram families and a tidy
layout for syntax trees:
meets a node; connector crossings keep the existing line-jump presentation.
paths, and never replace a readable crossing with a disproportionate trip
around the diagram.
borders instead of stacking on one point.
never written into the diagram model.
ApollonEditor.layoutSyntaxTree()API.The branch is rebased directly onto the current
main, which includes thestraight-edge editing work from #834.
Follow-up to the node-overlap report in #282, which was closed by the manual
straight-edge editing work in #834. Long-text wrapping is outside this PR and is
not claimed as fixed.
Why this is intentionally conservative
Automatic routing should help without making a diagram feel restless:
the full 10 px minimum clearance. A nearby node therefore does not trigger a
route change just because it enters the preferred clearance halo.
direct and predictable, while the existing line jumps preserve readability.
node corner from flipping the connection to another side.
gesture. It changes immediately only if keeping it would cross a node, then
settles to the exact route on release.
diagrams. The display-only handoff preserves diagonal polylines instead of
briefly turning them into step edges.
Compatibility and failure behavior
when the pointer is off-center or nodes overlap.
cyclic, multi-parent, and otherwise malformed components stay where the user
placed them.
performs the same inset-aware fit as the public API.
layoutSyntaxTree()is additive and is a no-op for other diagram types.Release note
Keep straight connections clear, stable, and responsive automatically. They now
choose facing sides, spread sibling links across shared borders, and route around
nodes without reorganizing when other connections cross them; clear shots remain
straight and hand-placed routes stay exactly as drawn. Syntax trees also gain a
one-click tidy layout that arranges valid parent-child forests while leaving
malformed portions untouched.
Implementation notes
including deterministic tie-breaking.
newly relevant node bodies locally, and has a bounded full-field fallback.
their clearance halo.
reduced the worst solve from 2,629.7 ms to 20.5 ms. This is a regression
fixture result, not a general-purpose benchmark.
Steps for testing
straight connections avoid intervening nodes.
remain straight. Move it into the line; the edge should take a compact,
well-cleared detour.
does not jump sides on small movements.
connections and confirm they remain direct and use the existing line jump.
route should remain exactly as drawn.
endpoint exactly matches the preview.
inset-aware fit. Repeat with cyclic or multi-parent content and confirm the
malformed components are not rearranged.
ApollonEditor.layoutSyntaxTree()on a syntax tree and on anotherdiagram type; confirm layout in the former and a no-op in the latter.
Verification
pnpm lint && pnpm format:check && pnpm build && pnpm testpnpm --filter @tumaet/apollon sizeScreenshots / screencasts
Captured from this branch's production build after choosing Tidy tree layout.
Deterministic geometry fixtures cover route quality and failure cases beyond this
representative diagram.
Checklist