MariesWiki
Nourished · Enhancement

Panel Editor

Planned 0/5 tasks Updated 18 Sept 2026 1 min read

Context

Both NourishedHUD / HUDEditMode / HUDEditScreen / HudLayout and the new DietScreen / DietScreenEditMode / DietScreenEditScreen / DietLayout implement nearly identical drag, resize, scale, anchor, and config-persistence logic. This is the second time this exact system has been built from scratch in Nourished, which is the natural "rule of three" signal that it belongs in MarieLib as shared infrastructure rather than duplicated per-screen.

Per the architectural principle already governing this project: MarieLib owns the HOW; Nourished owns the WHAT. Drag/resize/scale/anchor/persist is pure HOW, it has zero nutrition-domain vocabulary and should never have been written twice.

Proposed shape (rough sketch, not final)

Something like dev.marie.MariesLib.client.ui.DraggablePanel (naming TBD) that encapsulates:

  • Drag (grab offset tracking, position clamped to screen bounds)
  • Resize (diagonal-distance-based live scale preview, corner handle hit detection)
  • Anchor (corner-relative positioning so panels stay sane across different screen sizes)
  • Persistence hook (a callback/interface so the consuming mod decides where scale/offset get saved, e.g. into its own config, rather than MarieLib owning config schema)
  • Visibility/section toggle support generalized enough to cover sub-elements within a panel (independent scale per sub-box, as Diet Screen's Recent Meals/Eat more of boxes do)

Consuming mods would wire their own edit-mode keybind and config storage, but the actual math (drag math, resize math, clamping, live preview rendering helpers) lives in MarieLib once.

Why not now

This should be extracted only after the Diet Screen edit mode feature is fully stable and tested in Nourished. Generalizing mid-feature risks baking in assumptions from only two call sites and makes it harder to isolate whether a bug lives in the shared layer or the consuming mod. Do this as a deliberate follow-up task once both NourishedHUD and DietScreen are proven out, not as part of finishing the current feature.

Acceptance criteria

  • Shared drag/resize/scale/anchor logic exists in MarieLib

    • NourishedHUD ` refactored to consume it instead of its own copy

    • DietScreen refactored to consume it instead of its own copy

    • No behavior regression in either screen's edit mode

    • Any future Marie mod needing a draggable panel can adopt this with minimal new code

More Nourished enhancements