diff --git a/src/hooks/useRive.tsx b/src/hooks/useRive.tsx index b2dfd5f..e430fc5 100644 --- a/src/hooks/useRive.tsx +++ b/src/hooks/useRive.tsx @@ -85,10 +85,11 @@ export default function useRive( if (rive) { if (rive.layout && rive.layout.fit === Fit.Layout) { if (canvasElem) { + const resizeFactor = devicePixelRatio * rive.layout.layoutScaleFactor; // TODO (Gordon): expose these are properties on JS runtime (rive as any)._devicePixelRatioUsed = devicePixelRatio; - (rive as any).artboard.width = canvasElem?.width / devicePixelRatio; - (rive as any).artboard.height = canvasElem?.height / devicePixelRatio; + (rive as any).artboard.width = canvasElem?.width / resizeFactor; + (rive as any).artboard.height = canvasElem?.height / resizeFactor; } }