forked from Dusk/ShaguTweaks-ClassicAPI
Bring in 27 module files from Dusk/ShaguTweaks-Extras-ClassicAPI (8e14bb4): action bar, chat, loot, macro, merchant (Buy Em All), minimap & world map, tooltip and unit frame modules, with their textures. Titles are unchanged, so saved toggles carry over. - Categories: Chat -> Chat & Social, World Map -> Minimap & World Map, Merchant & Auction -> Merchant; Macro is a new category. - Texture paths point at ShaguTweaks\img. - Not merged: Raid Frames, Bag Item Click and Bag Search Bar (Bagshui covers them), Auction Alt-Buy (aux covers it). - Chat note when the old ShaguTweaks-extras addon is still enabled. - English translation keys, notices, license copy, asset provenance, README, changelog and version 3.7. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019W3rwusM4i1CYaHQAYixJ7
139 lines
3.5 KiB
Lua
Executable File
139 lines
3.5 KiB
Lua
Executable File
-- Shared mouseover actionbar helper.
|
|
-- Adapted from TokensWorth/ShaguTweaks-mods (MIT, original copyright GryllsAddons).
|
|
|
|
local _G = ShaguTweaks.GetGlobalEnv()
|
|
|
|
if not ShaguTweaks.CreateMouseoverActionBar then
|
|
ShaguTweaks.CreateMouseoverActionBar = function(bar, visibilityFlag)
|
|
if not bar or not visibilityFlag then return end
|
|
if bar.ShaguTweaksMouseoverController then return end
|
|
|
|
local controller = CreateFrame("Frame", nil, UIParent)
|
|
local hotspot = CreateFrame("Frame", nil, UIParent)
|
|
|
|
controller.bar = bar
|
|
controller.hotspot = hotspot
|
|
controller.visibilityFlag = visibilityFlag
|
|
controller.enabled = false
|
|
controller.elapsed = 0
|
|
controller.idle = 0
|
|
|
|
bar.ShaguTweaksMouseoverController = controller
|
|
|
|
-- One invisible reveal area replaces the original per-button overlay
|
|
-- frames. It only accepts mouse input while the actionbar is hidden.
|
|
hotspot:SetAllPoints(bar)
|
|
hotspot:SetFrameStrata("DIALOG")
|
|
hotspot:EnableMouse(false)
|
|
hotspot:Hide()
|
|
|
|
local function ReadEnabled()
|
|
return _G[visibilityFlag] and true or false
|
|
end
|
|
|
|
local function StopWatching()
|
|
controller:SetScript("OnUpdate", nil)
|
|
controller.elapsed = 0
|
|
controller.idle = 0
|
|
end
|
|
|
|
local function StartWatching()
|
|
if not controller.enabled or not bar:IsShown() then return end
|
|
|
|
hotspot:EnableMouse(false)
|
|
controller.elapsed = 0
|
|
controller.idle = 0
|
|
|
|
controller:SetScript("OnUpdate", function()
|
|
this.elapsed = this.elapsed + (arg1 or 0)
|
|
if this.elapsed < .10 then return end
|
|
|
|
local step = this.elapsed
|
|
this.elapsed = 0
|
|
|
|
if not this.enabled then
|
|
StopWatching()
|
|
hotspot:EnableMouse(false)
|
|
hotspot:Hide()
|
|
return
|
|
end
|
|
|
|
if not bar:IsShown() then
|
|
StopWatching()
|
|
hotspot:Show()
|
|
hotspot:EnableMouse(true)
|
|
return
|
|
end
|
|
|
|
if MouseIsOver(bar) then
|
|
this.idle = 0
|
|
return
|
|
end
|
|
|
|
this.idle = this.idle + step
|
|
if this.idle >= 2 then
|
|
StopWatching()
|
|
bar:Hide()
|
|
end
|
|
end)
|
|
end
|
|
|
|
local function Sync()
|
|
controller.enabled = ReadEnabled()
|
|
|
|
if not controller.enabled then
|
|
StopWatching()
|
|
hotspot:EnableMouse(false)
|
|
hotspot:Hide()
|
|
return
|
|
end
|
|
|
|
hotspot:Show()
|
|
|
|
if bar:IsShown() then
|
|
StartWatching()
|
|
else
|
|
hotspot:EnableMouse(true)
|
|
end
|
|
end
|
|
|
|
hotspot:SetScript("OnEnter", function()
|
|
if not controller.enabled then return end
|
|
|
|
hotspot:EnableMouse(false)
|
|
bar:Show()
|
|
-- The bar's OnShow script starts the watcher. Avoid a second redundant
|
|
-- StartWatching() call here.
|
|
end)
|
|
|
|
-- Keep existing scripts intact while observing native/UI-addon visibility
|
|
-- changes. These wrappers are installed once per bar.
|
|
local oldOnShow = bar:GetScript("OnShow")
|
|
bar:SetScript("OnShow", function()
|
|
if oldOnShow then oldOnShow() end
|
|
if controller.enabled then StartWatching() end
|
|
end)
|
|
|
|
local oldOnHide = bar:GetScript("OnHide")
|
|
bar:SetScript("OnHide", function()
|
|
if oldOnHide then oldOnHide() end
|
|
|
|
StopWatching()
|
|
|
|
if controller.enabled then
|
|
hotspot:Show()
|
|
hotspot:EnableMouse(true)
|
|
else
|
|
hotspot:EnableMouse(false)
|
|
hotspot:Hide()
|
|
end
|
|
end)
|
|
|
|
controller:RegisterEvent("PLAYER_ENTERING_WORLD")
|
|
controller:RegisterEvent("CVAR_UPDATE")
|
|
controller:SetScript("OnEvent", Sync)
|
|
|
|
Sync()
|
|
end
|
|
end
|