mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #674] [MERGED] fix(avatar-crop): use focal-point object-position on RP rectangle and glued-panel avatars #4724
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#4724
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/674
Author: @Romuromylus
Created: 5/11/2026
Status: ✅ Merged
Merged: 5/11/2026
Merged by: @Romuromylus
Base:
main← Head:fix/avatar-crop-rectangle-focal-point📝 Commits (1)
4d6314ffix(avatar-crop): use focal-point object-position on RP rectangle and glued-panel avatars📊 Changes
1 file changed (+48 additions, -7 deletions)
View changed files
📝
packages/client/src/components/chat/ChatMessage.tsx(+48 -7)📄 Description
Linked issue
Closes #673
Why this change
PR #671 propagated the new source-rectangle avatar crop format through chat-side render sites. The format renders the
<img>withposition: absolute,width: 100/srcWidth%,height: 100/srcHeight%, andobject-fit: fill— math that assumes the parent has the same aspect ratio as the (editor-enforced-square) crop.For RP-mode rectangular sites — "Small Rectangles" compact style and "Glued Side Panel" — the parent is non-square.
object-fit: fillthen stretched the cropped face to the rectangle's aspect ratio. Symptoms (visible only when the user has saved a new-format avatar crop):object-cover object-topshowed only the top of the source (e.g. just the character's hair).What changed
In
packages/client/src/components/chat/ChatMessage.tsx:rectangleSafeCropStyle(crop, fallback)helper that returns:{zoom, offsetX, offsetY}crops → the fallback (unchanged transform-based path; composes withobject-cover).{ objectPosition: 'X% Y%' }derived from the crop's center, soobject-coverkeeps the user's chosen focal point centered in the rectangle.compactAvatarCropStyleandcompactMergedAvatarCropStyle(avatar)forcompactAvatarFrameClasssites (gated onuseCompactRectangleAvatar— the round Small Circles variant still uses the unmodifiedavatarCropStyle).panelAvatarCropStyleandpanelMergedAvatarCropStyle(avatar)forrpg-avatar-panel-tail-imageandrpg-avatar-panel-media(always-rectangular sites).<img>sites in the file:rpg-avatar-panel-tailsingle + merged (lines ~1146–1175).compactAvatarFrameClasssingle + merged (lines ~1355–1400).rpg-avatar-panel-mediasingle + merged (lines ~1499–1542).Round/square frames (Small Circles compact style + Conversation Mode bubble
h-8 w-8 rounded-full) continue to use the unchangedavatarCropStyle, which is PR #661's original logic — correct when parent matches crop aspect ratio.No data migration. Existing crops (both formats) render correctly without re-editing.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
avatarCropsaved (square crop region of a non-square source) in Small Rectangles style: the side avatar tile renders the chosen face centered, no horizontal/vertical squish.{zoom, offsetX, offsetY}crop renders identically to before in all three RP avatar styles — the customization should still apply via the unchanged transform path.avatarCropextension renders identically to before in all styles (the helper returns the fallback unchanged fornullcrops).Docs and release impact
UI evidence (if applicable)
Behavioral fix; the bug surface is identical to #673's repro steps. After: rectangles render the chosen face centered; no stretching, no banner-bleed on short messages.
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.