Skip to content

Commit

Permalink
Slider range patch
Browse files Browse the repository at this point in the history
  • Loading branch information
nightcycle committed Jul 30, 2024
1 parent 1865fa7 commit a4671f7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
14 changes: 12 additions & 2 deletions src/Component/Slider/ColdFusion.luau
Original file line number Diff line number Diff line change
Expand Up @@ -797,12 +797,22 @@ function Interface.new(
inputObject.UserInputType == Enum.UserInputType.MouseButton1
or inputObject.UserInputType == Enum.UserInputType.Touch
then
inputState:Set(100 * (inputObject.Position.X - button.AbsolutePosition.X) / button.AbsoluteSize.X)
inputState:Set(
minState:Get()
+ (maxState:Get() - minState:Get())
* (inputObject.Position.X - button.AbsolutePosition.X)
/ button.AbsoluteSize.X
)
end
end))
maid:GiveTask(button.InputChanged:Connect(function(inputObject: InputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseMovement and isSelectedState:Get() then
inputState:Set(100 * (inputObject.Position.X - button.AbsolutePosition.X) / button.AbsoluteSize.X)
inputState:Set(
minState:Get()
+ (maxState:Get() - minState:Get())
* (inputObject.Position.X - button.AbsolutePosition.X)
/ button.AbsoluteSize.X
)
end
end))
local inst = _new("Frame")({
Expand Down
4 changes: 2 additions & 2 deletions src/Component/Slider/_Config.story.luau
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ return function(frame: Frame)
end,
40,
0,
100,
50,
nil,
"Low",
"High",
Expand Down Expand Up @@ -121,7 +121,7 @@ return function(frame: Frame)
end,
50,
0,
100,
150,
nil,
nil,
nil,
Expand Down
5 changes: 5 additions & 0 deletions synthetic.rbxl.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
117448
RobloxStudioBeta
DESKTOP-UIAPQFM
faf3918c-cd67-4e9b-95e8-76107b83bc31

0 comments on commit a4671f7

Please sign in to comment.