fix(edge): respect handle.style left/top offset when computing edge endpoints#3
Open
pshoukry wants to merge 1 commit intorocket4ce:mainfrom
Open
Conversation
When a handle carries a `left` (for top/bottom handles) or `top` (for left/right handles) percentage in its `style` map, the handle element is rendered at that offset by the browser but the SVG edge was still computed from the centre of the side. Result: the edge line didn't meet the handle circle — a visible gap on branching nodes that spread their source handles (Condition/Switch/ForEach patterns). Edge now parses the percentage from `handle.style` and shifts the endpoint along the axis the handle sits on. Non-matching / absent / invalid values fall back to the previous centred behaviour. Adds five component tests exercising spread source handles on top, bottom, and right sides, plus the fallback paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem: Adding multiple handles on the same side ( example: conditional with more than 3 / 4 options like a case ) is impossible since each side positions its handle at a 50% marker.
Solution: Allow adding multiple handles and distributing them evenly on the side.
When a handle carries a
left(top/bottom handles) ortop(left/right handles) percentage in itsstylemap, the handle element is rendered at that visual offset by the browser — but the SVG edge endpoint was still computed from the centre of the side. Result: the edge line doesn't meet the handle circle, leaving a visible gap on branching nodes that spread their source handles (e.g. Condition / Switch / ForEach patterns where `true` and `false` handles sit at 25% and 75% of the bottom edge).`LiveFlow.Handle` already exposes a public `:style` field intended for "Custom inline styles" — this change makes edge rendering consistent with that field instead of silently ignoring it.
Behaviour
Test plan
Five new component tests in `test/live_flow/components/edge_test.exs` covering:
Full suite: 194 tests, 0 failures.