[GH-ISSUE #1685] Game HUD widgets reflow when one is collapsed or dragged; dragging toggles collapse #838

Closed
opened 2026-10-21 05:21:41 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @aeriondyseti on GitHub (May 31, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1685

Summary

In Game mode, the HUD widget cards are laid out in a vertical flex stack. Because
they share normal document flow, collapsing or dragging one card reflows all the
others
— collapse a widget and everything below it jumps up; drag one and the
stack shifts. This makes the HUD feel unstable during play.

Additionally, dragging a widget by its header also fires the header's click
handler on pointer-up, so repositioning a panel toggles its collapsed state
as an unwanted side effect.

Proposed fix

Render the widget cards as independently positioned floating panels:

  • A FloatingWidgetStack measures each card's natural flow position once (via
    useLayoutEffect, before paint — no flicker), then pins each card to
    position: absolute at its measured top. From then on a card's height changes
    (collapse/expand) affect only that card; neighbours don't move.
  • Re-measure only when the visible set changes (add/remove/reorder), never on
    collapse — so a minimised card leaves its slot open instead of yanking the
    others up.
  • Distinguish a drag from a click on the header (flag set on onDragStart,
    swallowed on the trailing onClick) so repositioning no longer toggles
    collapse.

Scope

Single file: src/features/modes/game/components/GameWidgetPanel.tsx.
Typecheck and lint clean.

Originally created by @aeriondyseti on GitHub (May 31, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/1685 ## Summary In Game mode, the HUD widget cards are laid out in a vertical flex stack. Because they share normal document flow, **collapsing or dragging one card reflows all the others** — collapse a widget and everything below it jumps up; drag one and the stack shifts. This makes the HUD feel unstable during play. Additionally, dragging a widget by its header also fires the header's click handler on pointer-up, so **repositioning a panel toggles its collapsed state** as an unwanted side effect. ## Proposed fix Render the widget cards as independently positioned floating panels: - A `FloatingWidgetStack` measures each card's natural flow position once (via `useLayoutEffect`, before paint — no flicker), then pins each card to `position: absolute` at its measured top. From then on a card's height changes (collapse/expand) affect only that card; neighbours don't move. - Re-measure only when the visible set changes (add/remove/reorder), never on collapse — so a minimised card leaves its slot open instead of yanking the others up. - Distinguish a drag from a click on the header (flag set on `onDragStart`, swallowed on the trailing `onClick`) so repositioning no longer toggles collapse. ## Scope Single file: `src/features/modes/game/components/GameWidgetPanel.tsx`. Typecheck and lint clean.
Author
Owner

@cha1latte commented on GitHub (May 31, 2026):

Triage note: labeling this as fixed-in-staging because PR #1686 merged into refactor with Closes #1685 and implements the described floating HUD widget stack/drag-click fix.

Leaving the issue open for now so it can close with the normal staging/main flow rather than manually closing it from the triage pass.

<!-- gh-comment-id:4587589433 --> @cha1latte commented on GitHub (May 31, 2026): Triage note: labeling this as `fixed-in-staging` because PR #1686 merged into `refactor` with `Closes #1685` and implements the described floating HUD widget stack/drag-click fix. Leaving the issue open for now so it can close with the normal staging/main flow rather than manually closing it from the triage pass.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#838
No description provided.