Skip to content

Commit

Permalink
Fixed a handful of weird bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nightcycle committed Jul 31, 2024
1 parent 1b02cc1 commit 131d02d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 33 deletions.
64 changes: 32 additions & 32 deletions src/Component/Slider/ColdFusion.luau
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ function Interface.onTertiary(
local styleState: State<Style> = _import(style, DEFAULTS.ON_TERTIARY.STYLE)

local out = Interface.new(
_import(elevation, DEFAULTS.ON_TERTIARY.ON_CHANGE),
_import(elevation, DEFAULTS.ON_TERTIARY.INITIAL_VALUE),
_import(elevation, DEFAULTS.ON_TERTIARY.MINIMUM),
_import(elevation, DEFAULTS.ON_TERTIARY.MAXIMUM),
_import(elevation, DEFAULTS.ON_TERTIARY.INCREMENT),
_import(onChange, DEFAULTS.PRIMARY.ON_CHANGE),
_import(initialValue, DEFAULTS.PRIMARY.INITIAL_VALUE),
_import(minimum, DEFAULTS.PRIMARY.MINIMUM),
_import(maximum, DEFAULTS.PRIMARY.MAXIMUM),
_import(increment, DEFAULTS.PRIMARY.INCREMENT),
_import(leftTextOrIcon, DEFAULTS.ON_TERTIARY.LEFT_TEXT_OR_ICON),
_import(rightTextOrIcon, DEFAULTS.ON_TERTIARY.RIGHT_TEXT_OR_ICON),
_Computed(function(s: Style): Color3
Expand Down Expand Up @@ -178,11 +178,11 @@ function Interface.onSecondary(
local styleState: State<Style> = _import(style, DEFAULTS.SECONDARY.STYLE)

local out = Interface.new(
_import(elevation, DEFAULTS.ON_SECONDARY.ON_CHANGE),
_import(elevation, DEFAULTS.ON_SECONDARY.INITIAL_VALUE),
_import(elevation, DEFAULTS.ON_SECONDARY.MINIMUM),
_import(elevation, DEFAULTS.ON_SECONDARY.MAXIMUM),
_import(elevation, DEFAULTS.ON_SECONDARY.INCREMENT),
_import(onChange, DEFAULTS.PRIMARY.ON_CHANGE),
_import(initialValue, DEFAULTS.PRIMARY.INITIAL_VALUE),
_import(minimum, DEFAULTS.PRIMARY.MINIMUM),
_import(maximum, DEFAULTS.PRIMARY.MAXIMUM),
_import(increment, DEFAULTS.PRIMARY.INCREMENT),
_import(leftTextOrIcon, DEFAULTS.ON_SECONDARY.LEFT_TEXT_OR_ICON),
_import(rightTextOrIcon, DEFAULTS.ON_SECONDARY.RIGHT_TEXT_OR_ICON),
_Computed(function(s: Style): Color3
Expand Down Expand Up @@ -240,11 +240,11 @@ function Interface.onPrimary(
local styleState: State<Style> = _import(style, DEFAULTS.ON_PRIMARY.STYLE)

local out = Interface.new(
_import(elevation, DEFAULTS.ON_PRIMARY.ON_CHANGE),
_import(elevation, DEFAULTS.ON_PRIMARY.INITIAL_VALUE),
_import(elevation, DEFAULTS.ON_PRIMARY.MINIMUM),
_import(elevation, DEFAULTS.ON_PRIMARY.MAXIMUM),
_import(elevation, DEFAULTS.ON_PRIMARY.INCREMENT),
_import(onChange, DEFAULTS.PRIMARY.ON_CHANGE),
_import(initialValue, DEFAULTS.PRIMARY.INITIAL_VALUE),
_import(minimum, DEFAULTS.PRIMARY.MINIMUM),
_import(maximum, DEFAULTS.PRIMARY.MAXIMUM),
_import(increment, DEFAULTS.PRIMARY.INCREMENT),
_import(leftTextOrIcon, DEFAULTS.ON_PRIMARY.LEFT_TEXT_OR_ICON),
_import(rightTextOrIcon, DEFAULTS.ON_PRIMARY.RIGHT_TEXT_OR_ICON),
_Computed(function(s: Style): Color3
Expand Down Expand Up @@ -302,11 +302,11 @@ function Interface.tertiary(
local styleState: State<Style> = _import(style, DEFAULTS.TERTIARY.STYLE)

local out = Interface.new(
_import(elevation, DEFAULTS.TERTIARY.ON_CHANGE),
_import(elevation, DEFAULTS.TERTIARY.INITIAL_VALUE),
_import(elevation, DEFAULTS.TERTIARY.MINIMUM),
_import(elevation, DEFAULTS.TERTIARY.MAXIMUM),
_import(elevation, DEFAULTS.TERTIARY.INCREMENT),
_import(onChange, DEFAULTS.PRIMARY.ON_CHANGE),
_import(initialValue, DEFAULTS.PRIMARY.INITIAL_VALUE),
_import(minimum, DEFAULTS.PRIMARY.MINIMUM),
_import(maximum, DEFAULTS.PRIMARY.MAXIMUM),
_import(increment, DEFAULTS.PRIMARY.INCREMENT),
_import(leftTextOrIcon, DEFAULTS.TERTIARY.LEFT_TEXT_OR_ICON),
_import(rightTextOrIcon, DEFAULTS.TERTIARY.RIGHT_TEXT_OR_ICON),
_Computed(function(s: Style): Color3
Expand Down Expand Up @@ -364,11 +364,11 @@ function Interface.secondary(
local styleState: State<Style> = _import(style, DEFAULTS.SECONDARY.STYLE)

local out = Interface.new(
_import(elevation, DEFAULTS.SECONDARY.ON_CHANGE),
_import(elevation, DEFAULTS.SECONDARY.INITIAL_VALUE),
_import(elevation, DEFAULTS.SECONDARY.MINIMUM),
_import(elevation, DEFAULTS.SECONDARY.MAXIMUM),
_import(elevation, DEFAULTS.SECONDARY.INCREMENT),
_import(onChange, DEFAULTS.PRIMARY.ON_CHANGE),
_import(initialValue, DEFAULTS.PRIMARY.INITIAL_VALUE),
_import(minimum, DEFAULTS.PRIMARY.MINIMUM),
_import(maximum, DEFAULTS.PRIMARY.MAXIMUM),
_import(increment, DEFAULTS.PRIMARY.INCREMENT),
_import(leftTextOrIcon, DEFAULTS.SECONDARY.LEFT_TEXT_OR_ICON),
_import(rightTextOrIcon, DEFAULTS.SECONDARY.RIGHT_TEXT_OR_ICON),
_Computed(function(s: Style): Color3
Expand Down Expand Up @@ -426,11 +426,11 @@ function Interface.primary(
local styleState: State<Style> = _import(style, DEFAULTS.PRIMARY.STYLE)

local out = Interface.new(
_import(elevation, DEFAULTS.PRIMARY.ON_CHANGE),
_import(elevation, DEFAULTS.PRIMARY.INITIAL_VALUE),
_import(elevation, DEFAULTS.PRIMARY.MINIMUM),
_import(elevation, DEFAULTS.PRIMARY.MAXIMUM),
_import(elevation, DEFAULTS.PRIMARY.INCREMENT),
_import(onChange, DEFAULTS.PRIMARY.ON_CHANGE),
_import(initialValue, DEFAULTS.PRIMARY.INITIAL_VALUE),
_import(minimum, DEFAULTS.PRIMARY.MINIMUM),
_import(maximum, DEFAULTS.PRIMARY.MAXIMUM),
_import(increment, DEFAULTS.PRIMARY.INCREMENT),
_import(leftTextOrIcon, DEFAULTS.PRIMARY.LEFT_TEXT_OR_ICON),
_import(rightTextOrIcon, DEFAULTS.PRIMARY.RIGHT_TEXT_OR_ICON),
_Computed(function(s: Style): Color3
Expand Down Expand Up @@ -549,7 +549,7 @@ function Interface.new(
function(initial: number, input: number?, min: number, max: number, inc: number?): number
local rawVal = math.clamp(input or initial, min, max)
if inc then
return min + math.round((rawVal - min) / inc) * inc
return math.round(rawVal / inc) * inc
else
return rawVal
end
Expand All @@ -562,7 +562,7 @@ function Interface.new(
)

local fillState = _Computed(function(point: number, min: number, max: number, inc: number?): number
local rawVal = math.clamp(point, min, max) / math.max(max - min, 1)
local rawVal = (math.clamp(point, min, max) - min) / math.max(max - min, 1)
if inc then
return math.round(rawVal * inc) / inc
else
Expand Down
2 changes: 1 addition & 1 deletion src/Component/Slider/_Theme.story.luau
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ return function(frame: Frame)
do
local button = maid:GiveTask(Module.primary(style, function(val: number)
print(`value={val}`)
end, 50, 0, 100, 25))
end, 50, 50, 150, 25))
button.Parent = halfFrame
end
-- do
Expand Down

0 comments on commit 131d02d

Please sign in to comment.