ScrollingFrame.AutoCanvasSize does not take ListLayout or GridLayout padding size into account properly

Currently AutoCanvasSize fails to fit elements when the padding on a UIListLayout/UIGridLayout is using Scale values over Offset values. This results in the scrolling frame not fitting elements correctly and leaving a large amount of whitespace at the bottom.

Expected behavior

I expect AutoCanvasSize to fit everything in frame perfectly.

6 Likes

This issue is quite a major one and requires me to put code in each and every one of my ScrollingFrames to have them auto-sized manually, like this:

UIListLayouts:

script.Parent.Frame.UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
	script.Parent.Frame.DisplayFrame.CanvasSize = UDim2.new(0, 0, 0, script.Parent.MainFrame.DisplayFrame.UIListLayout.AbsoluteContentSize.Y)
end)

UIGridLayouts:
Frame.CanvasSize = UDim2.new(0, 0, 0, ((script.Parent.Frame.UIGridLayout.AbsoluteContentSize.Y * script.Parent.Frame.UIGridLayout.CellPadding.Y.Scale) + script.Parent.Frame.UIGridLayout.AbsoluteCellSize.Y) * script.Parent.Frame.UIGridLayout.AbsoluteCellCount.Y)

@CharlieGordonnn Mind looking into this? This issue is severely impacting my workflow and it’s what I was trying to get at here (except I didn’t actually know the cause):

Here’s a repro file for you: repro.rbxl

When you join into it via playtest, you’ll notice the UI on the left (the one using just AutomaticCanvasSize) scales incorrectly, cutting off multiple elements in the scrolling frame. (Yes, this is different to OPs behavior, but this issue can cause either lots of empty space OR not enough space in ScrollingFrames). Take a look at the screenshot below:

Note that I disabled the ClipDescendants property on both the ScrollingFrames to demonstrate the issue at hand. Assistance with this would be highly appreciated. :slightly_smiling_face:

1 Like

Worth noting that the solution here does not result in the same behaviour as using AutoCanvasSize. Since the Scale value in Grid and List layouts is based on CanvasSize and not Size (why?), having more elements in the list causes large amounts of padding. I believe List and Grid layouts should respect ScrollingFrame.Size over ScrollingFrame.CanvasSize (or at least have a property like UIAspectRatioConstraints do which let you decide which one it should respect).

1 Like

Hi @Tom_atoes @bvetterdays , thanks for reporting the issue and yes this one is a known issue that using scale size + AutomaticSize/AutomaticCanvasSize has conflicting behaviors, because the parent and children sizes depend on each other, which results in the issue of having more elements in the list causes large canvas size so that scale sized elements will be larger.

@bvetterdays In your repro file, when you set the list children’s scale size to be 0.1 on Y axis, may I know which size you were expecting the children size 0.1 to be based on? Is it the scrolling window size, or the canvas size, or the size of the parent of scrolling frame?

1 Like

Is it possible to have Scale respect Parent.Size over Parent.CanvasSize? I can’t think of any reason why you would want padding to scale based on the number of elements.

1 Like

Also I noticed in the repro file, when you set the scrolling frame to be an offset size, the canvas size seems to be calculated correctly. I can take a further look.

1 Like

@CharlieGordonnn As mentioned here, it’d be awesome if it could scale based on Parent.Size rather than Parent.CanvasSize.

Thanks for your help! Please keep us updated.

Hey @bvetterdays , I have looked at the problem and the padding was not correctly calculated when the scrolling frame is using a scale size (in the repro file you shared) which needs a fix.
However, scaling based on Parent.Size rather than Parent.CanvasSize may not be an easy fix because this may break existing experiences as it was designed that way at the beginning. We are aware of this feedback and also did some discussions around this before, while after all, this current behavior may stay for a while until we have new objects/features designed in the future. :smiling_face_with_tear:

3 Likes

Hey @Tom_atoes , could you please share a minimal repro file that is shown in the video? Thank you!

Place1.rbxl (105.0 KB)

1 Like