đ§ AdjustContentSize
Overviewâ
The AdjustContentSize class is designed to dynamically adjust the size of UI elements based on the content size of a UIListLayout. It utilizes the RunService to continuously update the size of specified UI elements.
Constructorâ
AdjustContentSize.new(UIListLayout: UIListLayout, Background: Frame, ImgBlur: ImageLabel)â
- Creates a new instance of the
AdjustContentSizeclass. - Parameters:
UIListLayout: The UIListLayout whose content size will be monitored.Background: The Frame element whose size will be adjusted based on the content size.ImgBlur: The ImageLabel element whose size will be adjusted based on half of the content size.
Methodsâ
AdjustContentSize:Init()â
- Initializes the
AdjustContentSizeinstance by connecting to the RunService's Heartbeat event. - Updates the size of
BackgroundandImgBlurbased on the content size of the specifiedUIListLayout.
AdjustContentSize:Destroy()â
- Disconnects the connection to the Heartbeat event, stopping the continuous updates of element sizes.
Example Usageâ
-- Example Usage:
local Framework = require(path.to.framework).GetClient()
local GUI = Framework.GUI
local AdjustContentSize = GUI.AdjustContentSize
local myListLayout = -- get or create your UIListLayout
local myBackground = -- get or create your Frame element
local myImgBlur = -- get or create your ImageLabel element
local adjuster = AdjustContentSize.new(myListLayout, myBackground, myImgBlur)
-- Optionally, you can call adjuster:Destroy() to stop updates and disconnect from the Heartbeat event.