Skip to main content

When I create a frame and add a shape in it I can’t resize the frame to a smaller size

 

Example :

const frame = await board.createFrame({
title: “Test”,
x: 0,
y: 0,
width: 1000,
height: 1000,
});


const shape = await board.createShape({
x: 25,
y: 25,
width: 50,
height: 50,
});
await frame.add(shape);

frame.width = 500;
frame.height = 500;
await frame.sync();

I got the following error :

“Uncaught (in promise) Error: Cannot resize the frame (XXXX) to the specified size, because one or more children would exist outside the parent frame.”

Hey @Oliver Coste,

Thanks for sharing this example!

One thing to note is that when children item are added to a frame, it’s relative to the top left corner of the frame. 

If the shape you’re adding overlaps with one of the boundaries of the frame when attempting to resize, you can run into this scenario.

Have you tried creating the shape with x, y coordinates closer to the center of the frame?

Thanks,
Will


Adding the shape works but after I can’t resize the frame to a smaller size

 

I doesn’t need to move childs when I change the size of the frame ?


Reply