X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/d51d314274936814dec7d124c9ec5e5165666918..52e517547bb85ea0705fbae13518a4c563abc77d:/OmaUF/UnitFrames.lua diff --git a/OmaUF/UnitFrames.lua b/OmaUF/UnitFrames.lua index 76c2c7e..f4b7521 100644 --- a/OmaUF/UnitFrames.lua +++ b/OmaUF/UnitFrames.lua @@ -21,8 +21,8 @@ local shieldColor = Settings.ShieldColor; local shieldhlColor = Settings.ShieldhlColor; local healpredColor = Settings.HealpredColor; local healabsorbColor = Settings.HealabsorbColor; +local width, height = Settings.Width, Settings.Height; -- placeholders with visible values when error happens -local width, height = 10, 10; local anchorX, anchorY = 10, 10; local attributes = {}; @@ -69,7 +69,7 @@ local function frameHide(frame) end local function showTooltip(frame) - GameTooltip_SetDefaultAnchor(GameTooltip, PlayerFrame); + GameTooltip_SetDefaultAnchor(GameTooltip, frame); GameTooltip:SetUnit(frame:GetAttribute("unit")); end @@ -144,11 +144,6 @@ local function setupFrame(frame, secure, unit) frame.healabsorb:SetPoint("BOTTOMRIGHT", frame.health, "BOTTOMRIGHT"); frame.healabsorb:SetColorTexture(unpack(healabsorbColor)); frame.healabsorb:Hide(); - frame.overlay = frame:CreateTexture(nil, "ARTWORK", nil, 1); - frame.overlay:SetPoint("TOPLEFT", frame.healthback, "TOPLEFT"); - frame.overlay:SetPoint("BOTTOMRIGHT", frame.healthback, "BOTTOMRIGHT"); - frame.overlay:SetColorTexture(1, 1, 1); - frame.overlay:Hide(); frame.role = frame:CreateTexture(nil, "OVERLAY"); frame.role:SetPoint("TOPLEFT", frame.healthback, "TOPRIGHT", -8, 8); frame.role:SetPoint("BOTTOMRIGHT", frame.healthback, "TOPRIGHT", 8, -8); @@ -176,9 +171,6 @@ local function setupFrame(frame, secure, unit) frame:SetScript("OnShow", frameShow); frame:SetScript("OnHide", frameHide); frame:SetScript("OnEvent", unitEvent); - -- let other addons hook these to anchor tooltip elsewhere - GameTooltip = _G["GameTooltip"]; - GameTooltip_SetDefaultAnchor = _G["GameTooltip_SetDefaultAnchor"]; secure:SetScript("OnEnter", showTooltip); secure:SetScript("OnLeave", hideTooltip); -- set attributes @@ -236,18 +228,21 @@ local function initializeTarget(parent) secure:SetAttribute("_onstate-vehicleui", vehicletoggle); end +local function loadCharSettings() + anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY; + attributes = Settings.Character.Clickheal; +end + local function initialize() + loadCharSettings(); + -- let other addons hook these to anchor tooltip elsewhere + GameTooltip = _G["GameTooltip"]; + GameTooltip_SetDefaultAnchor = _G["GameTooltip_SetDefaultAnchor"]; initializePlayer(UIParent); initializeTarget(UIParent); -- TODO boss frames, pet frame, (arena frames) end -local function loadCharSettings() - width, height = Settings.Character.Width, Settings.Character.Height; - anchorX, anchorY = Settings.Character.AnchorX, Settings.Character.AnchorY; - attributes = Settings.Character.Clickheal; -end - local hidden = false; local function hideBlizzardFrames() if hidden then return end @@ -281,15 +276,11 @@ local function hideBlizzardFrames() PlayerFrame:SetDontSavePosition(true); end -UnitFrames:RegisterEvent("ADDON_LOADED"); UnitFrames:RegisterEvent("PLAYER_LOGIN"); UnitFrames:SetScript("OnEvent", function(self, event) if event == "PLAYER_LOGIN" then + OmaUFLoadChar(); hideBlizzardFrames(); initialize(); - elseif event == "ADDON_LOADED" then - OmaUFLoadChar(); - loadCharSettings(); - OmaUFEvents.LoadChar(); end end);