Skip to content

Commit

Permalink
Fix position not sticking for Extra Action Button and the Vehicle Exi…
Browse files Browse the repository at this point in the history
…t button
  • Loading branch information
Nevcairiel committed Oct 28, 2022
1 parent 68eeca9 commit 2e0f14d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ globals = {
"CharacterBag1Slot",
"CharacterBag0Slot",
"MainMenuBarBackpackButton",

"UIParentBottomManagedFrameContainer",
}

read_globals = {
Expand Down Expand Up @@ -89,6 +91,7 @@ read_globals = {
"AutoCastShine_AutoCastStart",
"AutoCastShine_AutoCastStop",
"CooldownFrame_Set",
"EditModeMagnetismManager",
"GridLayoutUtil",
"HasMultiCastActionBar",
"MainMenuBarVehicleLeaveButton_Update",
Expand Down
21 changes: 20 additions & 1 deletion ExtraActionBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ function ExtraActionBarMod:OnEnable()
self.bar = setmetatable(Bartender4.Bar:Create("ExtraActionBar", self.db.profile, L["Extra Action Bar"], 2), {__index = ExtraActionBar})
self.bar.content = ExtraAbilityContainer

self.bar.content.ignoreFramePositionManager = true
-- remove EditMode hooks
self.bar.content.ClearAllPoints = nil
self.bar.content.SetPoint = nil
self.bar.content.SetScale = nil

self.bar.content:SetToplevel(false)
self.bar.content:SetParent(self.bar)
self.bar.content:SetScript("OnShow", nil)
Expand All @@ -51,6 +55,11 @@ function ExtraActionBarMod:OnEnable()
self:SecureHook(ZoneAbilityFrame, "UpdateDisplayedZoneAbilities")
if ExtraAbilityContainer.ApplySystemAnchor then
self:SecureHook(ExtraAbilityContainer, "ApplySystemAnchor")
self:SecureHook(ExtraAbilityContainer, "HighlightSystem")
end

if UIParentBottomManagedFrameContainer then
UIParentBottomManagedFrameContainer.showingFrames[ExtraAbilityContainer] = nil
end
end

Expand All @@ -74,7 +83,16 @@ function ExtraActionBarMod:UpdateDisplayedZoneAbilities()
ZoneAbilityFrame.Style:SetShown(not self.db.profile.hideArtwork)
end

function ExtraActionBarMod:HighlightSystem()
ExtraAbilityContainer.Selection:Hide()
EditModeMagnetismManager:UnregisterFrame(ExtraAbilityContainer)
end

function ExtraActionBarMod:ApplySystemAnchor()
if UIParentBottomManagedFrameContainer then
UIParentBottomManagedFrameContainer.showingFrames[ExtraAbilityContainer] = nil
end

self.bar:PerformLayout()
end

Expand All @@ -95,6 +113,7 @@ end
function ExtraActionBar:PerformLayout()
self:SetSize(128, 128)
local bar = self.content
bar:SetParent(self)
bar:ClearAllPoints()
bar:SetPoint("CENTER", self, "TOPLEFT", 64, -64)
end
31 changes: 27 additions & 4 deletions VehicleBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,36 @@ end
function VehicleBarMod:OnEnable()
if not self.bar then
self.bar = setmetatable(Bartender4.Bar:Create("Vehicle", self.db.profile, L["Vehicle Bar"]), {__index = VehicleBar})
self.bar.content = MainMenuBarVehicleLeaveButton
self.bar.content = MainMenuBarVehicleLeaveButton

-- remove EditMode hooks
self.bar.content.ClearAllPoints = nil
self.bar.content.SetPoint = nil
self.bar.content.SetScale = nil

self.bar.content:SetParent(self.bar)
self.bar.content.ClearSetPoint = self.bar.ClearSetPoint
self.bar.content:SetScript("OnShow", nil)
self.bar.content:SetScript("OnHide", nil)
end
if MainMenuBarVehicleLeaveButton_Update then
self:RawHook("MainMenuBarVehicleLeaveButton_Update", true)
else
self:SecureHook(MainMenuBarVehicleLeaveButton, "Update", "MainMenuBarVehicleLeaveButton_Update")
end

if MainMenuBarVehicleLeaveButton.ApplySystemAnchor then
self:SecureHook(MainMenuBarVehicleLeaveButton, "ApplySystemAnchor")
self:SecureHook(MainMenuBarVehicleLeaveButton, "HighlightSystem")
end

if EditModeManagerFrame then
self:SecureHook(EditModeManagerFrame, "UpdateBottomActionBarPositions")
self:SecureHook(EditModeManagerFrame, "UpdateBottomActionBarPositions", "ApplySystemAnchor")
end

if UIParentBottomManagedFrameContainer then
UIParentBottomManagedFrameContainer.showingFrames[MainMenuBarVehicleLeaveButton] = nil
end

self.bar:Enable()
self:ToggleOptions()
self:ApplyConfig()
Expand Down Expand Up @@ -75,10 +93,15 @@ function VehicleBarMod:MainMenuBarVehicleLeaveButton_Update()
end
end

function VehicleBarMod:UpdateBottomActionBarPositions()
function VehicleBarMod:ApplySystemAnchor()
self.bar:PerformLayout()
end

function VehicleBarMod:HighlightSystem()
MainMenuBarVehicleLeaveButton.Selection:Hide()
EditModeMagnetismManager:UnregisterFrame(MainMenuBarVehicleLeaveButton)
end

function VehicleBar:ApplyConfig(config)
Bar.ApplyConfig(self, config)

Expand Down

0 comments on commit 2e0f14d

Please sign in to comment.