Skip to content
This repository was archived by the owner on Aug 20, 2024. It is now read-only.

Commit 68cf483

Browse files
committed
Added item support.
1 parent acd52c2 commit 68cf483

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/SignsInternal/StudioWidgets/LabeledSlider.lua

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
--
77
----------------------------------------
88
local GuiUtilities = require(script.Parent.GuiUtilities)
9+
local CollapsibleItem = require(script.Parent.CollapsibleItem)
910

1011
local rbxGuiLibrary = require(script.Parent.RbxGui)
1112
local LabeledTextInput = require(script.Parent.LabeledTextInput)
@@ -33,17 +34,16 @@ function LabeledSliderClass.new(
3334
self._value = value
3435
self._multiplier = multiplier or 1
3536

36-
-- Creates the frame.
37-
local frame = GuiUtilities.MakeDefaultFixedHeightFrame("Slider" .. nameSuffix)
38-
self._frame = frame
37+
local item = CollapsibleItem.new(nameSuffix, labelText, false, url)
38+
self._item = item
3939

40-
-- Creates the input.
40+
-- Creates the input
4141
local input =
4242
LabeledTextInput.new("SliderInput" .. nameSuffix, labelText, (self._value - 1) * self._multiplier, url)
4343
input:UseSmallSize()
4444
input:SetMaxGraphemes(5)
4545
input:SetValue(tostring(self._value * self._multiplier))
46-
input:GetFrame().Parent = frame
46+
input:GetFrame().Parent = item:GetFrame()
4747
self._input = input
4848

4949
-- Creates the slider.
@@ -54,9 +54,9 @@ function LabeledSliderClass.new(
5454
)
5555
self._slider = slider
5656
self._sliderValue = sliderValue
57-
slider.Parent = frame
57+
slider.Parent = item:GetFrame()
5858

59-
-- Sets the slider value to the input value when the slider is changed.
59+
-- Sets the slider value to the input value when the slider is changed
6060
sliderValue.Changed:Connect(function()
6161
self._value = sliderValue.Value
6262

@@ -69,7 +69,7 @@ function LabeledSliderClass.new(
6969
end
7070
end)
7171

72-
-- Sets the input value to the slider value when the input is changed.
72+
-- Sets the input value to the slider value when the input is changed
7373
input:SetValueChangedFunction(function(vcf)
7474
if vcf == "" then
7575
self:SetValue(value)
@@ -80,7 +80,7 @@ function LabeledSliderClass.new(
8080
end
8181
end)
8282

83-
-- Sets the slider value to the input value when the input is unfocused.
83+
-- Sets the slider value to the input value when the input is unfocused
8484
input._textBox.FocusLost:Connect(function()
8585
if input._textBox.Text == "" then
8686
input:SetValue((value - 1) * self._multiplier)
@@ -99,7 +99,7 @@ function LabeledSliderClass:SetValueChangedFunction(vcf)
9999
end
100100

101101
function LabeledSliderClass:GetFrame()
102-
return self._frame
102+
return self._item:GetFrame()
103103
end
104104

105105
function LabeledSliderClass:SetValue(newValue)

0 commit comments

Comments
 (0)