[PR #2041] [MERGED] Fix Avatar Crop mount sizing #5404

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/2041
Author: @cha1latte
Created: 6/3/2026
Status: ✅ Merged
Merged: 6/3/2026
Merged by: @cha1latte

Base: refactor ← Head: fix/issue-2003-avatar-crop-stability


📝 Commits (1)

  • 7885b5e Fix avatar crop mount sizing

📊 Changes

1 file changed (+71 additions, -62 deletions)

View changed files

📝 src/shared/components/ui/AvatarCropWidget.tsx (+71 -62)

📄 Description

Linked issue

Closes #2003

Why this change

  • Opening the character editor Metadata tab can briefly show Avatar Crop at the fallback square size before image measurement finishes, then snap down to the measured avatar dimensions.

What changed

  • Keeps Avatar Crop's outer crop stage at stable bounded dimensions during image load.
  • Moves the measured avatar image and crop handles into an inner frame that matches the loaded image dimensions.
  • Hides the image while imgRect is not initialized, preventing the fallback 360x360 image from painting as a visible oversized first frame.

Refactor impact

Primary owner:

Catalog / shared UI.

Impact areas reviewed:

  • Character Metadata tab Avatar Crop usage.
  • Persona Description tab Avatar Crop usage through the shared widget.
  • Small, wide, tall, and same-widget source-switch avatar geometry.

Boundary notes:

  • React UI-only change in src/shared/components/ui/AvatarCropWidget.tsx.
  • No engine, shared API, Tauri/Rust, storage, provider, import/export, or remote-runtime boundary changes.

Pressure points touched:

  • None.

Validation

  • Matching validation command passes locally (for example pnpm typecheck, pnpm build, pnpm check:architecture, pnpm check:docs, or full pnpm check when warranted)
  • Full pnpm check passes before PR push/handoff
  • Human/manual validation completed by contributor or reviewer

Manual verification notes

  • node scratch/avatar-crop-measure.mjs against unpatched origin/refactor: reproduced visible pre-measure 360x360 crop image for small, wide, tall, and same-widget source-switch cases; after load, the stage snapped to 120x240, 360x180, or 180x360.
  • node scratch/avatar-crop-measure.mjs against this branch: pre-measure image is hidden inside a stable 360x360 stage; loaded inner frames resolve to 120x240, 360x180, and 180x360; same-widget source switch stays stable and hidden until the new image resolves to 360x180.
  • pnpm typecheck passed.
  • pnpm check passed.
  • Workflow note: C:/Users/celia/.codex/tools/marinara-proof-gate.mjs is referenced by local workflow docs but is not present on this machine, so that optional artifact gate could not be run.

Feature Discoverability

Check exactly one:

  • Updated src/features/shell/discovery/ because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool.
  • N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find.

Reason:

  • Bugfix for an existing editor widget; no new discoverable feature or workflow.

Docs and release impact

  • No docs changes needed
  • Updated README.md
  • Updated CONTRIBUTING.md
  • Updated docs/developer/
  • Updated repo skills or AGENTS.md
  • Confirmed this PR does not restore old staging/package-workspace/release claims

UI evidence

Reviewer-visible image upload is still pending for this draft. Local proof screenshots from the verification run are in scratch/avatar-crop-broken-before.png, scratch/avatar-crop-before.png, and scratch/avatar-crop-after.png; gh gist create could not upload binary PNG files from this environment, so the PR remains draft until these are attached through a GitHub-renderable upload path.


🔄 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/2041 **Author:** [@cha1latte](https://github.com/cha1latte) **Created:** 6/3/2026 **Status:** ✅ Merged **Merged:** 6/3/2026 **Merged by:** [@cha1latte](https://github.com/cha1latte) **Base:** `refactor` ← **Head:** `fix/issue-2003-avatar-crop-stability` --- ### 📝 Commits (1) - [`7885b5e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7885b5ed6477c4c9dda3da6d2b5d84786cf62b35) Fix avatar crop mount sizing ### 📊 Changes **1 file changed** (+71 additions, -62 deletions) <details> <summary>View changed files</summary> 📝 `src/shared/components/ui/AvatarCropWidget.tsx` (+71 -62) </details> ### 📄 Description <!-- Target branch: `refactor`. Change the base to `refactor` before submitting unless a maintainer explicitly asked for another base. --> <!-- Keep all checkboxes unchecked until a human has actually verified them. --> ## Linked issue <!-- Every user-facing PR should reference a feature request or issue report when practical. --> Closes #2003 ## Why this change <!-- What user problem, bug, refactor goal, or maintenance need does this solve? --> - Opening the character editor Metadata tab can briefly show Avatar Crop at the fallback square size before image measurement finishes, then snap down to the measured avatar dimensions. ## What changed <!-- List the key changes in this PR. --> - Keeps Avatar Crop's outer crop stage at stable bounded dimensions during image load. - Moves the measured avatar image and crop handles into an inner frame that matches the loaded image dimensions. - Hides the image while `imgRect` is not initialized, preventing the fallback `360x360` image from painting as a visible oversized first frame. ## Refactor impact Primary owner: <!-- Examples: app shell, catalog, chat mode, roleplay mode, game mode, runtime generation, world-state, shared API, engine generation, Rust storage, imports, remote runtime. --> Catalog / shared UI. Impact areas reviewed: - Character Metadata tab Avatar Crop usage. - Persona Description tab Avatar Crop usage through the shared widget. - Small, wide, tall, and same-widget source-switch avatar geometry. Boundary notes: <!-- Note engine/shared-api/feature/Rust/remote-runtime boundaries. Say "none" only if you checked. --> - React UI-only change in `src/shared/components/ui/AvatarCropWidget.tsx`. - No engine, shared API, Tauri/Rust, storage, provider, import/export, or remote-runtime boundary changes. Pressure points touched: <!-- Mention ModeSurface, GameSurface, shared mode UI, src-tauri/src/lib.rs command registration, or import modules if touched. --> - None. ## Validation <!-- Check only what you personally ran or manually verified. Treat unchecked items as explicit TODOs. --> <!-- Do not submit *.test.ts or *.test.tsx files as PR proof; cite existing checks, command output, app/browser/Tauri verification, or manual notes instead. --> - [ ] Matching validation command passes locally (for example `pnpm typecheck`, `pnpm build`, `pnpm check:architecture`, `pnpm check:docs`, or full `pnpm check` when warranted) - [ ] Full `pnpm check` passes before PR push/handoff - [ ] Human/manual validation completed by contributor or reviewer ### Manual verification notes <!-- Describe exact commands and manual steps, including typecheck/build/docs/architecture/Rust/browser/remote-runtime checks when they apply. If an AI agent filled this out, verify it yourself before ticking boxes. --> - `node scratch/avatar-crop-measure.mjs` against unpatched `origin/refactor`: reproduced visible pre-measure `360x360` crop image for small, wide, tall, and same-widget source-switch cases; after load, the stage snapped to `120x240`, `360x180`, or `180x360`. - `node scratch/avatar-crop-measure.mjs` against this branch: pre-measure image is hidden inside a stable `360x360` stage; loaded inner frames resolve to `120x240`, `360x180`, and `180x360`; same-widget source switch stays stable and hidden until the new image resolves to `360x180`. - `pnpm typecheck` passed. - `pnpm check` passed. - Workflow note: `C:/Users/celia/.codex/tools/marinara-proof-gate.mjs` is referenced by local workflow docs but is not present on this machine, so that optional artifact gate could not be run. ## Feature Discoverability Check exactly one: - [ ] Updated `src/features/shell/discovery/` because this PR adds or materially changes a user-discoverable feature, workflow, setting, mode, panel, import path, agent, media capability, or advanced tool. - [x] N/A because this PR is only a bugfix, refactor, test, docs, internal wiring, visual polish, copy edit, or compatibility fix and does not add a new thing users need to find. Reason: - Bugfix for an existing editor widget; no new discoverable feature or workflow. ## Docs and release impact - [x] No docs changes needed - [ ] Updated `README.md` - [ ] Updated `CONTRIBUTING.md` - [ ] Updated `docs/developer/` - [ ] Updated repo skills or `AGENTS.md` - [x] Confirmed this PR does not restore old staging/package-workspace/release claims ## UI evidence <!-- Add before/after screenshots or recordings for visible UI changes. --> Reviewer-visible image upload is still pending for this draft. Local proof screenshots from the verification run are in `scratch/avatar-crop-broken-before.png`, `scratch/avatar-crop-before.png`, and `scratch/avatar-crop-after.png`; `gh gist create` could not upload binary PNG files from this environment, so the PR remains draft until these are attached through a GitHub-renderable upload path. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:16:00 +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#5404
No description provided.