Skip to content

Add canvas pane size selector (1:1 / 2:1)#87

Merged
0101 merged 3 commits into
mainfrom
canvas-size
Jun 26, 2026
Merged

Add canvas pane size selector (1:1 / 2:1)#87
0101 merged 3 commits into
mainfrom
canvas-size

Conversation

@0101

@0101 0101 commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Problem

When open, the canvas pane could only ever take half the layout. For doc-heavy work the fixed 50/50 split is often too cramped for the canvas, with no way to give it more room.

Changes

Adds a size selector to the canvas header, beside the existing position selector. It offers 1:1 (default, even split) and 2:1 (the open pane takes two-thirds of the layout), and the choice persists in global config.

  • New CanvasSize type in Shared/Types.fs (Ratio1To1 | Ratio2To1), threaded through DashboardResponse and IWorktreeApi.
  • Persistence in Server/WorktreeApi.fs (readCanvasSize / writeCanvasSize against the canvasSize config key), mirroring how CanvasPosition is stored; DemoFixture.fs and the read-only/fixture APIs updated.
  • Client wiring: SetCanvasSize message, CanvasUpdate.setCanvasSize, the CanvasState.CanvasSize field, and 1:1 / 2:1 buttons in CanvasPane.fs (App.fs applies the layout class).
  • CSS in index.html: a canvas-size-2to1 rule giving the pane 66.667% flex, reusing the existing position-button styling.
  • Spec note added in docs/spec/canvas-pane.md.

The second commit simplifies the feature: it merges the duplicate .canvas-size-group CSS into .canvas-pos-group, and factors the position/size buttons onto one shared toggleButton helper.

Tests

  • dotnet build src/Client/Client.fsproj — succeeds, 0 warnings / 0 errors.
  • dotnet test src/Tests/Tests.fsproj --filter "Category=Fast"959 passed, 0 failed.
  • ArchiveTests dashboard JSON fixture updated for the new CanvasSize field.

0101 added 2 commits June 26, 2026 17:00
Add a CanvasSize option (Ratio1To1 default, Ratio2To1) alongside the canvas dock position. Two buttons in the pane header toggle between 1:1 (even split) and 2:1, where the open pane takes two-thirds of the layout. The choice persists to global config and is restored on first load, mirroring the existing position selector.
…ggle button

Merge the identical .canvas-size-group CSS into .canvas-pos-group, and factor positionButton/sizeButton onto a shared toggleButton helper.
Copilot AI review requested due to automatic review settings June 26, 2026 15:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a size selector to the canvas pane header, letting users choose between a 1:1 (even split, default) and 2:1 (canvas takes two-thirds of the layout) ratio when the pane is open. It cleanly threads a new CanvasSize domain type through the Shared, Server, and Client layers, persists the choice in global config (mirroring the existing CanvasPosition plumbing), and reflects the choice via a canvas-size-2to1 CSS layout class. A small refactor factors the position and size buttons onto a shared toggleButton helper and merges their CSS selectors.

Changes:

  • New CanvasSize DU (Ratio1To1 | Ratio2To1) added to DashboardResponse, IWorktreeApi, and persisted server-side via readCanvasSize/writeCanvasSize.
  • Client wiring: SetCanvasSize message, CanvasUpdate.setCanvasSize, CanvasState.CanvasSize, 1:1/2:1 buttons, and a canvas-size-2to1 layout class applied in App.fs.
  • CSS, spec docs, and the ArchiveTests JSON fixture updated for the new field.
Show a summary per file
File Description
src/Shared/Types.fs Adds CanvasSize DU and threads it into DashboardResponse and IWorktreeApi.
src/Server/WorktreeApi.fs Adds read/writeCanvasSize persistence and updates both API implementations and getWorktrees.
src/Server/DemoFixture.fs Sets CanvasSize default on the base dashboard fixture.
src/Client/AppTypes.fs Adds the SetCanvasSize message.
src/Client/App.fs Applies size from response on first load and builds the canvas-size-* layout class.
src/Client/CanvasState.fs Adds CanvasSize field with Ratio1To1 default.
src/Client/CanvasUpdate.fs Adds setCanvasSize update + persistence command.
src/Client/CanvasView.fs Wires SetSize callback and passes size to CanvasPane.view.
src/Client/CanvasPane.fs Adds size buttons and factors a shared toggleButton helper.
src/Client/index.html Adds canvas-size-2to1 flex rule and merges position/size CSS selectors.
src/Tests/ArchiveTests.fs Updates dashboard JSON fixture with the CanvasSize field.
docs/spec/canvas-pane.md Documents the new size selector.

Review details

  • Files reviewed: 12/12 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread src/Client/CanvasPane.fs Outdated
@0101 0101 enabled auto-merge (squash) June 26, 2026 16:17
@0101 0101 merged commit 39d33e1 into main Jun 26, 2026
1 check 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.

2 participants