Skip to content

Commit

Permalink
Patch to PopUp logic
Browse files Browse the repository at this point in the history
  • Loading branch information
nightcycle committed Feb 28, 2024
1 parent 1306772 commit 009cba3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
24 changes: 12 additions & 12 deletions src/Component/Search/Filled/cfusion-theme.story.luau
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ return function(frame: Frame)
do
local button = maid:GiveTask(
Module.ColdFusion.primaryContainer(
style,
function(input: string): string
print(`entered: {input}`)
return input
Expand All @@ -50,15 +51,15 @@ return function(frame: Frame)
return options
end,
nil,
0,
style
0
)
)
button.Parent = halfFrame
end
do
local button = maid:GiveTask(
Module.ColdFusion.secondaryContainer(
style,
function(input: string): string
print(`entered: {input}`)
return input
Expand All @@ -72,15 +73,15 @@ return function(frame: Frame)
return options
end,
nil,
0,
style
0
)
)
button.Parent = halfFrame
end
do
local button = maid:GiveTask(
Module.ColdFusion.tertiaryContainer(
style,
function(input: string): string
print(`entered: {input}`)
return input
Expand All @@ -94,15 +95,15 @@ return function(frame: Frame)
return options
end,
nil,
0,
style
0
)
)
button.Parent = halfFrame
end
do
local button = maid:GiveTask(
Module.ColdFusion.primary(
style,
function(input: string): string
print(`entered: {input}`)
return input
Expand All @@ -116,15 +117,15 @@ return function(frame: Frame)
return options
end,
nil,
0,
style
0
)
)
button.Parent = halfFrame
end
do
local button = maid:GiveTask(
Module.ColdFusion.secondary(
style,
function(input: string): string
print(`entered: {input}`)
return input
Expand All @@ -138,15 +139,15 @@ return function(frame: Frame)
return options
end,
nil,
0,
style
0
)
)
button.Parent = halfFrame
end
do
local button = maid:GiveTask(
Module.ColdFusion.tertiary(
style,
function(input: string): string
print(`entered: {input}`)
return input
Expand All @@ -160,8 +161,7 @@ return function(frame: Frame)
return options
end,
nil,
0,
style
0
)
)
button.Parent = halfFrame
Expand Down
7 changes: 5 additions & 2 deletions src/Util/PopUp/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ function Util.ColdFusion.new(absolutePosition: CanBeState<Vector2>, anchorPoint:
local absSize = out.AbsoluteSize
local goalPos = goalAbsolutePositionState:Get()
local aPoint = anchorPointState:Get()
local x = math.clamp(goalPos.X, absSize.X * aPoint.X, viewportSize.X - absSize.X * (1 - aPoint.X))
local y = math.clamp(goalPos.Y, absSize.Y * aPoint.Y, viewportSize.Y - absSize.Y * (1 - aPoint.Y))
local xMin = absSize.X * aPoint.X
local yMin = absSize.Y * aPoint.Y

local x = math.clamp(goalPos.X, xMin, math.max(xMin, viewportSize.X - absSize.X * (1 - aPoint.X)))
local y = math.clamp(goalPos.Y, yMin, math.max(yMin, viewportSize.Y - absSize.Y * (1 - aPoint.Y)))
finalPositionState:Set(Vector2.new(x, y))
end))

Expand Down

0 comments on commit 009cba3

Please sign in to comment.