Make AbsoluteCanvasSize Publicly Available

Greetings,

As a Roblox developer, it is currently difficult to get a ScrollingFrame’s CanvasSize in pixels (aka AbsoluteCanvasSize). Apparently, such a property does exist, but it’s locked behind RobloxScriptSecurity:

  > print(Instance.new('ScrollingFrame').AbsoluteCanvasSize)
  --[[
  The current identity (4) cannot AbsoluteCanvasSize (lacking permission 5)
  Stack Begin
  Script 'print(Instance.new('ScrollingFrame').AbsoluteCanvasSize)', Line 1
  Stack End
]]

Currently you have to calculate it yourself, which is not ideal to do all the time:

local function AbsoluteCanvasSize(scrollingFrame)
    local cs = scrollingFrame.CanvasSize
    return Vector2.new(
        cs.X.Scale * scrollingFrame.Parent.AbsoluteSize.X + cs.X.Offset,
        cs.Y.Scale * scrollingFrame.Parent.AbsoluteSize.Y + cs.Y.Offset
    )
end

I don’t see any reason for the property to not be publicly available–all it is is a read-only property fetching a Vector2, similar to AbsoluteSize. Therefore, I propose that this property should be made public and not be locked behind Roblox scripts.

If this issue was addressed, it’d improve my development experience because I can easily retrieve the CanvasSize in pure pixels. There many use cases for using “Absolutes” (Size, Position, Rotation, WindowSize, etc.) over UDim2s, especially when programming UIs. CanvasSize is no exception, especially since there’s already a property, just behind the core script security level.

Thank you.

20 Likes