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

Choose cd frame over parent frame #415

Open
XyzKangUI opened this issue Jan 3, 2024 · 2 comments
Open

Choose cd frame over parent frame #415

XyzKangUI opened this issue Jan 3, 2024 · 2 comments
Assignees

Comments

@XyzKangUI
Copy link

XyzKangUI commented Jan 3, 2024

Is your feature request related to a problem? Please describe.
When you create 1 frame which holds multiple cooldown frames it will always display only 1 text because of local newDisplay = Addon.Display:GetOrCreate(self:GetParent() or self)

E.g.

local frame = CreateFrame("Frame", nil, UIParent)
local icon1 = frame:CreateTexture(nil, "ARTWORK")
icon1:SetSize(40, 40)
icon1:SetPoint("LEFT", 10, 0)
local icon2 = frame:CreateTexture(nil, "ARTWORK")
icon2:SetSize(40, 40)
icon2:SetPoint("RIGHT", -10, 0)
local cd1 = CreateFrame("Cooldown", nil, frame, "CooldownFrameTemplate")
cd1:SetAllPoints(icon1)
local cd2 = CreateFrame("Cooldown", nil, frame, "CooldownFrameTemplate")
cd2:SetAllPoints(icon2)

The above code in its current form will always display 1 text because of the self:GetParent() being frame for both cd frames. By turning it around to be self or self:GetParent() we can get each cd frame to use its own timer text. This seems to be in line with the blizzard cooldown count behaviour. I have no idea if this causes any regression.

@Tuller Tuller self-assigned this Jan 3, 2024
@Tuller
Copy link
Member

Tuller commented Jan 3, 2024

Do you have an example of where you’d want to see two timers? The current behavior is there to avoid displaying charge and action cooldowns at the same time

@XyzKangUI
Copy link
Author

XyzKangUI commented Jan 4, 2024

Do you have an example of where you’d want to see two timers? The current behavior is there to avoid displaying charge and action cooldowns at the same time

I faced this issue because as shown above I created one frame, multiple textures and a cd frame for each texture. The idea for the code was to create a multi (internal) cooldown tracker for trinkets and other proc based spells, which are always visible. Then I noticed that OmniCC was always showing the text only on one icon at the same time while blizz count down did not. I instantly thought of the idea that the addon was somehow always using the main frame instead of the cd frames and stumbled upon your newDisplay line. If your line is absolutely necessary I could opt for a new frame for each new icon, but I thought implementing it this way was easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants