Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
class_name SheetCanvas
|
|
|
|
|
extends ScrollContainer
|
|
|
|
|
## The open tab's canvas: the theme's spread background (BoardBackdrop) with
|
2026-11-29 17:37:39 -06:00
|
|
|
## a free layout of boxes (SheetBoxView). The page starts at the canvas's
|
|
|
|
|
## 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.
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
## 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
|
|
|
|
|
## space clears the selection. The field palette drops new boxes here.
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
|
|
|
## Room kept around the boxes, and below them to place more.
|
|
|
|
|
const MARGIN := 16.0
|
|
|
|
|
const ROOM := 240.0
|
|
|
|
|
|
|
|
|
|
var ed: SheetEditor
|
|
|
|
|
## Fills the scroll area; draws the background.
|
|
|
|
|
var holder: Control
|
|
|
|
|
## The page the boxes sit on (box coordinates start at its top-left).
|
|
|
|
|
var area: Control
|
|
|
|
|
var views: Dictionary = {} # box id -> SheetBoxView
|
|
|
|
|
var _backdrop: BoardBackdrop
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
## The page's left edge, set when a tab opens (recentre) and kept after.
|
|
|
|
|
var _origin_x := -1.0
|
|
|
|
|
var _panning := false
|
|
|
|
|
var _pan_from := Vector2.ZERO
|
|
|
|
|
var _pan_scroll := Vector2.ZERO
|
2026-11-29 16:52:41 -06:00
|
|
|
## One grid step with a dot in its corner, drawn tiled (one draw call).
|
|
|
|
|
var _grid_tile: ImageTexture
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func setup(p_editor: SheetEditor) -> void:
|
|
|
|
|
ed = p_editor
|
|
|
|
|
add_theme_stylebox_override("panel", StyleBoxEmpty.new())
|
|
|
|
|
_backdrop = BoardBackdrop.new(ThemeStore.current)
|
|
|
|
|
holder = Control.new()
|
|
|
|
|
holder.mouse_filter = Control.MOUSE_FILTER_STOP
|
2026-11-29 16:52:41 -06:00
|
|
|
holder.texture_repeat = CanvasItem.TEXTURE_REPEAT_ENABLED
|
|
|
|
|
_grid_tile = _make_grid_tile()
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
holder.draw.connect(_draw_back)
|
|
|
|
|
holder.gui_input.connect(_area_input)
|
|
|
|
|
add_child(holder)
|
|
|
|
|
area = Control.new()
|
|
|
|
|
area.mouse_filter = Control.MOUSE_FILTER_PASS
|
|
|
|
|
holder.add_child(area)
|
|
|
|
|
resized.connect(_fit_area)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func rebuild() -> void:
|
|
|
|
|
for c in area.get_children():
|
|
|
|
|
area.remove_child(c)
|
|
|
|
|
c.queue_free()
|
|
|
|
|
views.clear()
|
|
|
|
|
for box: SheetBox in ed.current_tab()["boxes"]:
|
|
|
|
|
var view := SheetBoxView.new()
|
|
|
|
|
view.setup(ed, box)
|
|
|
|
|
area.add_child(view)
|
|
|
|
|
views[box.id] = view
|
|
|
|
|
paint_selection()
|
2026-11-29 16:52:41 -06:00
|
|
|
holder.queue_redraw()
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
if _origin_x < 0.0:
|
|
|
|
|
_fit_area.call_deferred()
|
|
|
|
|
else:
|
|
|
|
|
_fit_area()
|
|
|
|
|
|
|
|
|
|
|
2026-11-29 17:37:39 -06:00
|
|
|
## Lays the page out again the next time the canvas is laid out (a sheet or
|
|
|
|
|
## a tab was opened) and scrolls back to the top left.
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
func recentre() -> void:
|
|
|
|
|
_origin_x = -1.0
|
|
|
|
|
scroll_horizontal = 0
|
|
|
|
|
scroll_vertical = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Redraws every box but `keep_id` (the one being typed in), so formulas and
|
|
|
|
|
## live text follow the change.
|
|
|
|
|
func rebuild_except(keep_id: String) -> void:
|
|
|
|
|
for box: SheetBox in ed.current_tab()["boxes"]:
|
|
|
|
|
if box.id == keep_id or not views.has(box.id):
|
|
|
|
|
continue
|
|
|
|
|
var old: SheetBoxView = views[box.id]
|
|
|
|
|
var view := SheetBoxView.new()
|
|
|
|
|
view.setup(ed, box)
|
|
|
|
|
area.add_child(view)
|
|
|
|
|
area.move_child(view, old.get_index())
|
|
|
|
|
area.remove_child(old)
|
|
|
|
|
old.queue_free()
|
|
|
|
|
views[box.id] = view
|
|
|
|
|
view.paint(box.id == ed.selected)
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func paint_selection() -> void:
|
|
|
|
|
for id: String in views:
|
|
|
|
|
(views[id] as SheetBoxView).paint(id == ed.selected)
|
|
|
|
|
|
|
|
|
|
|
2026-11-29 17:37:39 -06:00
|
|
|
## Sizes the page to its boxes plus a screen of room right and below, its
|
|
|
|
|
## left edge at the canvas's left margin, and grows the scroll area to hold it.
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
func _fit_area() -> void:
|
|
|
|
|
var page := Vector2.ZERO
|
|
|
|
|
for view: SheetBoxView in views.values():
|
|
|
|
|
page = page.max(view.position + view.size)
|
|
|
|
|
var view_size := size
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
if _origin_x < 0.0 and view_size.x > 0.0:
|
2026-11-29 17:37:39 -06:00
|
|
|
_origin_x = MARGIN
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
area.position = Vector2(maxf(_origin_x, MARGIN), MARGIN)
|
|
|
|
|
area.size = page + view_size
|
2026-11-29 16:52:41 -06:00
|
|
|
var want := (area.position + area.size).max(view_size)
|
|
|
|
|
if want != holder.custom_minimum_size:
|
|
|
|
|
holder.custom_minimum_size = want
|
|
|
|
|
holder.queue_redraw()
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
|
|
|
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
## While a box is dragged near an edge, scrolls toward it. Returns how far
|
|
|
|
|
## the view moved, so the box can follow.
|
|
|
|
|
func edge_scroll(screen_point: Vector2) -> Vector2:
|
|
|
|
|
var r := get_global_rect()
|
|
|
|
|
var step := Vector2.ZERO
|
|
|
|
|
const EDGE := 40.0
|
|
|
|
|
const SPEED := 12.0
|
|
|
|
|
if screen_point.x > r.end.x - EDGE:
|
|
|
|
|
step.x = SPEED
|
|
|
|
|
elif screen_point.x < r.position.x + EDGE:
|
|
|
|
|
step.x = -SPEED
|
|
|
|
|
if screen_point.y > r.end.y - EDGE:
|
|
|
|
|
step.y = SPEED
|
|
|
|
|
elif screen_point.y < r.position.y + EDGE:
|
|
|
|
|
step.y = -SPEED
|
|
|
|
|
if step == Vector2.ZERO:
|
|
|
|
|
return step
|
|
|
|
|
var before := Vector2(scroll_horizontal, scroll_vertical)
|
2026-11-29 16:52:41 -06:00
|
|
|
if before.x + size.x + step.x > holder.custom_minimum_size.x or before.y + size.y + step.y > holder.custom_minimum_size.y:
|
|
|
|
|
_fit_area()
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
scroll_horizontal = int(before.x + step.x)
|
|
|
|
|
scroll_vertical = int(before.y + step.y)
|
|
|
|
|
return Vector2(scroll_horizontal, scroll_vertical) - before
|
|
|
|
|
|
|
|
|
|
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
func _draw_back() -> void:
|
|
|
|
|
_backdrop.draw(holder, Rect2(Vector2.ZERO, holder.size))
|
|
|
|
|
if ed.doc and ed.doc.tint != "":
|
|
|
|
|
holder.draw_rect(Rect2(Vector2.ZERO, holder.size), Color(Color(ed.doc.tint), 0.28))
|
|
|
|
|
_draw_grid()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## The snap grid as dots over the whole canvas (Build only), lined up with the
|
2026-11-29 16:52:41 -06:00
|
|
|
## page's corner so boxes snap onto the dots: one tiled texture.
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
func _draw_grid() -> void:
|
|
|
|
|
if ed.doc == null or not ed.building():
|
|
|
|
|
return
|
2026-11-29 16:52:41 -06:00
|
|
|
var start := area.position.posmod(SheetKinds.GRID) - Vector2.ONE * SheetKinds.GRID
|
|
|
|
|
holder.draw_texture_rect(_grid_tile, Rect2(start, holder.size + Vector2.ONE * SheetKinds.GRID * 2.0), true)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static func _make_grid_tile() -> ImageTexture:
|
|
|
|
|
var n := int(SheetKinds.GRID)
|
|
|
|
|
var img := Image.create(n, n, false, Image.FORMAT_RGBA8)
|
|
|
|
|
img.fill(Color(0, 0, 0, 0))
|
|
|
|
|
var dot := Color(Style.ON_BG, 0.22)
|
|
|
|
|
for p: Vector2i in [Vector2i(0, 0), Vector2i(1, 0), Vector2i(0, 1), Vector2i(1, 1)]:
|
|
|
|
|
img.set_pixelv(p, dot)
|
|
|
|
|
return ImageTexture.create_from_image(img)
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
|
|
|
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
## Empty space: a click clears the selection; a left- or middle-drag pans.
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
func _area_input(ev: InputEvent) -> void:
|
|
|
|
|
var mb := ev as InputEventMouseButton
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
if mb and (mb.button_index == MOUSE_BUTTON_LEFT or mb.button_index == MOUSE_BUTTON_MIDDLE):
|
|
|
|
|
if mb.pressed:
|
|
|
|
|
if mb.button_index == MOUSE_BUTTON_LEFT and ed.selected != "":
|
|
|
|
|
ed.select("")
|
|
|
|
|
_panning = true
|
|
|
|
|
_pan_from = mb.global_position
|
|
|
|
|
_pan_scroll = Vector2(scroll_horizontal, scroll_vertical)
|
|
|
|
|
holder.mouse_default_cursor_shape = Control.CURSOR_DRAG
|
|
|
|
|
else:
|
|
|
|
|
_panning = false
|
|
|
|
|
holder.mouse_default_cursor_shape = Control.CURSOR_ARROW
|
|
|
|
|
holder.accept_event()
|
|
|
|
|
return
|
|
|
|
|
var mm := ev as InputEventMouseMotion
|
|
|
|
|
if mm and _panning:
|
|
|
|
|
pan_to(_pan_scroll - (mm.global_position - _pan_from))
|
|
|
|
|
holder.accept_event()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Scrolls to `at` (scroll pixels), growing the canvas when needed.
|
|
|
|
|
func pan_to(at: Vector2) -> void:
|
2026-11-29 16:52:41 -06:00
|
|
|
if at.x + size.x > holder.custom_minimum_size.x or at.y + size.y > holder.custom_minimum_size.y:
|
|
|
|
|
_fit_area()
|
Sheets phase C: every field kind, details panel, canvas panning
- 25 palette items over 23 kinds: basics, trackers (bars, ticks, clocks,
dots, step/usage dice, ladders), formulas and dice buttons (rule
language with sheet @names), lists (rows, mini table, chips, point pool
that may go negative, bonds), slots, conditions, spell slots, XP,
currency, heading, divider, picture.
- Per-kind settings in the inspector; hover excerpts and an in-app
details panel for list entries; live redraw of dependent boxes.
- Canvas: the page stays put after edits (boxes can go anywhere), a
screen of room past the boxes, drag-to-pan and edge scrolling.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 16:28:04 -06:00
|
|
|
scroll_horizontal = int(maxf(at.x, 0))
|
|
|
|
|
scroll_vertical = int(maxf(at.y, 0))
|
Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
(blank or a template); editor with folder tabs, snap-grid canvas on the
spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 15:53:56 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
## The middle of what is on screen, in page coordinates.
|
|
|
|
|
func visible_center() -> Vector2:
|
|
|
|
|
return Vector2(scroll_horizontal, scroll_vertical) + size / 2.0 - area.position
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## A screen point in page coordinates, or Vector2.INF when it isn't over the canvas.
|
|
|
|
|
func drop_point(screen_point: Vector2) -> Vector2:
|
|
|
|
|
if not is_visible_in_tree() or not get_global_rect().has_point(screen_point):
|
|
|
|
|
return Vector2.INF
|
|
|
|
|
return screen_point - area.global_position
|