Skip to content

fix(canvas): selected reverse line no longer hides its difference-blend#51

Merged
u8array merged 2 commits into
mainfrom
fix/line-reverse-selection-overlay
May 10, 2026
Merged

fix(canvas): selected reverse line no longer hides its difference-blend#51
u8array merged 2 commits into
mainfrom
fix/line-reverse-selection-overlay

Conversation

@u8array
Copy link
Copy Markdown
Owner

@u8array u8array commented May 10, 2026

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).

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).
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/components/Canvas/LineObject.tsx Outdated
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.
@u8array u8array force-pushed the fix/line-reverse-selection-overlay branch from 31aab0e to 3a92245 Compare May 10, 2026 20:04
@u8array u8array merged commit 2f19211 into main May 10, 2026
2 checks passed
@u8array u8array deleted the fix/line-reverse-selection-overlay branch May 10, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant