Skip to content

lib/ui: grid widget duplicates state (cells flip before on_cell) and row_labels draw at a fixed -60 offset outside the widget #572

Description

@InauguralPhysicist

Found porting Deslan Studio's 4d drum panel (step sequencer on lib/ui grid) — the next entry in the lib/ui gap series (#561#570).

Two frictions in ui_w_data.eigs's grid:

  1. The widget owns a second copy of the pattern. _mousedown_grid flips cells[r][c] itself and only then calls on_cell. An app whose model is the source of truth (DeslanStudio's DrumMachine — patterns live in the model, with undo history) must overwrite grid.cells from the model after every click, and after every model-side change (undo/redo, pattern switch, randomize), or the two drift. A cells-is-read-only mode — mousedown reports (row, col) and lets on_cell decide — would remove the double bookkeeping. (Same class as lib/ui: set_theme has no effect on widgets or renderers — sibling fragments keep the stale _theme binding #562's set_theme staleness: lib/ui state that shadows app state.)

  2. row_labels render at ax - 60, scale 1, unconditionally (_render_grid). The gutter width is not configurable, long labels overflow left or clip at the window edge if the grid sits at x < 60, and the labels are outside the widget's own bounds (so any future clipping of the widget rect would erase them). DeslanStudio positions the grid at x=76 to make the hardcoded gutter land inside its panel.

Neither blocks the port (workarounds above are in src/client/drum_view.eigs); filing per the forcing-function rule.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions