Skip to content

Commit 58de021

Browse files
committed
recode expand button on character frame skin
1 parent 5335beb commit 58de021

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

ElvUI/Cata/Modules/Skins/Character.lua

+22-19
Original file line numberDiff line numberDiff line change
@@ -344,25 +344,28 @@ function S:CharacterFrame()
344344
end
345345

346346
do -- Expand Button
347-
local CharacterFrameExpandButton = _G.CharacterFrameExpandButton
348-
S:HandleNextPrevButton(CharacterFrameExpandButton, nil, nil, nil, nil, nil, 26) -- Default UI button size is 32
349-
CharacterFrameExpandButton:ClearAllPoints()
350-
CharacterFrameExpandButton:Point('BOTTOMRIGHT', _G.CharacterFrameInset, 'BOTTOMRIGHT', -3, 2)
351-
352-
CharacterFrameExpandButton:SetNormalTexture(E.Media.Textures.ArrowUp)
353-
CharacterFrameExpandButton.SetNormalTexture = E.noop
354-
CharacterFrameExpandButton:SetPushedTexture(E.Media.Textures.ArrowUp)
355-
CharacterFrameExpandButton.SetPushedTexture = E.noop
356-
CharacterFrameExpandButton:SetDisabledTexture(E.Media.Textures.ArrowUp)
357-
CharacterFrameExpandButton.SetDisabledTexture = E.noop
358-
359-
local expandButtonNormal, expandButtonPushed = CharacterFrameExpandButton:GetNormalTexture(), CharacterFrameExpandButton:GetPushedTexture()
360-
local expandButtonCvar = GetCVar('characterFrameCollapsed') ~= '0'
361-
expandButtonNormal:SetRotation(expandButtonCvar and -1.57 or 1.57)
362-
expandButtonPushed:SetRotation(expandButtonCvar and -1.57 or 1.57)
363-
364-
hooksecurefunc(CharacterFrame, 'Collapse', function() expandButtonNormal:SetRotation(-1.57) expandButtonPushed:SetRotation(-1.57) end)
365-
hooksecurefunc(CharacterFrame, 'Expand', function() expandButtonNormal:SetRotation(1.57) expandButtonPushed:SetRotation(1.57) end)
347+
local expandButton = _G.CharacterFrameExpandButton
348+
S:HandleNextPrevButton(expandButton, nil, nil, nil, nil, nil, 26) -- Default UI button size is 32
349+
350+
expandButton:ClearAllPoints()
351+
expandButton:Point('BOTTOMRIGHT', _G.CharacterFrameInset, 'BOTTOMRIGHT', -3, 2)
352+
353+
local expandNormal = expandButton:GetNormalTexture()
354+
local expandPushed = expandButton:GetPushedTexture()
355+
356+
local function ExpandToggle()
357+
expandButton:SetNormalTexture(E.Media.Textures.ArrowUp)
358+
expandButton:SetPushedTexture(E.Media.Textures.ArrowUp)
359+
expandButton:SetDisabledTexture(E.Media.Textures.ArrowUp)
360+
361+
local expanded = CharacterFrame.Expanded
362+
expandNormal:SetRotation(expanded and 1.57 or -1.57)
363+
expandPushed:SetRotation(expanded and 1.57 or -1.57)
364+
end
365+
366+
ExpandToggle()
367+
hooksecurefunc(CharacterFrame, 'Collapse', ExpandToggle)
368+
hooksecurefunc(CharacterFrame, 'Expand', ExpandToggle)
366369
end
367370

368371
-- Pet Frame

0 commit comments

Comments
 (0)