@@ -31,7 +31,9 @@ local kMinCheckImageSize = UDim2.new(0, kMinCheckImageWidth, 0, kMinCheckImageWi
3131
3232local kEnabledCheckImage = " rbxasset://textures/DeveloperFramework/checkbox_checked_light.png"
3333local kDisabledCheckImage = " rbxasset://textures/DeveloperFramework/checkbox_indeterminate_light.png"
34- local kCheckboxFrameImage = " rbxasset://textures/DeveloperFramework/checkbox_unchecked_hover_light.png"
34+ local kHoverCheckImage = " rbxasset://textures/DeveloperFramework/checkbox_unchecked_hover_light.png"
35+ local kCheckboxFrameImage = " rbxasset://textures/DeveloperFramework/checkbox_unchecked_light.png"
36+
3537LabeledCheckboxClass = {}
3638LabeledCheckboxClass .__index = LabeledCheckboxClass
3739
@@ -83,6 +85,10 @@ function LabeledCheckboxClass.new(nameSuffix, labelText, initValue, initDisabled
8385 self ._frame = frame
8486 self ._button = button
8587 self ._label = label
88+
89+ self ._clicked = false
90+ self ._hovered = false
91+
8692 self ._checkImage = checkImage
8793 self ._fullBackgroundButton = fullBackgroundButton
8894 self ._useDisabledOverride = false
@@ -94,6 +100,21 @@ function LabeledCheckboxClass.new(nameSuffix, labelText, initValue, initDisabled
94100
95101 self :_SetupMouseClickHandling ()
96102
103+ -- local function updateImages()
104+ -- if (GuiUtilities:ShouldUseIconsForDarkerBackgrounds()) then
105+ -- kEnabledCheckImage = "rbxasset://textures/DeveloperFramework/checkbox_checked_dark.png"
106+ -- kDisabledCheckImage = "rbxasset://textures/DeveloperFramework/checkbox_indeterminate_dark.png"
107+ -- kHoverCheckImage = "rbxasset://textures/DeveloperFramework/checkbox_unchecked_hover_dark.png"
108+ -- kCheckboxFrameImage = "rbxasset://textures/DeveloperFramework/checkbox_unchecked_dark.png"
109+ --
110+ -- LabeledCheckboxClass:_updateCheckboxVisual()
111+ -- else
112+ -- LabeledCheckboxClass:_updateCheckboxVisual()
113+ -- end
114+ -- end
115+ -- settings().Studio.ThemeChanged:Connect(updateImages)
116+ -- updateImages()
117+
97118 local function updateFontColors ()
98119 self :UpdateFontColors ()
99120 end
@@ -103,7 +124,6 @@ function LabeledCheckboxClass.new(nameSuffix, labelText, initValue, initDisabled
103124 return self
104125end
105126
106-
107127function LabeledCheckboxClass :_MaybeToggleState ()
108128 if not self ._disabled then
109129 self :SetValue (not self ._value )
@@ -112,14 +132,42 @@ end
112132
113133function LabeledCheckboxClass :_SetupMouseClickHandling ()
114134 self ._button .MouseButton1Down :Connect (function ()
135+ self ._clicked = true
115136 self :_MaybeToggleState ()
116137 end )
117138
139+ self ._fullBackgroundButton .InputBegan :Connect (function (input )
140+ if (input .UserInputType == Enum .UserInputType .MouseMovement ) then
141+ self ._hovered = true
142+ self :_updateCheckboxVisual ()
143+ end
144+ end )
145+
146+ self ._fullBackgroundButton .InputEnded :Connect (function (input )
147+ if (input .UserInputType == Enum .UserInputType .MouseMovement ) then
148+ self ._hovered = false
149+ self ._clicked = false
150+ self :_updateCheckboxVisual ()
151+ end
152+ end )
153+
118154 self ._fullBackgroundButton .MouseButton1Down :Connect (function ()
155+ self ._clicked = true
156+ self :_updateCheckboxVisual ()
119157 self :_MaybeToggleState ()
120158 end )
121159end
122160
161+ function LabeledCheckboxClass :_updateCheckboxVisual ()
162+ if (self ._clicked ) then
163+ self ._button .Image = kCheckboxFrameImage
164+ elseif (self ._hovered ) then
165+ self ._button .Image = kHoverCheckImage
166+ else
167+ self ._button .Image = kCheckboxFrameImage
168+ end
169+ end
170+
123171function LabeledCheckboxClass :_HandleUpdatedValue ()
124172 self ._checkImage .Visible = self :GetValue ()
125173
0 commit comments