Skip to content

Commit

Permalink
fix anchor setup order
Browse files Browse the repository at this point in the history
  • Loading branch information
Goldpaw committed Nov 1, 2023
1 parent 6b0b526 commit ef62293
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
12 changes: 6 additions & 6 deletions AzeriteUI/Components/ActionBars/Elements/ActionBars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ ActionBarMod.CreateAnchors = function(self)
local pos = self.db.profile.bars[i].savedPosition

local anchor = ns:GetModule("MovableFramesManager"):RequestAnchor()
anchor:SetTitle(self:GenerateBarDisplayName(i))
anchor:SetScalable(true)

-- Set defaults explicitly
Expand All @@ -463,17 +462,18 @@ ActionBarMod.CreateAnchors = function(self)

-- Size & position according to saved settings
anchor:SetSize(bar:GetSize()) -- assume this exists
anchor:SetScale(pos.scale)
anchor:SetPoint(pos[1], pos[2], pos[3])
anchor:SetScale(pos.scale)
anchor:SetTitle(self:GenerateBarDisplayName(i))

-- Update anchor according to current bar layout
-- This will be called before anchors are shown
anchor.PreUpdate = function(self)
local pos = self.bar.config.savedPosition
bar.anchor:SetSize(self.bar:GetSize())
bar.anchor:SetScale(pos.scale)
bar.anchor:ClearAllPoints()
bar.anchor:SetPoint(pos[1], UIParent, pos[1], pos[2], pos[3])
anchor:SetSize(self.bar:GetSize())
anchor:SetScale(pos.scale)
anchor:ClearAllPoints()
anchor:SetPoint(pos[1], UIParent, pos[1], pos[2], pos[3])
end

-- Color the anchor according to anchor type
Expand Down
11 changes: 6 additions & 5 deletions AzeriteUI/Components/ActionBars/Elements/PetBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -504,18 +504,18 @@ PetBarMod.CreateAnchor = function(self)
if (self.anchor) then return end
if (not self.bar) then return end

local defaults = self:GetDefaults()
local config = defaults.profile
local defaults = self:GetDefaults().profile
local config = self.db.profile

local anchor = ns:GetModule("MovableFramesManager"):RequestAnchor()
anchor:SetScalable(true)
anchor:SetSize(2,2)
anchor:SetDefaultScale(defaults.savedPosition.scale)
anchor:SetDefaultPosition(defaults.savedPosition[1], defaults.savedPosition[2], defaults.savedPosition[3])
anchor:SetSize(self.bar:GetSize())
anchor:SetPoint(config.savedPosition[1], config.savedPosition[2], config.savedPosition[3])
anchor:SetScale(config.savedPosition.scale)
anchor:SetTitle(L["Pet Bar"])

anchor:SetDefaultScale(ns.API.GetEffectiveScale())

anchor.PreUpdate = function()
self:UpdateAnchor()
end
Expand Down Expand Up @@ -559,6 +559,7 @@ PetBarMod.UpdateBar = function(self)
self.needupdate = true
return
end

self.bar:Update()
end

Expand Down
9 changes: 5 additions & 4 deletions AzeriteUI/Components/ActionBars/Elements/StanceBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -473,16 +473,17 @@ StanceBarMod.CreateAnchor = function(self)
if (self.anchor) then return end
if (not self.bar) then return end

local defaults = self:GetDefaults()
local config = defaults.profile
local defaults = self:GetDefaults().profile
local config = self.db.profile

local anchor = ns:GetModule("MovableFramesManager"):RequestAnchor()
anchor:SetScalable(true)
anchor:SetSize(2,2)
anchor:SetDefaultScale(ns.API.GetEffectiveScale())
anchor:SetDefaultPosition(defaults.savedPosition[1], defaults.savedPosition[2], defaults.savedPosition[3])
anchor:SetSize(self.bar:GetSize())
anchor:SetPoint(config.savedPosition[1], config.savedPosition[2], config.savedPosition[3])
anchor:SetScale(config.savedPosition.scale)
anchor:SetTitle(L["Stance Bar"])
anchor:SetDefaultScale(ns.API.GetEffectiveScale())

anchor.PreUpdate = function()
self:UpdateAnchor()
Expand Down
2 changes: 1 addition & 1 deletion AzeriteUI/Core/MovableFrameModule.lua
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ Module.CreateAnchor = function(self, label, watchVariables, colorGroup)
if (defaults.profile.savedPosition) then
anchor:SetPoint(unpack(defaults.profile.savedPosition))
anchor:SetScale(defaults.profile.savedPosition.scale)
anchor:SetDefaultScale(ns.API.GetEffectiveScale())
anchor:SetDefaultPosition(unpack(defaults.profile.savedPosition))
anchor:SetDefaultScale(ns.API.GetEffectiveScale())
anchor:SetTitle(label)
end

Expand Down

0 comments on commit ef62293

Please sign in to comment.