Skip to content

🎥 Make videos programmatically with React

`@remotion/player`: Again try to fix scaling

Jonny Burger01925b0dbd6a
diff --git a/packages/docs/src/components/Demo/use-element-size.ts b/packages/docs/src/components/Demo/use-element-size.ts
index 5094fd03bd..89177a9224 100644
--- a/packages/docs/src/components/Demo/use-element-size.ts
+++ b/packages/docs/src/components/Demo/use-element-size.ts
@@ -75,11 +75,11 @@ export const useElementSize = (
contentRect.width === 0 ? 1 : newSize[0].width / contentRect.width;
const width =
- options.shouldApplyCssTransforms && probableCssParentScale > 0
+ options.shouldApplyCssTransforms || probableCssParentScale === 0
? newSize[0].width
: newSize[0].width * (1 / probableCssParentScale);
const height =
- options.shouldApplyCssTransforms && probableCssParentScale > 0
+ options.shouldApplyCssTransforms || probableCssParentScale === 0
? newSize[0].height
: newSize[0].height * (1 / probableCssParentScale);
diff --git a/packages/player/src/utils/use-element-size.ts b/packages/player/src/utils/use-element-size.ts
index e30155adfb..54b642b1b6 100644
--- a/packages/player/src/utils/use-element-size.ts
+++ b/packages/player/src/utils/use-element-size.ts
@@ -75,12 +75,13 @@ export const useElementSize = (
contentRect.width === 0 ? 1 : newSize[0].width / contentRect.width;
const width =
- options.shouldApplyCssTransforms && probableCssParentScale > 0
+ options.shouldApplyCssTransforms || probableCssParentScale === 0
? newSize[0].width
: newSize[0].width * (1 / probableCssParentScale);
- const height = options.shouldApplyCssTransforms
- ? newSize[0].height
- : newSize[0].height * (1 / probableCssParentScale);
+ const height =
+ options.shouldApplyCssTransforms || probableCssParentScale === 0
+ ? newSize[0].height
+ : newSize[0].height * (1 / probableCssParentScale);
setSize((prevState) => {
const isSame =