Skip to content

Colour a gridview selection at once, in Signals panel and plot area - #511

Merged
thebhef merged 1 commit into
mainfrom
task154-colour-selection
Oct 14, 2026
Merged

thebhef merged 1 commit into
mainfrom
task154-colour-selection

Conversation

@thebhef

@thebhef thebhef commented Sep 23, 2026

Copy link
Copy Markdown
Owner

Both panels' colour pickers wrote one signal at a time even when a
multi-row selection was active, so recolouring a group meant picking
the same colour N times. Both panels already fan other actions over a
selection (the Signals panel's drag source, the plot area's Hide/Show
context menu), so the pick now follows the same "selection the
right-clicked row belongs to" rule those already use: a right-click on
a row already in the selection recolours every selected row; a
right-click outside it replaces the selection with just that row
first (the plot area's existing rule for its Hide/Show menu, now
shared by the swatch picker too).

Signals panel: SignalsPanel.tsx resolves the right-clicked row
against grid.selection and writes every non-pattern, non-section key
through a new batched onSetSignalColors callback (App.tsx's
handleSetSignalColors), threaded through ProjectContextValue
alongside the existing single-key onSetSignalColor. One
setSignalColors call, one dirty step, for however many rows the pick
touched. A pattern chip or section header caught in the selection
carries no signal key and drops out silently (ADR 0045: a pattern
names no colour).

Plot area: the swatch's right-click handler (SignalSwatch in
PlotArea.tsx) now selects the clicked row first when it isn't
already selected, then always writes through a new
onSetSelectionColor axis handler — the selection-scoped sibling of
the existing onSetSelectionHidden, implemented in PlotPanel.tsx as
setSelectionColor with the same per-row pattern-materialization rule
setSelectionHidden already has. Since every pick now goes through
this selection-based path (a lone right-click just makes a
one-row selection), the old single-ref setSignalColor /
onSetSignalColor plumbing had no remaining caller and is removed
rather than left beside the new path.

Three existing swatch-picker tests in PlotPanel.dom.test.tsx fired
the colour input's change event directly, skipping the right-click
that (now) resolves the write's target; updated them to fire
contextmenu first, matching the real gesture. The
"right-clicking the swatch..." test's expectation flips accordingly:
the previously-unselected row now becomes the selection, per the new
rule.

Storage is unchanged (ADR 0026): a plot pick still lives on the
series' colorPick, a Signals-panel pick still lives on the project's
signal_colors map.

README's plot-area colour passages and ADR 0026's picker bullet are
updated to describe the selection-scoped pick and correct two
now-false claims (swatch picks "are not selection gestures"; the
selection menu has "no bulk recolor").

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

thebhef commented Sep 23, 2026 •

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@thebhef
thebhef force-pushed the task154-colour-selection branch from e6af8ea to 640c31d Compare September 23, 2026 15:43
@thebhef
thebhef force-pushed the task150-review-followups branch from 27eaf56 to 4037d48 Compare September 23, 2026 15:43
@thebhef
thebhef force-pushed the task150-review-followups branch from 4037d48 to c826d01 Compare September 23, 2026 16:46
@thebhef
thebhef force-pushed the task154-colour-selection branch from 640c31d to 47a1442 Compare September 23, 2026 16:46
@thebhef
thebhef force-pushed the task150-review-followups branch from c826d01 to fb1984e Compare September 24, 2026 01:39
@thebhef
thebhef force-pushed the task154-colour-selection branch from 47a1442 to 78f9863 Compare September 24, 2026 01:39

thebhef commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner Author

Merge activity

  • Oct 14, 9:10 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 14, 9:12 PM UTC: Graphite rebased this pull request as part of a merge.
  • Oct 14, 9:18 PM UTC: @thebhef merged this pull request with Graphite.

@thebhef
thebhef changed the base branch from task150-review-followups to graphite-base/511 October 14, 2026 21:10
@thebhef
thebhef changed the base branch from graphite-base/511 to main October 14, 2026 21:10
Both panels' colour pickers wrote one signal at a time even when a
multi-row selection was active, so recolouring a group meant picking
the same colour N times. Both panels already fan other actions over a
selection (the Signals panel's drag source, the plot area's Hide/Show
context menu), so the pick now follows the same "selection the
right-clicked row belongs to" rule those already use: a right-click on
a row already in the selection recolours every selected row; a
right-click outside it replaces the selection with just that row
first (the plot area's existing rule for its Hide/Show menu, now
shared by the swatch picker too).

Signals panel: `SignalsPanel.tsx` resolves the right-clicked row
against `grid.selection` and writes every non-pattern, non-section key
through a new batched `onSetSignalColors` callback (App.tsx's
`handleSetSignalColors`), threaded through `ProjectContextValue`
alongside the existing single-key `onSetSignalColor`. One
`setSignalColors` call, one dirty step, for however many rows the pick
touched. A pattern chip or section header caught in the selection
carries no signal key and drops out silently (ADR 0045: a pattern
names no colour).

Plot area: the swatch's right-click handler (`SignalSwatch` in
`PlotArea.tsx`) now selects the clicked row first when it isn't
already selected, then always writes through a new
`onSetSelectionColor` axis handler — the selection-scoped sibling of
the existing `onSetSelectionHidden`, implemented in `PlotPanel.tsx` as
`setSelectionColor` with the same per-row pattern-materialization rule
`setSelectionHidden` already has. Since every pick now goes through
this selection-based path (a lone right-click just makes a
one-row selection), the old single-ref `setSignalColor` /
`onSetSignalColor` plumbing had no remaining caller and is removed
rather than left beside the new path.

Three existing swatch-picker tests in `PlotPanel.dom.test.tsx` fired
the colour input's `change` event directly, skipping the right-click
that (now) resolves the write's target; updated them to fire
`contextmenu` first, matching the real gesture. The
"right-clicking the swatch..." test's expectation flips accordingly:
the previously-unselected row now becomes the selection, per the new
rule.

Storage is unchanged (ADR 0026): a plot pick still lives on the
series' `colorPick`, a Signals-panel pick still lives on the project's
`signal_colors` map.

README's plot-area colour passages and ADR 0026's picker bullet are
updated to describe the selection-scoped pick and correct two
now-false claims (swatch picks "are not selection gestures"; the
selection menu has "no bulk recolor").

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@thebhef
thebhef force-pushed the task154-colour-selection branch from 96e6d18 to 1dbff69 Compare October 14, 2026 21:11
@thebhef
thebhef merged commit 211b176 into main Oct 14, 2026
10 checks passed
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