A new version of this is available
I made a quick little module that will automatically change a ScrollingFrame’s CanvasSize.Y based on how many chlidren are in the ScrollingFrame.
Very useful when used in conjunction with UIGridLayout with CellSize using Offset.
I figured I’d make it public - you can find the code on my GitHub
Edit: the core of this module was redundant, as UIGridLayouts and UIListLayouts have a read-only property for AbsoluteContentSize. I updated the module to use these properties as well as added support for UIListLayouts, and x-axis auto sizing.
This is awesome, I’ll probably use this in future games and/or plugins!
Definitely saving this for later! Thank you!
I didn’t totally read through this, but can’t you just listen to .Changed on the UIGridLayout, and every time it’s changed, set the Y of the canvas to UIGridLayout.AbsoluteContentSize.Y?
as a bonus you can also add a UIPaddingConstraint that shifts the content over once the scrollbar appears to keep everything constant
This is how I have this implemented in my current project
If your UIPadding value is the same as your scrollbar’s width, then couldn’t you use
VerticalScrollBarInset? If you set it to
Scrollbar in Studio, then it will automatically make the canvas size smaller on the X axis when the vertical scrollbar is shown. This can make the needed code here even shorter:
BuildItems.CanvasSize = UDim2.new(0, 0, 0, BuildItems.UIGridLayout.AbsoluteContentSize.y)
oh my god I didn’t know that existed, praise be the almighty Corecii
This is really useful! thank you so much im gonna use this
I updated the module to use AbsoluteContentSize instead, as well as support for ListLayouts, also should support auto-sizing on the x axis as well.
Where’s the updated module that includes list layouts? I can’t find it. The link provided only supports Grid Layouts. Thanks
I have updated the module, sorry about that.
Supports UIListLayout and x/y axis scaling.
Does it work with UI Gridlayout object?
are they serverscripts or module scripts