mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-12 16:40:00 +00:00
Use SetShown/SetSize in panel module
Replace manual Show/Hide toggles with SetShown(not ... ) and replace SetWidth/SetHeight with SetSize in modules/panel.lua. Changes simplify toggle logic (timer, WorldMap, chat hide buttons) and unify sizing calls for timer, frames, textures, and microbutton. No behavior changes intended; purely refactor for conciseness and consistency.
This commit is contained in:
+8
-20
@@ -37,11 +37,7 @@ pfUI:RegisterModule("panel", function()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if arg1 == "LeftButton" then
|
if arg1 == "LeftButton" then
|
||||||
if widget.timerFrame:IsShown() then
|
widget.timerFrame:SetShown(not widget.timerFrame:IsShown())
|
||||||
widget.timerFrame:Hide()
|
|
||||||
else
|
|
||||||
widget.timerFrame:Show()
|
|
||||||
end
|
|
||||||
elseif arg1 == "RightButton" then
|
elseif arg1 == "RightButton" then
|
||||||
widget.timerFrame.Snapshot = GetTime()
|
widget.timerFrame.Snapshot = GetTime()
|
||||||
end
|
end
|
||||||
@@ -60,8 +56,7 @@ pfUI:RegisterModule("panel", function()
|
|||||||
|
|
||||||
widget.timerFrame = CreateFrame("Frame", "pfUITimer", UIParent)
|
widget.timerFrame = CreateFrame("Frame", "pfUITimer", UIParent)
|
||||||
widget.timerFrame:Hide()
|
widget.timerFrame:Hide()
|
||||||
widget.timerFrame:SetWidth(120)
|
widget.timerFrame:SetSize(120, 35)
|
||||||
widget.timerFrame:SetHeight(35)
|
|
||||||
widget.timerFrame:SetPoint("TOP", 0, -100)
|
widget.timerFrame:SetPoint("TOP", 0, -100)
|
||||||
UpdateMovable(widget.timerFrame)
|
UpdateMovable(widget.timerFrame)
|
||||||
|
|
||||||
@@ -485,11 +480,7 @@ pfUI:RegisterModule("panel", function()
|
|||||||
GameTooltip:Show()
|
GameTooltip:Show()
|
||||||
end
|
end
|
||||||
widget.Click = function()
|
widget.Click = function()
|
||||||
if WorldMapFrame:IsShown() then
|
WorldMapFrame:SetShown(not WorldMapFrame:IsShown())
|
||||||
WorldMapFrame:Hide()
|
|
||||||
else
|
|
||||||
WorldMapFrame:Show()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
widget:SetScript("OnEvent", function()
|
widget:SetScript("OnEvent", function()
|
||||||
pfUI.panel:OutputPanel("zone", GetMinimapZoneText(), widget.Tooltip, widget.Click)
|
pfUI.panel:OutputPanel("zone", GetMinimapZoneText(), widget.Tooltip, widget.Click)
|
||||||
@@ -638,8 +629,7 @@ pfUI:RegisterModule("panel", function()
|
|||||||
local frame = CreateFrame("Button", nil, parent)
|
local frame = CreateFrame("Button", nil, parent)
|
||||||
frame:SetFrameLevel(0)
|
frame:SetFrameLevel(0)
|
||||||
frame:ClearAllPoints()
|
frame:ClearAllPoints()
|
||||||
frame:SetWidth(width)
|
frame:SetSize(width, parent:GetHeight())
|
||||||
frame:SetHeight(parent:GetHeight())
|
|
||||||
frame:SetPoint(location, 0, 0)
|
frame:SetPoint(location, 0, 0)
|
||||||
frame.text = frame:CreateFontString("Status", "LOW", "GameFontNormal")
|
frame.text = frame:CreateFontString("Status", "LOW", "GameFontNormal")
|
||||||
frame.text:ClearAllPoints()
|
frame.text:ClearAllPoints()
|
||||||
@@ -680,8 +670,7 @@ pfUI:RegisterModule("panel", function()
|
|||||||
local imgstring = "img:" .. leftright
|
local imgstring = "img:" .. leftright
|
||||||
parent.texture:SetTexture(pfUI.media[imgstring])
|
parent.texture:SetTexture(pfUI.media[imgstring])
|
||||||
parent.texture:SetPoint("CENTER", 0, 0)
|
parent.texture:SetPoint("CENTER", 0, 0)
|
||||||
parent.texture:SetWidth(8)
|
parent.texture:SetSize(8, 8)
|
||||||
parent.texture:SetHeight(8)
|
|
||||||
parent.texture:SetVertexColor(.25,.25,.25,1)
|
parent.texture:SetVertexColor(.25,.25,.25,1)
|
||||||
return parent.texture
|
return parent.texture
|
||||||
end
|
end
|
||||||
@@ -703,7 +692,7 @@ pfUI:RegisterModule("panel", function()
|
|||||||
UpdateMovable(pfUI.panel.left)
|
UpdateMovable(pfUI.panel.left)
|
||||||
|
|
||||||
pfUI.panel.left.hide:SetScript("OnClick", function()
|
pfUI.panel.left.hide:SetScript("OnClick", function()
|
||||||
if pfUI.chat.left:IsShown() then pfUI.chat.left:Hide() else pfUI.chat.left:Show() end
|
pfUI.chat.left:SetShown(not pfUI.chat.left:IsShown())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if not pfUI.chat then pfUI.panel.left.hide:Hide() end
|
if not pfUI.chat then pfUI.panel.left.hide:Hide() end
|
||||||
@@ -740,7 +729,7 @@ pfUI:RegisterModule("panel", function()
|
|||||||
UpdateMovable(pfUI.panel.right)
|
UpdateMovable(pfUI.panel.right)
|
||||||
|
|
||||||
pfUI.panel.right.hide:SetScript("OnClick", function()
|
pfUI.panel.right.hide:SetScript("OnClick", function()
|
||||||
if pfUI.chat.right:IsShown() then pfUI.chat.right:Hide() else pfUI.chat.right:Show() end
|
pfUI.chat.right:SetShown(not pfUI.chat.right:IsShown())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if not pfUI.chat then pfUI.panel.right.hide:Hide() end
|
if not pfUI.chat then pfUI.panel.right.hide:Hide() end
|
||||||
@@ -789,8 +778,7 @@ pfUI:RegisterModule("panel", function()
|
|||||||
pfUI.panel.microbutton = CreateFrame("Frame", "pfPanelMicroButton", UIParent)
|
pfUI.panel.microbutton = CreateFrame("Frame", "pfPanelMicroButton", UIParent)
|
||||||
pfUI.panel.microbutton:SetPoint("TOP", pfUI.panel.minimap, "BOTTOM", 0, -2*default_border)
|
pfUI.panel.microbutton:SetPoint("TOP", pfUI.panel.minimap, "BOTTOM", 0, -2*default_border)
|
||||||
UpdateMovable(pfUI.panel.microbutton)
|
UpdateMovable(pfUI.panel.microbutton)
|
||||||
pfUI.panel.microbutton:SetHeight(23)
|
pfUI.panel.microbutton:SetSize(145, 23)
|
||||||
pfUI.panel.microbutton:SetWidth(145)
|
|
||||||
pfUI.panel.microbutton:SetFrameStrata("MEDIUM")
|
pfUI.panel.microbutton:SetFrameStrata("MEDIUM")
|
||||||
|
|
||||||
for i=1,table.getn(MICRO_BUTTONS) do
|
for i=1,table.getn(MICRO_BUTTONS) do
|
||||||
|
|||||||
Reference in New Issue
Block a user