Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auras: Add .tooltipAnchor option #511

Merged
merged 1 commit into from Jul 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 21 additions & 1 deletion elements/auras.lua
Expand Up @@ -28,6 +28,8 @@ At least one of the above widgets must be present for the element to work.
.initialAnchor - Anchor point for the icons. Defaults to 'BOTTOMLEFT' (string)
.filter - Custom filter list for auras to display. Defaults to 'HELPFUL' for buffs and 'HARMFUL' for
debuffs (string)
.tooltipAnchor - Anchor point for the tooltip. Defaults to 'ANCHOR_BOTTOMRIGHT', however, if a frame has anchoring
restrictions it will be set to 'ANCHOR_CURSOR' (string)

## Options Auras

Expand Down Expand Up @@ -78,7 +80,7 @@ end
local function onEnter(self)
if(not self:IsVisible()) then return end

GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMRIGHT')
GameTooltip:SetOwner(self, self:GetParent().__owner.tooltipAnchor)
self:UpdateTooltip()
end

Expand Down Expand Up @@ -488,6 +490,12 @@ local function Enable(self)
buffs.createdIcons = buffs.createdIcons or 0
buffs.anchoredIcons = 0

if(not pcall(self.GetCenter, self)) then
buffs.tooltipAnchor = 'ANCHOR_CURSOR'
else
buffs.tooltipAnchor = buffs.tooltipAnchor or 'ANCHOR_BOTTOMRIGHT'
end

buffs:Show()
end

Expand All @@ -499,6 +507,12 @@ local function Enable(self)
debuffs.createdIcons = debuffs.createdIcons or 0
debuffs.anchoredIcons = 0

if(not pcall(self.GetCenter, self)) then
debuffs.tooltipAnchor = 'ANCHOR_CURSOR'
else
debuffs.tooltipAnchor = debuffs.tooltipAnchor or 'ANCHOR_BOTTOMRIGHT'
end

debuffs:Show()
end

Expand All @@ -510,6 +524,12 @@ local function Enable(self)
auras.createdIcons = auras.createdIcons or 0
auras.anchoredIcons = 0

if(not pcall(self.GetCenter, self)) then
auras.tooltipAnchor = 'ANCHOR_CURSOR'
else
auras.tooltipAnchor = auras.tooltipAnchor or 'ANCHOR_BOTTOMRIGHT'
end

auras:Show()
end

Expand Down