Sheet canvas: page starts at the left edge so boxes can go left; docs

The page was placed in the middle of the canvas, so boxes could not be
dragged left of it. Design doc: Sheets status, open items, review list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
RobinFiredrake 2026-11-29 17:37:39 -06:00
parent 317cac7a78
commit 160848f881
4 changed files with 36 additions and 12 deletions

View file

@ -1,6 +1,6 @@
# Table Tarot (repo: TableTower) — Status and Plan # Table Tarot (repo: TableTower) — Status and Plan
**Engine:** Godot 4.7.2 (GDScript) · **Started:** 2026-11-08 · **Last updated:** 2026-11-25 (test time **Engine:** Godot 4.7.2 (GDScript) · **Started:** 2026-11-08 · **Last updated:** 2026-11-29 (Sheets merged; before that 2026-11-25, test time
budget and test audit, branch `test-budget`) budget and test audit, branch `test-budget`)
The short page to read at the start of every session. Everything else is read only when needed: The short page to read at the start of every session. Everything else is read only when needed:
@ -33,9 +33,15 @@ mascot, **Morgan Fortuna** ("Morgan"; they/them in any UI text, kept gender-neut
| Ledger (card kind; "for the time being", user 2026-11-11) | variable card, `var_type: "collection"` | | Ledger (card kind; "for the time being", user 2026-11-11) | variable card, `var_type: "collection"` |
Card, Result, Change, Reset, Dice wording rules: `docs/HISTORY.md` §6 "Terminology". Card, Result, Change, Reset, Dice wording rules: `docs/HISTORY.md` §6 "Terminology".
## 3a. Now: Sheets and the unified editor (2026-11-29) ## 3a. Sheets and the unified editor (2026-11-29, merged to `main`)
Spec, decisions, phases and code map: `docs/SHEETS.md`. Phase A (card palette) committed on Spec, the user's decisions, phases and code map: `docs/SHEETS.md`. All phases built, tested and
`card-palette`; phase B base (main menu, Sheets, sheet editor) on `sheets`. Not hand-tested or merged. merged: A card palette (left dock Cards | List, search, drag to add), B main menu + Sheets + sheet
editor, C every field kind, D sheets on spreads as linked Sheet cards (@name / @prefix_name, locks,
old Sheet cards migrated), E export/import, text toolbar + Lore links, Lore Index "My library" +
item sheets, phone stacked view. The user hand-tested A–D during the work; E only lightly.
**Open for the user:** the setting limits (ticks 40, dots 20, clock 24, slots 60, phone order 999,
undo 200 steps, formula depth 8) and the review list at the end of `docs/SHEETS.md`.
**Size audit due:** `ui/sheet_editor.gd` ~373 lines, `ui/main_cli.gd` ~309.
## 3. Where things stand (2026-11-11) ## 3. Where things stand (2026-11-11)
- **Everything from the 2026-11-10 plan is built, tested and on `main`** (pushed): theme system, - **Everything from the 2026-11-10 plan is built, tested and on `main`** (pushed): theme system,

View file

@ -153,3 +153,13 @@ an old sheet card becomes a sheet with one text box.
- CLI (`ui/main_cli_sheets.gd`): `--menu`, `--sheets`, `--sheet-demo` (+ `--sheet-build`, `--sheet-lore` (a linked Lore Entry - CLI (`ui/main_cli_sheets.gd`): `--menu`, `--sheets`, `--sheet-demo` (+ `--sheet-build`, `--sheet-lore` (a linked Lore Entry
in the panel), `--sheet-edit=TITLE` (that text box open with its toolbar), `--sheet-lore-index` (the Lore in the panel), `--sheet-edit=TITLE` (that text box open with its toolbar), `--sheet-lore-index` (the Lore
Index beside it, with a My library item dropped in)), `--new-sheet`. Suites: `test_sheets`, `test_sheet_editor`. Index beside it, with a My library item dropped in)), `--new-sheet`. Suites: `test_sheets`, `test_sheet_editor`.
## 6. Review list (decisions made during phase E, for the user)
- My library has no undo (saved at once); copying an entry into it drops its picture.
- A linked list row keeps its own copy of the entry's text; deleting an entry leaves its item sheet.
- A Lore drop on notes appends the link (not at the cursor); the print page leaves out pictures; no
"import as template".
- Phones: no pinch zoom on the sheet canvas; Rows-style stats stay rows (no big tiles); no Lore drops
onto stacked boxes; narrow desktop windows keep the desktop layout.
- Sheet canvas (2026-11-29 fix): the page starts at the left edge, not centred, so boxes can be
dragged anywhere, left included.

View file

@ -86,6 +86,14 @@ func _test_boxes() -> void:
ed.canvas._fit_area() ed.canvas._fit_area()
_eq(ed.canvas.area.position.x, page_x, "moving a box far right doesn't shift the page") _eq(ed.canvas.area.position.x, page_x, "moving a box far right doesn't shift the page")
_check(ed.canvas.holder.custom_minimum_size.x > box.x + box.w + ed.canvas.size.x * 0.9, "the canvas keeps a screen of room past the box") _check(ed.canvas.holder.custom_minimum_size.x > box.x + box.w + ed.canvas.size.x * 0.9, "the canvas keeps a screen of room past the box")
_eq(ed.canvas.area.position.x, SheetCanvas.MARGIN, "the page starts at the canvas's left edge")
view = ed.canvas.views[box.id]
view.begin_drag("move")
view.drag_to(Vector2(-100000, 0), true)
view.end_drag()
_eq(box.x, 0.0, "a box can go all the way to the left edge")
ed.undo()
box = ed.doc.find_box(box.id)
ed.canvas.pan_to(Vector2(300, 0)) ed.canvas.pan_to(Vector2(300, 0))
await _frames() await _frames()
_eq(ed.canvas.scroll_horizontal, 300, "panning scrolls the canvas") _eq(ed.canvas.scroll_horizontal, 300, "panning scrolls the canvas")

View file

@ -1,8 +1,9 @@
class_name SheetCanvas class_name SheetCanvas
extends ScrollContainer extends ScrollContainer
## The open tab's canvas: the theme's spread background (BoardBackdrop) with ## The open tab's canvas: the theme's spread background (BoardBackdrop) with
## a free layout of boxes (SheetBoxView). The page is centred when a tab opens ## a free layout of boxes (SheetBoxView). The page starts at the canvas's
## and then stays put, with a screen of room past its boxes to drag into. ## left edge (not centred: a centred page left no room to drag boxes left of
## it), with a screen of room past its boxes to drag into.
## Drag empty space (or middle-drag) to pan; a box dragged near an edge ## Drag empty space (or middle-drag) to pan; a box dragged near an edge
## scrolls the canvas. In Build it shows the snap grid as dots; clicking empty ## scrolls the canvas. In Build it shows the snap grid as dots; clicking empty
## space clears the selection. The field palette drops new boxes here. ## space clears the selection. The field palette drops new boxes here.
@ -62,8 +63,8 @@ func rebuild() -> void:
_fit_area() _fit_area()
## Centres the page again the next time the canvas is laid out (a sheet or a ## Lays the page out again the next time the canvas is laid out (a sheet or
## tab was opened) and scrolls back to the top. ## a tab was opened) and scrolls back to the top left.
func recentre() -> void: func recentre() -> void:
_origin_x = -1.0 _origin_x = -1.0
scroll_horizontal = 0 scroll_horizontal = 0
@ -92,16 +93,15 @@ func paint_selection() -> void:
(views[id] as SheetBoxView).paint(id == ed.selected) (views[id] as SheetBoxView).paint(id == ed.selected)
## Sizes the page to its boxes plus a screen of room right and below, keeps ## Sizes the page to its boxes plus a screen of room right and below, its
## its left edge where the tab opened it (centred then), and grows the scroll ## left edge at the canvas's left margin, and grows the scroll area to hold it.
## area to hold it.
func _fit_area() -> void: func _fit_area() -> void:
var page := Vector2.ZERO var page := Vector2.ZERO
for view: SheetBoxView in views.values(): for view: SheetBoxView in views.values():
page = page.max(view.position + view.size) page = page.max(view.position + view.size)
var view_size := size var view_size := size
if _origin_x < 0.0 and view_size.x > 0.0: if _origin_x < 0.0 and view_size.x > 0.0:
_origin_x = maxf(MARGIN, floorf((view_size.x - page.x - MARGIN) / 2.0)) _origin_x = MARGIN
area.position = Vector2(maxf(_origin_x, MARGIN), MARGIN) area.position = Vector2(maxf(_origin_x, MARGIN), MARGIN)
area.size = page + view_size area.size = page + view_size
var want := (area.position + area.size).max(view_size) var want := (area.position + area.size).max(view_size)