mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 22:51:53 -05:00
- added click-targeting to the TargetHealth module for raid icon ease (off by default)
This commit is contained in:
@ -35,6 +35,8 @@ function IceTargetHealth.prototype:GetDefaultSettings()
|
|||||||
settings["raidIconYOffset"] = 0
|
settings["raidIconYOffset"] = 0
|
||||||
settings["lockIconAlpha"] = false
|
settings["lockIconAlpha"] = false
|
||||||
settings["abbreviateHealth"] = true
|
settings["abbreviateHealth"] = true
|
||||||
|
settings["allowMouseInteraction"] = false
|
||||||
|
settings["allowMouseInteractionCombat"] = false
|
||||||
|
|
||||||
return settings
|
return settings
|
||||||
end
|
end
|
||||||
@ -82,6 +84,42 @@ function IceTargetHealth.prototype:GetOptions()
|
|||||||
order = 42
|
order = 42
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts["allowClickTarget"] = {
|
||||||
|
type = 'toggle',
|
||||||
|
name = 'Allow click-targeting',
|
||||||
|
desc = 'Whether or not to allow click targeting/casting and the target drop-down menu for this bar (Note: does not work properly with HiBar, have to click near the base of the bar)',
|
||||||
|
get = function()
|
||||||
|
return self.moduleSettings.allowMouseInteraction
|
||||||
|
end,
|
||||||
|
set = function(v)
|
||||||
|
self.moduleSettings.allowMouseInteraction = v
|
||||||
|
self:CreateBackground(true)
|
||||||
|
end,
|
||||||
|
disabled = function()
|
||||||
|
return not self.moduleSettings.enabled
|
||||||
|
end,
|
||||||
|
usage = '',
|
||||||
|
order = 43
|
||||||
|
}
|
||||||
|
|
||||||
|
opts["allowClickTargetCombat"] = {
|
||||||
|
type = 'toggle',
|
||||||
|
name = 'Allow click-targeting in combat',
|
||||||
|
desc = 'Whether or not to allow click targeting/casting and the target drop-down menu for this bar while the player is in combat (Note: does not work properly with HiBar, have to click near the base of the bar)',
|
||||||
|
get = function()
|
||||||
|
return self.moduleSettings.allowMouseInteractionCombat
|
||||||
|
end,
|
||||||
|
set = function(v)
|
||||||
|
self.moduleSettings.allowMouseInteractionCombat = v
|
||||||
|
self:CreateBackground(true)
|
||||||
|
end,
|
||||||
|
disabled = function()
|
||||||
|
return not self.moduleSettings.enabled or not self.moduleSettings.allowMouseInteraction
|
||||||
|
end,
|
||||||
|
usage = '',
|
||||||
|
order = 43.1
|
||||||
|
}
|
||||||
|
|
||||||
opts["scaleHealthColor"] = {
|
opts["scaleHealthColor"] = {
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = "Color bar by health %",
|
name = "Color bar by health %",
|
||||||
@ -96,7 +134,7 @@ function IceTargetHealth.prototype:GetOptions()
|
|||||||
disabled = function()
|
disabled = function()
|
||||||
return not self.moduleSettings.enabled
|
return not self.moduleSettings.enabled
|
||||||
end,
|
end,
|
||||||
order = 43
|
order = 44
|
||||||
}
|
}
|
||||||
|
|
||||||
opts["showRaidIcon"] = {
|
opts["showRaidIcon"] = {
|
||||||
@ -238,6 +276,77 @@ function IceTargetHealth.prototype:Disable(core)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function IceTargetHealth.prototype:CreateBackground(redraw)
|
||||||
|
IceTargetHealth.super.prototype.CreateBackground(self)
|
||||||
|
|
||||||
|
if not self.frame.button then
|
||||||
|
self.frame.button = CreateFrame("Button", "IceHUD_TargetClickFrame", self.frame, "SecureUnitButtonTemplate")
|
||||||
|
end
|
||||||
|
|
||||||
|
self.frame.button:ClearAllPoints()
|
||||||
|
-- Parnic - kinda hacky, but in order to fit this region to multiple types of bars, we need to do this...
|
||||||
|
-- would be nice to define this somewhere in data, but for now...here we are
|
||||||
|
if self.settings.barTexture == "HiBar" then
|
||||||
|
self.frame.button:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", 0, 0)
|
||||||
|
self.frame.button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMRIGHT", -1 * self.frame:GetWidth(), 0)
|
||||||
|
else
|
||||||
|
if self.moduleSettings.side == IceCore.Side.Left then
|
||||||
|
self.frame.button:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", -6, 0)
|
||||||
|
self.frame.button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMRIGHT", -1 * self.frame:GetWidth() / 3, 0)
|
||||||
|
else
|
||||||
|
self.frame.button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 6, 0)
|
||||||
|
self.frame.button:SetPoint("BOTTOMRIGHT", self.frame, "BOTTOMRIGHT", -1 * self.frame:GetWidth() / 1.5, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.frame.button.menu = function()
|
||||||
|
ToggleDropDownMenu(1, nil, TargetFrameDropDown, "cursor");
|
||||||
|
end
|
||||||
|
|
||||||
|
self:EnableClickTargeting(self.moduleSettings.allowMouseInteraction)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function IceTargetHealth.prototype:CheckCombat()
|
||||||
|
IceTargetHealth.super.prototype.CheckCombat(self)
|
||||||
|
|
||||||
|
if self.combat then
|
||||||
|
if self.moduleSettings.allowMouseInteraction and not self.moduleSettings.allowMouseInteractionCombat then
|
||||||
|
self:EnableClickTargeting(false)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if self.moduleSettings.allowMouseInteraction and not self.moduleSettings.allowMouseInteractionCombat then
|
||||||
|
self:EnableClickTargeting(true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function IceTargetHealth.prototype:EnableClickTargeting(bEnable)
|
||||||
|
if bEnable then
|
||||||
|
self.frame.button:EnableMouse(true)
|
||||||
|
self.frame.button:RegisterForClicks("AnyUp")
|
||||||
|
self.frame.button:SetAttribute("type1", "target")
|
||||||
|
self.frame.button:SetAttribute("type2", "menu")
|
||||||
|
self.frame.button:SetAttribute("unit", self.unit)
|
||||||
|
|
||||||
|
-- set up click casting
|
||||||
|
ClickCastFrames = ClickCastFrames or {}
|
||||||
|
ClickCastFrames[self.frame.button] = true
|
||||||
|
|
||||||
|
-- Parnic - debug code for showing the clickable region on this bar
|
||||||
|
-- self.frame.button:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
|
||||||
|
-- edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
|
||||||
|
-- tile = false,
|
||||||
|
-- insets = { left = 0, right = 0, top = 0, bottom = 0 }});
|
||||||
|
-- self.frame.button:SetBackdropColor(0,0,0,1);
|
||||||
|
else
|
||||||
|
self.frame.button:EnableMouse(false)
|
||||||
|
self.frame.button:RegisterForClicks()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
function IceTargetHealth.prototype:Update(unit)
|
function IceTargetHealth.prototype:Update(unit)
|
||||||
IceTargetHealth.super.prototype.Update(self)
|
IceTargetHealth.super.prototype.Update(self)
|
||||||
|
Reference in New Issue
Block a user