🎥 Make videos programmatically with React
Keep HTML-in-canvas warnings readable at any preview scale
JonnyBurgerf4430a3bbc9c
diff --git a/packages/core/src/HtmlInCanvasFallback.tsx b/packages/core/src/HtmlInCanvasFallback.tsxindex 6818c63636..f6e94a5e13 100644--- a/packages/core/src/HtmlInCanvasFallback.tsx+++ b/packages/core/src/HtmlInCanvasFallback.tsx@@ -1,10 +1,14 @@import React from 'react';+import {useCurrentScale} from './use-current-scale.js';export const HtmlInCanvasFallback: React.FC<{readonly children: React.ReactNode;readonly style: React.CSSProperties;readonly label: string;}> = ({children, style, label}) => {+ const currentScale = useCurrentScale({dontThrowIfOutsideOfRemotion: true});+ const scale = currentScale > 0 ? currentScale : 1;+return (<div style={{position: 'relative', ...style}}>{children}@@ -12,10 +16,13 @@ export const HtmlInCanvasFallback: React.FC<{className="css-reset"style={{position: 'absolute',- top: 8,- right: 8,+ top: 8 / scale,+ right: 8 / scale,zIndex: 1000,- maxWidth: 'calc(100% - 16px)',+ // Cancel the preview zoom while keeping the badge inside its component.+ transform: `scale(${1 / scale})`,+ transformOrigin: 'top right',+ maxWidth: `calc(${scale * 100}% - 16px)`,padding: '8px 10px',borderRadius: 6,border: '1px solid #7f3540',