mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-04 07:19:52 +00:00
fix(studio): use host composition dimensions for all added blocks
Blocks were using their own native dimensions (e.g. 1920x1080) instead of the host composition dimensions (e.g. 1280x720), causing them to overflow the viewport and break the layout. The block's iframe scales its content to fit the container, so using host dimensions is correct.
This commit is contained in:
@@ -144,12 +144,8 @@ export async function addBlockToProject(
|
||||
|
||||
const zIndex = getMaxZIndexFromIframe(opts.previewIframe ?? null) + 1;
|
||||
|
||||
const width = isBlock
|
||||
? (block as { dimensions: { width: number } }).dimensions.width
|
||||
: hostDims.width;
|
||||
const height = isBlock
|
||||
? (block as { dimensions: { height: number } }).dimensions.height
|
||||
: hostDims.height;
|
||||
const width = hostDims.width;
|
||||
const height = hostDims.height;
|
||||
|
||||
const left = visualPosition ? Math.round(visualPosition.left) : 0;
|
||||
const top = visualPosition ? Math.round(visualPosition.top) : 0;
|
||||
|
||||
Reference in New Issue
Block a user