From f76ae3faec78d343a0b2aad3ccb799d891b20175 Mon Sep 17 00:00:00 2001 From: hobokenchicken Date: Fri, 5 Jun 2026 13:45:32 -0400 Subject: [PATCH] fix(cat): use getLocalBounds for accurate scale calculation Cat was rendering huge because scale was computed from current model.width which included previous scale transforms. Now resets to scale(1) first, reads natural bounds, then computes target scale for 100px rendered height. --- frontend/src/components/Live2DStage.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/Live2DStage.tsx b/frontend/src/components/Live2DStage.tsx index d16aa75..3007c12 100644 --- a/frontend/src/components/Live2DStage.tsx +++ b/frontend/src/components/Live2DStage.tsx @@ -43,12 +43,14 @@ function positionModels( // Right sidebar center const rightLeft = appW - RIGHT_W - PAD; const rightMidX = rightLeft + RIGHT_W / 2; - // PetZone sits near the bottom of the sidebar, above the status bar - const catTargetH = 120; - const catY = appH - BOTTOM_BAR_H - catTargetH / 2 - 18; + const catY = appH - BOTTOM_BAR_H - 60 - 18; if (cat) { - const cs = catTargetH / cat.height; + // Set scale to 1 first to get natural bounds, then compute target + cat.scale.set(1); + const naturalH = cat.getLocalBounds().height; + const targetPx = 100; // ~100px tall rendered + const cs = naturalH > 0 ? targetPx / naturalH : 0.05; cat.scale.set(cs); cat.anchor.set(0.5, 0.5); cat.position.set(rightMidX, catY);