Skip to content

Polish layer panel: collapse, reorder, palette-index colors#63

Merged
aurpelai merged 5 commits into
mainfrom
refactor/layer-ui-polish
Jun 16, 2026
Merged

Polish layer panel: collapse, reorder, palette-index colors#63
aurpelai merged 5 commits into
mainfrom
refactor/layer-ui-polish

Conversation

@aurpelai

@aurpelai aurpelai commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • LayerPanel and GlyphList now share row interactions: pointer cursor on the whole row, unified bg-accent/40 hover + bg-accent/60 selected backgrounds, icon-button clicks stop propagation so they don't double-select the row.
  • Layer color storage refactored from a stored CSS string to a colorIndex resolved through DEFAULT_LAYER_PALETTE at render time. Reordering preserves a layer's color slot; global palette changes propagate to existing glyphs automatically. DB migration (v2→v3) maps old color strings to indices by layer position.
  • New palette (white, orange, sky blue, yellow, magenta) chosen to stay distinguishable for common color-vision deficiencies; the previous palette clustered green/cyan/blue too tightly.
  • Drag-and-drop layer reordering wired to the existing reorderLayers core fn. Whole-row HTML5 DnD; source row fades, target shows a primary-colored insertion line at top or bottom edge.
  • LayerPanel now collapses like GlyphList: chevron pinned to the outer edge, 64px collapsed width, eye + palette controls remain functional, row click and DnD reorder still work. Cmd+' toggles glyph list, layer panel, atlas float, and preview float together. Header now reads "Layers (N/MAX)" so the disabled Add-at-cap state has visible context.
  • Eraser tool icon swapped to the Eraser glyph; Grid2x2X reused for GlyphList's clear-glyph action where its "wipe the grid" meaning is a better fit. Lock + delete in layer rows shrunk to icon-xs and grouped into a gap-0.5 cluster, matching the glyph row's clear/remove pair.

Test plan

  • Layer rows: hover shows accent bg; click selects; shift/cmd-click adds to multi-select.
  • Existing 5-layer glyphs render with the new palette after reload (DB migration ran).
  • Drag a layer to a new position; reorder applies and the dragged layer keeps its color slot.
  • Toggle the LayerPanel via its chevron and via cmd+'; collapsed rows still allow click-select, drag-reorder, eye + palette toggle.
  • At 5 layers the Add button is disabled and the header reads "Layers (5/5)".
  • Eraser tool icon in the toolbar; clear-glyph button shows the grid-X icon in the glyph row.

🤖 Generated with Claude Code

aurpelai and others added 5 commits June 16, 2026 20:00
- LayerPanel rows now show pointer cursor and a hover background on the whole row,
  matching the GlyphList affordance. Click anywhere on the row to select; icon
  buttons stopPropagation so their actions don't double as row selection.
- Drop the inner button around the layer name (the row is the click target).
- Merge isActive/isMultiSelected into a single isSelected styling check — both
  states are functionally interchangeable for visual selection.
- Unify hover/selected backgrounds across both panels: hover bg-accent/40,
  selected bg-accent/60.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Replace Layer.color (CSS string) with Layer.colorIndex (number), resolved
  through DEFAULT_LAYER_PALETTE at render time. Reordering layers preserves
  colorIndex so the user's "the orange layer" mental model stays stable while
  global palette changes propagate to every existing glyph automatically.
- Add layerColor(layer) helper; update LayerPanel and PixelEditor call sites.
- DB v2→v3 per-record upgrade strips the old color string and assigns
  colorIndex = layer position (old defaults always tracked creation index, so
  this is a 1:1 mapping).
- New palette (white, orange, sky blue, yellow, magenta) chosen to stay
  distinguishable for common color-vision deficiencies; the previous palette
  clustered green/cyan/blue too tightly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Whole-row HTML5 drag-and-drop wired to the existing reorderLayers core fn.
Dragging shifts the source row's opacity and shows a primary-colored insertion
line at the top or bottom edge of the target row depending on pointer position.
Click-to-select still works (DnD only kicks in past the browser's drag threshold).

The panel renders the reversed layers array (top of panel = topmost layer = last
in array), so handleDrop converts panel-space "above/below" to the corresponding
array indices before calling reorderLayers.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
LayerPanel now mirrors the GlyphList collapse pattern: a chevron pinned to the
outer (right) edge of the header toggles between expanded (224px, full row
controls) and collapsed (64px, eye + palette icons only). Row interactions —
selection, hover background, drag-and-drop reordering — work identically in
both states; only the inline name span and lock/delete cluster are hidden
when collapsed.

Cmd+' now toggles all chrome at once: glyph list, layer panel, atlas float,
and preview float. The single render path keeps width, header layout, and
row content all driven by the same `collapsed` prop, so the two states can
never drift visually.

Header label now shows "Layers (N/MAX)" — matches GlyphList's pattern and
gives the user context for when the Add button is disabled at cap.

Lock + delete moved to size="icon-xs" with h-3 w-3 icons and grouped into a
gap-0.5 cluster, matching the glyph row's clear/remove pair.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Toolbar's eraser tool now uses the Eraser icon; the Grid2x2X icon moves
  to GlyphList's clear-glyph action where its "wipe the whole grid" meaning
  reads more naturally.
- Drop aria-expanded from GlyphList's collapse/expand chevrons. The button
  variant maps aria-expanded=true to a muted background — appropriate for
  dropdown/menu triggers, but a sidebar collapse toggle is not a popover
  trigger. Removing it keeps the chevron rendering identical in both states,
  matching the new LayerPanel behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aurpelai aurpelai force-pushed the refactor/layer-ui-polish branch from 88d81fe to 8320add Compare June 16, 2026 17:42
@aurpelai aurpelai merged commit 13f3144 into main Jun 16, 2026
1 check passed
@aurpelai aurpelai deleted the refactor/layer-ui-polish branch June 16, 2026 17:44
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