[GH-ISSUE #2003] [Issue]: Character editor Avatar Crop image briefly flashes oversized #982

Closed
opened 2026-10-21 05:24:46 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @Promansis on GitHub (Jun 3, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2003

Originally assigned to: @cha1latte on GitHub.

Summary

Opening the character editor can show a brief layout flicker in the Metadata tab's Avatar Crop area: the crop image/canvas appears large first, then snaps down to the intended measured size.

Expected behavior

The Avatar Crop widget should mount at its final bounded size, or reserve a stable skeleton/placeholder size until the image is measured. The character editor page should not visibly jump when the crop image initializes.

Actual behavior

The Avatar Crop widget appears to render with fallback dimensions before the image measurement is available, then updates after handleImgLoad computes the natural-image scale. On affected character editor opens, the image under Avatar Crop briefly appears too large and then resizes correctly.

Steps to reproduce

  1. Open a character with an avatar in the character editor.
  2. Switch to or open the Metadata tab where Avatar Crop is displayed.
  3. Watch the Avatar Crop image/canvas during the first mount or after switching characters.
  4. Observe whether the crop image briefly renders large before settling to the correct size.

Impact area

  • App shell, navigation, startup, or providers
  • Catalog resources
  • Chat mode
  • Roleplay mode
  • Game mode
  • Shared mode UI
  • Runtime systems: generation, world-state, visuals, tracker, or haptics
  • Professor Mari or shell tools
  • React-free engine behavior, contracts, agents, or capability ports
  • Shared API wrapper or remote runtime routing
  • Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime
  • Docs, contributor workflow, or templates

Environment

  • Branch or commit: upstream main as inspected on 2026-06-03
  • Run mode: not captured; issue filed from user report plus source inspection
  • OS + version: not captured
  • Node + pnpm versions: not captured
  • Rust version, if relevant: not relevant
  • Remote Runtime URL configured? not relevant
  • Provider, model, or integration, if relevant: not relevant

Logs, screenshots, or video

No recording attached. Source evidence:

  • src/features/catalog/characters/components/CharacterMetadataTab.tsx mounts AvatarCropWidget whenever avatarPreview is present.
  • src/shared/components/ui/AvatarCropWidget.tsx initializes with imgRect == null, so the crop canvas reserves MAX_DISPLAY_W / MAX_DISPLAY_H fallback dimensions, then handleImgLoad computes the measured natural-image dimensions and updates state.
  • The rendered image uses className="block h-full w-full" and objectFit: "fill"; if the fallback box and the measured box differ, the visible canvas can snap after load.
  • getAvatarCropStyle in src/shared/lib/utils.ts can also position cropped preview images absolutely once a crop is present, which makes stable container sizing important.

Regression notes

Not confirmed as a regression. The issue appears to be a current character editor layout stability bug.

Additional context

Suggested repair: make AvatarCropWidget reserve a stable bounded aspect-ratio/size before measurement, or hide/skeleton the crop canvas until imgRect is known. Verification should include browser proof on a large avatar and a small avatar, plus switching between characters to ensure the crop area does not flash oversized.

Template check

Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @Promansis on GitHub (Jun 3, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/2003 Originally assigned to: @cha1latte on GitHub. ## Summary Opening the character editor can show a brief layout flicker in the Metadata tab's Avatar Crop area: the crop image/canvas appears large first, then snaps down to the intended measured size. ## Expected behavior The Avatar Crop widget should mount at its final bounded size, or reserve a stable skeleton/placeholder size until the image is measured. The character editor page should not visibly jump when the crop image initializes. ## Actual behavior The Avatar Crop widget appears to render with fallback dimensions before the image measurement is available, then updates after `handleImgLoad` computes the natural-image scale. On affected character editor opens, the image under Avatar Crop briefly appears too large and then resizes correctly. ## Steps to reproduce 1. Open a character with an avatar in the character editor. 2. Switch to or open the Metadata tab where Avatar Crop is displayed. 3. Watch the Avatar Crop image/canvas during the first mount or after switching characters. 4. Observe whether the crop image briefly renders large before settling to the correct size. ## Impact area - [ ] App shell, navigation, startup, or providers - [x] Catalog resources - [ ] Chat mode - [ ] Roleplay mode - [ ] Game mode - [ ] Shared mode UI - [ ] Runtime systems: generation, world-state, visuals, tracker, or haptics - [ ] Professor Mari or shell tools - [ ] React-free engine behavior, contracts, agents, or capability ports - [ ] Shared API wrapper or remote runtime routing - [ ] Tauri/Rust storage, assets, LLM, integrations, security, imports, or HTTP runtime - [ ] Docs, contributor workflow, or templates ## Environment - Branch or commit: upstream `main` as inspected on 2026-06-03 - Run mode: not captured; issue filed from user report plus source inspection - OS + version: not captured - Node + pnpm versions: not captured - Rust version, if relevant: not relevant - Remote Runtime URL configured? not relevant - Provider, model, or integration, if relevant: not relevant ## Logs, screenshots, or video No recording attached. Source evidence: - `src/features/catalog/characters/components/CharacterMetadataTab.tsx` mounts `AvatarCropWidget` whenever `avatarPreview` is present. - `src/shared/components/ui/AvatarCropWidget.tsx` initializes with `imgRect == null`, so the crop canvas reserves `MAX_DISPLAY_W` / `MAX_DISPLAY_H` fallback dimensions, then `handleImgLoad` computes the measured natural-image dimensions and updates state. - The rendered image uses `className="block h-full w-full"` and `objectFit: "fill"`; if the fallback box and the measured box differ, the visible canvas can snap after load. - `getAvatarCropStyle` in `src/shared/lib/utils.ts` can also position cropped preview images absolutely once a crop is present, which makes stable container sizing important. ## Regression notes Not confirmed as a regression. The issue appears to be a current character editor layout stability bug. ## Additional context Suggested repair: make `AvatarCropWidget` reserve a stable bounded aspect-ratio/size before measurement, or hide/skeleton the crop canvas until `imgRect` is known. Verification should include browser proof on a large avatar and a small avatar, plus switching between characters to ensure the crop area does not flash oversized. ## Template check Please uncheck the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:24:46 +07:00
  • closed this issue
  • added the
    bug
    label
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#982
No description provided.