Skip to content

Commit

Permalink
Keep the Settings menu onscreen vertically
Browse files Browse the repository at this point in the history
  • Loading branch information
veechs committed Feb 5, 2025
1 parent 1ae78f5 commit 3b54cf5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions Components/Inventory.Menus.Settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ function Inventory:FixSettingsMenuPosition(secondPass)
-- Trigger second pass position check on next frame update.
Bagshui:QueueClassCallback(self, self.FixSettingsMenuPosition, nil, nil, true)
else
local positionChanged = false

-- Check to see if the Settings menu has been positioned offscreen horizontally
-- or is overlapping the Inventory window, and if so, move it to the other side.
if
Expand All @@ -90,14 +92,21 @@ function Inventory:FixSettingsMenuPosition(secondPass)
)
then
self.lastSettingsAnchor = BsUtil.FlipAnchorPointComponent(self.lastSettingsAnchor, 2)
self.lastSettingsXOffset = self.lastSettingsXOffset * -1
self.lastSettingsXOffset = -self.lastSettingsXOffset
positionChanged = true
end

-- Vertical adjustment to keep the entire menu onscreen.
local yOffset = BsUtil.GetFrameOffscreenAmount(menu, "y")

if positionChanged or yOffset ~= 0 then
menu:ClearAllPoints()
menu:SetPoint(
self.lastSettingsAnchor,
self.uiFrame,
BsUtil.FlipAnchorPointComponent(self.lastSettingsAnchor, 2),
self.lastSettingsXOffset,
0
yOffset
)
end
end
Expand Down

0 comments on commit 3b54cf5

Please sign in to comment.