fix(avatar): reduce model margin to 45% to prevent clipping in narrow sidebar
This commit is contained in:
@@ -44,8 +44,8 @@ export default function KiraAvatar(props: Props) {
|
|||||||
|
|
||||||
const fitModel = (crW: number, crH: number) => {
|
const fitModel = (crW: number, crH: number) => {
|
||||||
if (!model || !app) return;
|
if (!model || !app) return;
|
||||||
const maxW = crW * 0.65;
|
const maxW = crW * 0.45;
|
||||||
const maxH = crH * 0.65;
|
const maxH = crH * 0.45;
|
||||||
const s = Math.min(maxW / model.width, maxH / model.height);
|
const s = Math.min(maxW / model.width, maxH / model.height);
|
||||||
model.scale.set(s);
|
model.scale.set(s);
|
||||||
model.position.set(app.screen.width / 2, app.screen.height / 2);
|
model.position.set(app.screen.width / 2, app.screen.height / 2);
|
||||||
@@ -90,8 +90,8 @@ export default function KiraAvatar(props: Props) {
|
|||||||
modelRef.current = model;
|
modelRef.current = model;
|
||||||
|
|
||||||
// Fit model with generous margin to avoid clipping
|
// Fit model with generous margin to avoid clipping
|
||||||
const maxW = w * 0.65;
|
const maxW = w * 0.45;
|
||||||
const maxH = h * 0.65;
|
const maxH = h * 0.45;
|
||||||
const scale = Math.min(maxW / model.width, maxH / model.height);
|
const scale = Math.min(maxW / model.width, maxH / model.height);
|
||||||
model.scale.set(scale);
|
model.scale.set(scale);
|
||||||
model.anchor.set(0.5, 0.5);
|
model.anchor.set(0.5, 0.5);
|
||||||
|
|||||||
Reference in New Issue
Block a user