UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
class_name ZoomControl
|
|
|
|
|
|
extends HBoxContainer
|
|
|
|
|
|
## The top bar's zoom: − and + around a "90% ▾" menu that offers Fit board,
|
|
|
|
|
|
## Zoom to 100% and the minimap. The percentage follows the board's zoom,
|
|
|
|
|
|
## however it changed (buttons, wheel, Fit or a pan-and-zoom animation).
|
|
|
|
|
|
|
|
|
|
|
|
const ID_FIT := 0
|
|
|
|
|
|
const ID_ACTUAL := 1
|
|
|
|
|
|
const ID_MINIMAP := 2
|
|
|
|
|
|
const STEP := 1.15
|
|
|
|
|
|
|
|
|
|
|
|
var m: Main
|
|
|
|
|
|
var menu: MenuButton
|
|
|
|
|
|
var _shown := -1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func setup(p_main: Main) -> void:
|
|
|
|
|
|
m = p_main
|
|
|
|
|
|
add_theme_constant_override("separation", 4)
|
|
|
|
|
|
var zout := _step_button("−", "Zoom out", 1.0 / STEP)
|
|
|
|
|
|
add_child(zout)
|
|
|
|
|
|
menu = ModalCard.bar_menu_button("100% ▾")
|
2026-11-10 18:24:23 -06:00
|
|
|
|
menu.tooltip_text = "Zoom: fit the spread, 100% or the minimap"
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
menu.custom_minimum_size.x = 86
|
|
|
|
|
|
var pm := menu.get_popup()
|
2026-11-10 18:24:23 -06:00
|
|
|
|
pm.add_item("Fit spread", ID_FIT)
|
UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
the gear and footer Delete, sharing Style.overflow_button with group cards.
Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
(1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00
|
|
|
|
pm.set_item_tooltip(pm.get_item_index(ID_FIT), "Show every table")
|
|
|
|
|
|
pm.add_item("Zoom to 100%", ID_ACTUAL)
|
|
|
|
|
|
pm.add_separator()
|
|
|
|
|
|
pm.add_check_item("Minimap (M)", ID_MINIMAP)
|
|
|
|
|
|
pm.about_to_popup.connect(func() -> void:
|
|
|
|
|
|
pm.set_item_checked(pm.get_item_index(ID_MINIMAP), m.board.minimap.visible))
|
|
|
|
|
|
pm.id_pressed.connect(activate)
|
|
|
|
|
|
add_child(menu)
|
|
|
|
|
|
add_child(_step_button("+", "Zoom in", STEP))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _step_button(text: String, tip: String, factor: float) -> Button:
|
|
|
|
|
|
var b := Style.bar_button(text)
|
|
|
|
|
|
b.tooltip_text = tip
|
|
|
|
|
|
b.custom_minimum_size = Vector2(34, 0)
|
|
|
|
|
|
b.pressed.connect(func() -> void: m.board.set_zoom(m.board.zoom * factor))
|
|
|
|
|
|
return b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func activate(id: int) -> void:
|
|
|
|
|
|
match id:
|
|
|
|
|
|
ID_FIT:
|
|
|
|
|
|
m.board.fit()
|
|
|
|
|
|
ID_ACTUAL:
|
|
|
|
|
|
m.board.set_zoom(1.0)
|
|
|
|
|
|
ID_MINIMAP:
|
|
|
|
|
|
m.nav.set_minimap_visible(not m.board.minimap.visible, true)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _process(_delta: float) -> void:
|
|
|
|
|
|
if m == null or m.board == null or is_equal_approx(m.board.zoom, _shown):
|
|
|
|
|
|
return
|
|
|
|
|
|
_shown = m.board.zoom
|
|
|
|
|
|
menu.text = "%d%% ▾" % roundi(_shown * 100.0)
|