Further optimizations to the range check.
This commit is contained in:
+2
-1
@@ -25,6 +25,7 @@ function ActionBar:ApplyConfig(config)
|
|||||||
|
|
||||||
if not self.config.position.x then initialPosition(self) end
|
if not self.config.position.x then initialPosition(self) end
|
||||||
|
|
||||||
|
Bartender4.Button:UpdateRangeValues()
|
||||||
self:UpdateButtons()
|
self:UpdateButtons()
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -49,7 +50,7 @@ function ActionBar:UpdateButtons(numbuttons)
|
|||||||
buttons[i]:SetParent(self)
|
buttons[i]:SetParent(self)
|
||||||
buttons[i]:Show()
|
buttons[i]:Show()
|
||||||
buttons[i]:SetAttribute("statehidden", nil)
|
buttons[i]:SetAttribute("statehidden", nil)
|
||||||
buttons[i]:UpdateAction(true)
|
buttons[i]:Update()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hide inactive buttons
|
-- hide inactive buttons
|
||||||
|
|||||||
+34
-19
@@ -29,6 +29,8 @@ local Bartender4 = Bartender4
|
|||||||
local LBF = LibStub("LibButtonFacade", true)
|
local LBF = LibStub("LibButtonFacade", true)
|
||||||
local KeyBound = LibStub("LibKeyBound-1.0")
|
local KeyBound = LibStub("LibKeyBound-1.0")
|
||||||
|
|
||||||
|
local oorsetting, oorcolor, oomcolor
|
||||||
|
|
||||||
Bartender4.Button = {}
|
Bartender4.Button = {}
|
||||||
Bartender4.Button.prototype = Button
|
Bartender4.Button.prototype = Button
|
||||||
Button.BT4init = true
|
Button.BT4init = true
|
||||||
@@ -191,6 +193,11 @@ function Bartender4.Button:Create(id, parent)
|
|||||||
return button
|
return button
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Bartender4.Button:UpdateRangeValues()
|
||||||
|
oorsetting = Bartender4.db.profile.outofrange
|
||||||
|
oorcolor, oomcolor = Bartender4.db.profile.colors.range, Bartender4.db.profile.colors.mana
|
||||||
|
end
|
||||||
|
|
||||||
function onDragUpdate(self)
|
function onDragUpdate(self)
|
||||||
ActionButton_UpdateState(self)
|
ActionButton_UpdateState(self)
|
||||||
ActionButton_UpdateFlash(self)
|
ActionButton_UpdateFlash(self)
|
||||||
@@ -226,15 +233,25 @@ function onUpdate(self, elapsed)
|
|||||||
self.rangeTimer = self.rangeTimer - elapsed
|
self.rangeTimer = self.rangeTimer - elapsed
|
||||||
if self.rangeTimer <= 0 then
|
if self.rangeTimer <= 0 then
|
||||||
local valid = IsActionInRange(self.action)
|
local valid = IsActionInRange(self.action)
|
||||||
local hotkey = self.hotkey
|
|
||||||
local hkshown = (hotkey:GetText() == RANGE_INDICATOR and Bartender4.db.profile.outofrange == "hotkey")
|
|
||||||
if valid and hkshown then
|
|
||||||
hotkey:Show()
|
|
||||||
elseif hkshown then
|
|
||||||
hotkey:Hide()
|
|
||||||
end
|
|
||||||
self.outOfRange = (valid == 0)
|
self.outOfRange = (valid == 0)
|
||||||
self:UpdateUsable()
|
|
||||||
|
if oorsetting == "hotkey" then
|
||||||
|
local hotkey = self.hotkey
|
||||||
|
local hkshown = hotkey:GetText() == RANGE_INDICATOR
|
||||||
|
if valid and hkshown then
|
||||||
|
hotkey:Show()
|
||||||
|
elseif hkshown then
|
||||||
|
hotkey:Hide()
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.outOfRange then
|
||||||
|
hotkey:SetVertexColor(oorcolor.r, oorcolor.g, oorcolor.b)
|
||||||
|
else
|
||||||
|
hotkey:SetVertexColor(1.0, 1.0, 1.0)
|
||||||
|
end
|
||||||
|
elseif oorsetting == "button" then
|
||||||
|
self:UpdateUsable()
|
||||||
|
end
|
||||||
self.rangeTimer = TOOLTIP_UPDATE_TIME
|
self.rangeTimer = TOOLTIP_UPDATE_TIME
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -328,6 +345,7 @@ function Button:Update()
|
|||||||
self:UpdateAction(true)
|
self:UpdateAction(true)
|
||||||
self:UpdateHotkeys()
|
self:UpdateHotkeys()
|
||||||
self:ToggleButtonElements()
|
self:ToggleButtonElements()
|
||||||
|
self:UpdateRange()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Button:UpdateAction(force)
|
function Button:UpdateAction(force)
|
||||||
@@ -434,20 +452,11 @@ end)
|
|||||||
|
|
||||||
function Button:UpdateUsable()
|
function Button:UpdateUsable()
|
||||||
local isUsable, notEnoughMana = IsUsableAction(self.action)
|
local isUsable, notEnoughMana = IsUsableAction(self.action)
|
||||||
local icon, hotkey = self.icon, self.hotkey
|
local icon = self.icon
|
||||||
local oor = Bartender4.db.profile.outofrange
|
|
||||||
local oorcolor, oomcolor = Bartender4.db.profile.colors.range, Bartender4.db.profile.colors.mana
|
|
||||||
|
|
||||||
if oor == "button" and self.outOfRange then
|
if oorsetting == "button" and self.outOfRange then
|
||||||
icon:SetVertexColor(oorcolor.r, oorcolor.g, oorcolor.b)
|
icon:SetVertexColor(oorcolor.r, oorcolor.g, oorcolor.b)
|
||||||
hotkey:SetVertexColor(1.0, 1.0, 1.0)
|
|
||||||
else
|
else
|
||||||
if oor == "hotkey" and self.outOfRange then
|
|
||||||
hotkey:SetVertexColor(oorcolor.r, oorcolor.g, oorcolor.b)
|
|
||||||
else
|
|
||||||
hotkey:SetVertexColor(1.0, 1.0, 1.0)
|
|
||||||
end
|
|
||||||
|
|
||||||
if isUsable or specialButtons[self.action] then
|
if isUsable or specialButtons[self.action] then
|
||||||
icon:SetVertexColor(1.0, 1.0, 1.0)
|
icon:SetVertexColor(1.0, 1.0, 1.0)
|
||||||
elseif notEnoughMana then
|
elseif notEnoughMana then
|
||||||
@@ -458,6 +467,12 @@ function Button:UpdateUsable()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Button:UpdateRange()
|
||||||
|
self.hotkey:SetVertexColor(1.0, 1.0, 1.0)
|
||||||
|
self:UpdateUsable()
|
||||||
|
onUpdate(self, 10)
|
||||||
|
end
|
||||||
|
|
||||||
function Button:SetTooltip()
|
function Button:SetTooltip()
|
||||||
if ( GetCVar("UberTooltips") == "1" ) then
|
if ( GetCVar("UberTooltips") == "1" ) then
|
||||||
GameTooltip_SetDefaultAnchor(GameTooltip, self)
|
GameTooltip_SetDefaultAnchor(GameTooltip, self)
|
||||||
|
|||||||
Reference in New Issue
Block a user