nameplates: add option for legacy click handlers

This commit is contained in:
shagu
2018-07-16 14:45:15 +02:00
parent 861c505038
commit 9f000a00c3
3 changed files with 22 additions and 6 deletions
+1
View File
@@ -681,6 +681,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("chat", "bubbles", "alpha", ".75")
pfUI:UpdateConfig("nameplates", nil, "use_unitfonts", "0")
pfUI:UpdateConfig("nameplates", nil, "legacy", "0")
pfUI:UpdateConfig("nameplates", nil, "overlap", "0")
pfUI:UpdateConfig("nameplates", nil, "showcastbar", "1")
pfUI:UpdateConfig("nameplates", nil, "spellname", "0")
+1
View File
@@ -1196,6 +1196,7 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(nil, this, T["Enable Spellname"], C.nameplates, "spellname", "checkbox")
CreateConfig(nil, this, T["Enable Debuffs"], C.nameplates, "showdebuffs", "checkbox")
CreateConfig(nil, this, T["Enable Clickthrough"], C.nameplates, "clickthrough", "checkbox")
CreateConfig(nil, this, T["Legacy Click Handlers (Breaks Vertical Position and Overlap)"], C.nameplates, "legacy", "checkbox")
CreateConfig(nil, this, T["Enable Overlap"], C.nameplates, "overlap", "checkbox")
CreateConfig(nil, this, T["Enable Mouselook With Right Click"], C.nameplates, "rightclick", "checkbox")
CreateConfig(nil, this, T["Right Click Auto Attack Threshold"], C.nameplates, "clickthreshold")
+20 -6
View File
@@ -82,6 +82,7 @@ pfUI:RegisterModule("nameplates", function ()
this.nameplate = CreateFrame("Button", nil, this)
this.nameplate.parent = this
this.healthbar = this:GetChildren()
this.healthbar:SetScript("OnEnter", function() return nil end)
this.border, this.glow, this.name, this.level, this.levelicon , this.raidicon = this:GetRegions()
this.healthbar:SetParent(this.nameplate)
this.border:SetParent(this.nameplate)
@@ -93,11 +94,13 @@ pfUI:RegisterModule("nameplates", function ()
end
-- init
this:SetFrameLevel(0)
this:EnableMouse(false)
if C.nameplates["legacy"] == "0" then
this:SetFrameLevel(0)
this:EnableMouse(false)
end
-- enable plate overlap
if C.nameplates.overlap == "1" then
if C.nameplates.overlap == "1" and C.nameplates["legacy"] == "0" then
this:SetWidth(1)
this:SetHeight(1)
else
@@ -109,13 +112,23 @@ pfUI:RegisterModule("nameplates", function ()
this.nameplate:SetScale(UIParent:GetScale())
this.nameplate:SetWidth(plate_width)
this.nameplate:SetHeight(plate_height)
this.nameplate:SetPoint("TOP", this, "TOP", 0, -tonumber(C.nameplates.vpos))
if C.nameplates["legacy"] == "0" then
this.nameplate:SetPoint("TOP", this, "TOP", 0, -tonumber(C.nameplates.vpos))
else
this.nameplate:SetPoint("TOP", this, "TOP", 0, 0)
end
-- add click handlers
if C.nameplates["clickthrough"] == "0" then
this.nameplate:SetScript("OnClick", function() this.parent:Click() end)
if C.nameplates["legacy"] == "0" then
this.nameplate:SetScript("OnClick", function() this.parent:Click() end)
else
this.nameplate:EnableMouse(false)
end
if C.nameplates["rightclick"] == "1" then
this.nameplate:SetScript("OnMouseDown", function()
local plate = C.nameplates["legacy"] == "0" and this.nameplate or this
plate:SetScript("OnMouseDown", function()
if arg1 and arg1 == "RightButton" then
MouselookStart()
@@ -127,6 +140,7 @@ pfUI:RegisterModule("nameplates", function ()
end)
end
else
this:EnableMouse(false)
this.nameplate:EnableMouse(false)
end