comparison Dock.lua @ 58:0a9a6740ea5d v2.1

- Discarded use of blizzard functions never meant for the wild (http://forums.wowace.com/showthread.php?t=20397) - Fixed dock buttons not highlighting properly - Fixed dock buttons not dropping after selection change - Mouse input is disabled during player movement
author Nenue
date Tue, 12 Jan 2016 04:50:37 -0500
parents c3166f700438
children 516ceb31703d
comparison
equal deleted inserted replaced
57:0d2967941745 58:0a9a6740ea5d
74 local b = (db[sign..'_alpha_on']-db[sign..'_alpha_off']) 74 local b = (db[sign..'_alpha_on']-db[sign..'_alpha_off'])
75 local dur = (a / b) * db[sign..'_fade_out'] 75 local dur = (a / b) * db[sign..'_fade_out']
76 return dur, alph, db[sign..'_alpha_off'] 76 return dur, alph, db[sign..'_alpha_off']
77 end 77 end
78 78
79 local function queueFade (self, duration, from, to)
80 self:SetAlpha(to)
81 end
82
79 function D.UpdateBeacon(beacon) 83 function D.UpdateBeacon(beacon)
80 local db = D.db 84 local db = D.db
81 local isActive = (beacon.raised or beacon.selected) 85 local isActive = (beacon.raised or beacon.selected or beacon.newMessage)
82 if isActive then 86 if isActive then
83 UIFrameFadeIn(beacon, getFadeInArgs('dock_button', beacon)) 87 --print(beacon:GetName(), 'active, fade in')
88 queueFade(beacon, getFadeInArgs('dock_button', beacon))
84 end 89 end
90
85 if beacon.showName or isActive then 91 if beacon.showName or isActive then
86 UIFrameFadeIn(beacon.caption, getFadeInArgs('dock_button', beacon.caption)) 92 --print(beacon:GetName(), 'show name, fade in name')
93 queueFade(beacon.caption, getFadeInArgs('dock_button', beacon.caption))
87 end 94 end
88 95
89 if not isActive then 96 if not isActive then
90 UIFrameFadeOut(beacon, getFadeOutArgs('dock_button', beacon)) 97 queueFade(beacon, getFadeOutArgs('dock_button', beacon))
91 end 98 end
99
92 if (not beacon.showName) and (not isActive) then 100 if (not beacon.showName) and (not isActive) then
93 UIFrameFadeOut(beacon.caption,getFadeOutArgs('dock_button', beacon.caption)) 101 --print(beacon:GetName(), 'no name no active, fade out')
102 queueFade(beacon.caption,getFadeOutArgs('dock_button', beacon.caption))
94 end 103 end
95 end 104 end
96 105
97 --- Dock interactions 106 local function FrameFade(frame)
107 if not D.fader then
108 D.fader = CreateFrame('Frame', 'DevianFaderFrame', UIParent):CreateAnimationGroup('fader'):CreateAnimation('Alpha', 'FadeIn')
109 end
110 end
111
112 --- Dock interaction framescript
98 function D.DockHighlight(beacon) 113 function D.DockHighlight(beacon)
99 db = D.db 114 db = D.db
100 local self = D.dock 115 local self = D.dock
101 local mouseOverDock 116 local mouseOverDock = false
102 if self:IsMouseOver() then 117 if self:IsMouseOver() then
103 mouseOverDock = true 118 mouseOverDock = true
104 end 119 end
105 120
106 if beacon and beacon:IsMouseOver() then 121 if beacon then
122 --print(beacon:GetName(), ' highlighter got beacon')
107 mouseOverDock = true 123 mouseOverDock = true
108 if not beacon.raised then 124 if not beacon.raised then
125 --print(beacon:GetName(), ' beacon not raised')
109 beacon.raised = true 126 beacon.raised = true
110 D.UpdateBeacon(beacon) 127 D.UpdateBeacon(beacon)
128
129 -- IsMouseOver can still return false during its frame's OnEnter
130 beacon.inc = 0
131 beacon:SetScript('OnUpdate', function(self)
132 if not self:IsMouseOver() then
133 self.inc = self.inc + 1
134 --print(self:GetName(),self.inc)
135 if self.inc > 10 then
136 --print(self:GetName(), 'lost mouseover, terminating OnUpdate')
137 self.raised = nil
138 D.UpdateBeacon(self)
139 self:SetScript('OnUpdate', nil)
140 end
141 end
142 end)
111 end 143 end
112 elseif beacon.raised and beacon.index ~= db.current_channel then 144 elseif beacon.raised and beacon.index ~= db.current_channel then
113 beacon.raised = nil 145 beacon.raised = nil
114 D.UpdateBeacon(beacon) 146 D.UpdateBeacon(beacon)
147 --beacon:SetScript('OnUpdate', nil)
115 end 148 end
116 149
117 if mouseOverDock then 150 if mouseOverDock then
118 -- Raise it up 151 -- Raise it up
119 if not self.raised then 152 if not self.raised then
120 self.raised = true 153
121 UIFrameFadeIn(self, getFadeInArgs('dock', self)) 154 self.raised = true
155 queueFade(self, getFadeInArgs('dock', self))
122 end 156 end
123 elseif self.raised then 157 elseif self.raised then
124 -- Drop it down 158 -- Drop it down
125 self.raised = nil 159 self.raised = nil
126 UIFrameFadeOut(self, getFadeOutArgs('dock', self)) 160 queueFade(self, getFadeOutArgs('dock', self))
161 for k, v in pairs(self.buttons) do
162 v.raised = nil
163 D.UpdateBeacon(v)
164 end
127 end 165 end
128 166
129 end 167 end