[PR #1686] [MERGED] refactor(game): float HUD widgets as independent pinned panels #5211

Closed
opened 2026-10-22 04:14:16 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/1686
Author: @aeriondyseti
Created: 5/31/2026
Status: ✅ Merged
Merged: 5/31/2026
Merged by: @cha1latte

Base: refactor ← Head: feat/game-widget-floating-stack


📝 Commits (1)

  • e513feb refactor(game): float HUD widgets as independent pinned panels

📊 Changes

1 file changed (+99 additions, -13 deletions)

View changed files

📝 src/features/modes/game/components/GameWidgetPanel.tsx (+99 -13)

📄 Description

Linked issue

Closes #1685

Why this change

In Game mode the HUD widget cards share normal document flow in a vertical flex
stack, so collapsing or dragging one card reflows all the others — collapse a
widget and everything below it jumps; drag one and the stack shifts. The HUD
feels unstable during play. Separately, dragging a card 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.

What changed

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

Refactor impact

Primary owner:

game mode (src/features/modes/game/components/GameWidgetPanel.tsx)

Feature/UI-only change, single file. No engine imports from React, no raw Tauri
or remote-runtime calls, no Rust/storage/schema changes.

Validation

  • pnpm check passes locally
  • pnpm typecheck passes locally
  • pnpm build passes locally
  • pnpm check:architecture passes locally
  • pnpm check:docs passes locally
  • cargo check --manifest-path src-tauri/Cargo.toml --workspace passes locally
  • Rust clippy/tests were run for Rust behavior changes
  • Browser or Tauri app manual verification completed
  • Playwright, screenshot, or recording evidence added for UI changes
  • Docs updated (or N/A)

Summary by CodeRabbit

  • Bug Fixes

    • Fixed widget collapse being accidentally triggered after dragging a card.
  • Improvements

    • HUD widget panel now maintains stable layout when collapsing or dragging cards, eliminating visual reflow.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/1686 **Author:** [@aeriondyseti](https://github.com/aeriondyseti) **Created:** 5/31/2026 **Status:** ✅ Merged **Merged:** 5/31/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `feat/game-widget-floating-stack` --- ### 📝 Commits (1) - [`e513feb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e513febf0547b5bcfac3536bbf7ad825c682022e) refactor(game): float HUD widgets as independent pinned panels ### 📊 Changes **1 file changed** (+99 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `src/features/modes/game/components/GameWidgetPanel.tsx` (+99 -13) </details> ### 📄 Description ## Linked issue Closes #1685 ## Why this change In Game mode the HUD widget cards share normal document flow in a vertical flex stack, so collapsing or dragging one card reflows all the others — collapse a widget and everything below it jumps; drag one and the stack shifts. The HUD feels unstable during play. Separately, dragging a card 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. ## What changed - Added `FloatingWidgetStack`, which measures each card's natural flow top once via `useLayoutEffect` (before paint — no flicker), then pins each card to `position: absolute` at its measured top. Height changes from collapse/expand now affect only that card; neighbours stay put. - Re-measure only when the visible set changes (add/remove/reorder), never on collapse — a minimised card leaves its slot open instead of yanking the others up to fill it. - Distinguish a drag from a click on the card header (flag set on `onDragStart`, swallowed on the trailing `onClick`) so repositioning no longer toggles the collapsed state. ## Refactor impact Primary owner: game mode (`src/features/modes/game/components/GameWidgetPanel.tsx`) Feature/UI-only change, single file. No engine imports from React, no raw Tauri or remote-runtime calls, no Rust/storage/schema changes. ## Validation - [ ] `pnpm check` passes locally - [x] `pnpm typecheck` passes locally - [ ] `pnpm build` passes locally - [ ] `pnpm check:architecture` passes locally - [ ] `pnpm check:docs` passes locally - [ ] `cargo check --manifest-path src-tauri/Cargo.toml --workspace` passes locally - [ ] Rust clippy/tests were run for Rust behavior changes - [ ] Browser or Tauri app manual verification completed - [ ] Playwright, screenshot, or recording evidence added for UI changes - [x] Docs updated (or N/A) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Fixed widget collapse being accidentally triggered after dragging a card. * **Improvements** * HUD widget panel now maintains stable layout when collapsing or dragging cards, eliminating visual reflow. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:14:16 +07:00
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#5211
No description provided.