How to create an auto-scaling overlay?

I’m looking to stack an overlay on top of an existing autolayout frams, such that it scales responsively to its parent’s size.

In the screenshot below you can see a simple demo setup.
Screenshot 2024-05-01 at 12.45.59 PM

The “Outer Frame” is designed to be responsive when used in a layout. The contents inside (the blue and red bars being shown as an example) will scale in response to any change in its parent frame’s dimensions.

The “Overlay” is designed to live inside the Outer Frame, stacked above the Inner Frame in the z-order. It should also fill the outer frame. Below is an image of me doing this using absolute positioning but it is NOT responsive.

(image can’t be included for dumb forum reasons)

If the Outer Frame gets resized, you have to manually resize the overlay. Here’s what happens if you don’t:

(Image omitted so I can submit this question)

When set to Absolute positioning, you lose the ability to make an element Fill its parent container, as if Autolayout is not on.

What’s the trick here to make everything work as it should?

Hi @Tom_Auger2

When dealing with absolute position you still have access to the constraint section in design panel.
image
Select the frame Overlay, then set its constraints to left and right and top and bottom so it will be bind to top, right, bottom and left of its parent.

Hope it helped

1 Like

Brilliant. A little confusing from a UX perspective that the equivalent of the < > Fill (under Frame) is not in the same place in the UI.

Thank you for the tip!

1 Like

Any idea on how to do the same but in prototype, when the overlay shows up on a click and needs to resize the full window width/height?

1 Like