Commit Graph

8 Commits

Author SHA1 Message Date
Calic
89cd1727f6 fix: chromeless suppresses phantom close-button + top-tier modal swallows immediately
- chromeless=true now correctly suppresses the close-button hit-test.
  Previously, chromeless widgets had an invisible 26x26 close-zone
  at the top-right that could close the widget on accidental click.
  Affected map-editor.toolbar: the mode-pill at top-right overlapped
  the phantom zone and clicking it closed the toolbar.
- input_block="all" now swallows outside-clicks immediately, not
  just when no other widget claims the event. Previously, modal
  dialogs leaked clicks to lower-tier widgets behind them.
- register docstring lists chromeless opt.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-15 02:43:46 +02:00
Calic
1fcdbd192b feat: v0.3.0 Persistent + Z-Tiers + Input-Block
Layer z_tiers (hud/normal/top), persistent windows, and input_block
routing (none/self/all) on top of v0.2.0's multi-active + layout-slot
model. Render iterates per-tier (hud->normal->top); input dispatch
iterates reverse (top->hud, within-tier reverse-open-order); modal
input_block='all' swallows misses. Persistent windows open at
register-time and are exempt from arg-less close() (so ESC and default
triggers cannot dismiss persistent toolbars/HUDs).

Adds chromeless=true opt (suppresses panel-lib's own decoration so
in-game HUD widgets like map-editor's toolbar/layers/palette can paint
their own visual style over the full widget bounds).

Adds public panel.point_in_any_panel(x, y) — module-side canvas-click
gate that returns true if (x, y) falls within any open panel's
bounds. Modules read input directly via engine.input.*; they can use
this helper to skip canvas-paint when the click landed on a panel
widget area.
2026-06-15 02:25:46 +02:00
Calic
cdf1f63895 docs: README cleanup for v0.2.0 multi-active model
- Rewrite §Scope from v0.1.0 to v0.2.0: lists multi-active +
  layout-slots as supported; restages deferred items per phase.
- Replace "active" with "open"/"focused" in API prose for
  unregister + update + render (no scalar `active` exists in
  v0.2.0).
- Add cross-ref under panel.open noting the v0.2.0 behavioral
  change (open does not auto-close other panels).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-15 01:57:02 +02:00
Calic
0d21d8abec feat: v0.2.0 multi-active panels with layout-slots
Migrate the internal model from single-active scalar to multi-active
open_order array + per-id window records. register accepts opts.layout
(11 named slots: center, left, right, top, bottom, the four corners,
left-half, right-half — plus a custom function(sw,sh)->{x,y,w,h} hook
for HP-bars and bespoke positioning). open/close/is_open accept an
optional id argument for per-id semantics; the no-arg forms preserve
the v0.1.1 contract (close() removes the focused last-opened, is_open()
returns true if any panel is open).

Input dispatch iterates open_order in reverse so the topmost panel gets
the first crack at a click; misses fall through to lower windows.
is_pausing now checks every open window for pause_on_open=true, not
just the focused one.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-15 01:46:27 +02:00
Calic
9ed60d3877 feat: close button (X) in panel title bar
Renders an X glyph in the top-right of every panel's title bar; left-
click on it calls M.close(). Hit-test in _dispatch_event runs before
the widget-forward path so the click is consumed by the panel-frame
even when a widget would otherwise handle it. Pairs with the existing
ESC-close-pattern that lives at module level.
2026-06-14 02:39:04 +02:00
Calic
b7b0ecb9f4 fix: support multiple bind_default_trigger calls
Previously trigger_action_name + trigger_widget_id were module-local
scalars, so the second bind_default_trigger call overwrote the first
(and reused the action name 'panel_toggle' so lib-core.input's binding
was also clobbered). Switched to a triggers array; each binding gets
a unique input action 'panel_toggle_<widget_id>' so multiple widgets
can be toggled by their own keys independently.
2026-06-14 02:22:51 +02:00
Calic
a445b895ee fix: hoist local M = {} above closures to resolve M.get_theme
_dispatch_event captures M at closure-definition time; with M declared
further down the file, the capture resolved to global M (nil), causing
'attempt to index a nil value (global M)' every frame the panel was open
and a mouse event was dispatched. Hoisting the table declaration above
the dispatch helpers fixes the resolution at compile time.
2026-06-14 00:05:24 +02:00
Calic
64aa1c8777 initial: panel v0.1.0 — generic panel framework 2026-06-13 23:16:00 +02:00