WoWInterface SVN PhanxWatchFrame

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 12 to Rev 13
    Reverse comparison

Rev 12 → Rev 13

Animations.lua
1,21 → 1,30
local MIN_ALPHA, MAX_ALPHA = 0.25, 1
local MIN_ALPHA = 0.4
local MAX_ALPHA = 1
 
local hasMouseFocus
local hasMouseFocus = false
 
local GetMouseFocus = GetMouseFocus
local WorldFrame = WorldFrame
 
local fades = WatchFrame:CreateAnimationGroup()
WatchFrame:SetAlpha(MIN_ALPHA)
 
local fadeIn = fades:CreateAnimation("Alpha")
fadeIn:SetChange(MAX_ALPHA - MIN_ALPHA)
fadeIn:SetDuration(0.25)
fadeIn:SetStartDelay(0)
WatchFrame.animateFadeIn = fadeIn
local fadeIn = WatchFrame:CreateAnimationGroup()
fadeIn:SetScript("OnFinished", function(self) WatchFrame:SetAlpha(MAX_ALPHA) end)
fadeIn.anim = fadeIn:CreateAnimation("Alpha")
fadeIn.anim:SetChange(MAX_ALPHA - MIN_ALPHA)
fadeIn.anim:SetDuration(0.2)
fadeIn.anim:SetStartDelay(0.1)
fadeIn.anim:SetSmoothing("OUT")
WatchFrame.FadeInAnimation = fadeIn
 
local fadeOut = fades:CreateAnimation("Alpha")
fadeOut:SetChange(MIN_ALPHA - MAX_ALPHA)
fadeOut:SetDuration(0.5)
fadeOut:SetStartDelay(0.5)
WatchFrame.animateFadeOut = fadeOut
local fadeOut = WatchFrame:CreateAnimationGroup()
fadeOut:SetScript("OnFinished", function(self) WatchFrame:SetAlpha(MIN_ALPHA) end)
fadeOut.anim = fadeOut:CreateAnimation("Alpha")
fadeOut.anim:SetChange(MIN_ALPHA - MAX_ALPHA)
fadeOut.anim:SetDuration(0.4)
fadeOut.anim:SetStartDelay(0.2)
fadeOut.anim:SetSmoothing("IN")
WatchFrame.FadeOutAnimation = fadeOut
 
local descendants = setmetatable({}, { __index = function(t, f)
local parent = f:GetParent()
32,20 → 41,19
 
WatchFrame:HookScript("OnUpdate", function(self, elapsed)
local mouseFocus = GetMouseFocus()
local gotMouseFocus = mouseFocus == self or descendants[mouseFocus]
if not mouseFocus then
return
end
local gotMouseFocus = mouseFocus == self or descendants[mouseFocus] or (mouseFocus == WorldFrame and self:IsMouseOver(10, -10, -10, 10))
if gotMouseFocus == hasMouseFocus then
return
end
hasMouseFocus = gotMouseFocus
fadeOut:Stop()
fadeIn:Stop()
if gotMouseFocus then
print("WatchFrame gained mouse focus.")
fades:Stop()
self:SetAlpha(MIN_ALPHA)
fadeIn:Play()
else
print("WatchFrame lost mouse focus.")
fades:Stop()
self:SetAlpha(MAX_ALPHA)
fadeOut:Play()
end
hasMouseFocus = gotMouseFocus
end)
\ No newline at end of file
Addon.lua
6,7 → 6,7
 
hooksecurefunc("WatchFrameItem_UpdateCooldown", function(button)
if button and PhanxBorder and not button.BorderTextures then
button:SetSize(34, 34)
button:SetSize(32, 32)
PhanxBorder.AddBorder(button)
_G[button:GetName() .. "IconTexture"]:SetTexCoord(0.06, 0.94, 0.06, 0.94)
_G[button:GetName() .. "NormalTexture"]:SetTexture("")
29,15 → 29,7
line.text:SetTextColor(1, 1, 1)
end
end)
--[[
local wasMouseOver
WatchFrame:HookScript("OnUpdate", function(self)
local isMouseOver = self:IsMouseOver()
if isMouseOver == wasMouseOver then return end
self:SetAlpha(isMouseOver and 1 or 0.3)
wasMouseOver = isMouseOver
end)
]]
 
hooksecurefunc("WatchFrameLinkButtonTemplate_Highlight", function(self, onEnter)
if onEnter then
for i = self.startLine, self.lastLine do
65,7 → 57,7
 
local origOnClick = WatchFrameLinkButtonTemplate_OnClick
WatchFrameLinkButtonTemplate_OnClick = function(self, button, pushed)
if button == "LeftButton" and not (IsAltKeyDown() or IsControlKeyDown() or IsShiftKeyDown()) then
if button == "LeftButton" and not IsModifierKeyDown() then
CloseDropDownMenus()
if self.type == "QUEST" then
local questIndex = GetQuestIndexForWatch(self.index)
118,27 → 110,26
f:EnableMouse(false)
f:ClearAllPoints()
f:SetClampedToScreen(false)
f:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 30, 17)
f:SetPoint("BOTTOMLEFT", UIParent, "LEFT", 30, 0)
f:SetScale(1.2)
f:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 30, 10)
f:SetPoint("BOTTOMLEFT", UIParent, "LEFT", 30, -100)
f:SetScale(1.1)
f.ClearAllPoints = noop
f.SetPoint = noop
 
local h = WatchFrameHeader
h:SetHeight(1)
h.SetHeight = noop
h:Hide()
h.SetHeight = noop
h.Show = noop
 
local b = WatchFrameCollapseExpandButton
b:ClearAllPoints()
b:SetPoint("TOPLEFT", UIParent)
b:SetSize(24, 24)
b:SetAlpha(0)
b:SetScript("OnEnter", function(b) b:SetAlpha(1) end)
b:SetScript("OnLeave", function(b) b:SetAlpha(0) end)
b:RegisterForClicks("LeftButtonUp", "RightButtonUp")
b:SetScript("OnClick", function(b,btn)
b:SetScript("OnClick", function(b, btn)
if btn == "LeftButton" then
return WatchFrame_CollapseExpandButton_OnClick(b, btn)
else