fix(canvas): selected reverse line no longer hides its difference-blend#51
Merged
Conversation
Previously the selection overlay rendered as a solid line directly on top of the body. For reverse (^LRY) lines that meant the selection covered the inversion visualisation — text or shapes layered under the line stopped showing through as long as it was selected. Switch to an Illustrator-style outline pattern: two thin parallel selection-coloured strokes offset perpendicular to the body, so the body's difference-blend keeps painting the underlying content while the outline marks the selection alongside it. Same render path for reverse and non-reverse lines — no special case needed. Offset = strokeWidth / 2 + 1 (1 px clearance outside the body). Guard against zero-length lines (would div-by-zero in the perpendicular unit-vector calc).
There was a problem hiding this comment.
Code Review
This pull request updates the selection rendering for LineObject by replacing the single selection stroke with two parallel outlines offset perpendicularly from the line body. This change preserves the line's blend mode and provides a clearer selection affordance. The review feedback suggests improving code readability by extracting repeated coordinate calculations into intermediate variables and refining the offset logic to ensure the intended visual gap between the line and its selection outline.
u8array
added a commit
that referenced
this pull request
May 10, 2026
Reviewer-spotted (gemini-code-assist on PR #51): - Hoist dispX2-dispX1 / dispY2-dispY1 into dx, dy locals; less repetition in the perpendicular-vector math. - Offset was lineStrokeWidth / 2 + 1, which puts the selection stroke *centre* 1 px past the body's edge. With a 1 px-wide selection stroke that leaves an actual visual gap of only 0.5 px between the edges. Bump to +1.5 so the gap matches the comment.
Reviewer-spotted (gemini-code-assist on PR #51): - Hoist dispX2-dispX1 / dispY2-dispY1 into dx, dy locals; less repetition in the perpendicular-vector math. - Offset was lineStrokeWidth / 2 + 1, which puts the selection stroke *centre* 1 px past the body's edge. With a 1 px-wide selection stroke that leaves an actual visual gap of only 0.5 px between the edges. Bump to +1.5 so the gap matches the comment.
31aab0e to
3a92245
Compare
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.
Previously the selection overlay rendered as a solid line directly on top of the body. For reverse (^LRY) lines that meant the selection covered the inversion visualisation — text or shapes layered under the line stopped showing through as long as it was selected.
Switch to an Illustrator-style outline pattern: two thin parallel selection-coloured strokes offset perpendicular to the body, so the body's difference-blend keeps painting the underlying content while the outline marks the selection alongside it. Same render path for reverse and non-reverse lines — no special case needed.
Offset = strokeWidth / 2 + 1 (1 px clearance outside the body). Guard against zero-length lines (would div-by-zero in the perpendicular unit-vector calc).