How to automatically move children elements in view?

image
I would like to, upon click, for the canvas to scroll until frame is fully in view. How would I do this? I’m using an UIListLayout with a ScrollingFrame.

2 Likes

uhhhh,

something like this, probably;

frame.Activated:Connect(function()
   scrollingFrame.CanvasPosition = frame.Position
end)
3 Likes

I don’t think that works because frame’s Position is overriden by UIListLayout and the AbsolutePosition of the frame isn’t a good measurement as it’s the position on the screen, not of that specific frame

3 Likes

Do you mean if you were to click that green button all the way on the left you want it to become centered?

1 Like


Maybe this will help you with demonstration. Not centered, but rather just into full view. Same if I were to click an element on the right.

1 Like

The absolute position is relative to the frame so you can do

Canvas.CanvasPosition.X = Frame.AbsoluteValue.X