mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-29 02:36:02 +00:00
tooltip: add option to define cursor offsets
This commit is contained in:
@@ -480,6 +480,8 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("castbar", nil, "use_unitfonts", "0")
|
||||
|
||||
pfUI:UpdateConfig("tooltip", nil, "position", "chat")
|
||||
pfUI:UpdateConfig("tooltip", nil, "cursoralign", "native")
|
||||
pfUI:UpdateConfig("tooltip", nil, "cursoroffset", "20")
|
||||
pfUI:UpdateConfig("tooltip", nil, "extguild", "1")
|
||||
pfUI:UpdateConfig("tooltip", nil, "alpha", "0.8")
|
||||
pfUI:UpdateConfig("tooltip", "compare", "showalways", "0")
|
||||
|
||||
@@ -472,6 +472,13 @@ pfUI:RegisterModule("gui", function ()
|
||||
"cursor:" .. T["Cursor"]
|
||||
}
|
||||
|
||||
pfUI.gui.dropdowns.tooltip_align = {
|
||||
"native:" .. T["Native"],
|
||||
"top:" .. T["Top"],
|
||||
"left:" .. T["Left"],
|
||||
"right:" .. T["Right"]
|
||||
}
|
||||
|
||||
pfUI.gui.dropdowns.gmserver_text = {
|
||||
"elysium:" .. T["Elysium Based Core"],
|
||||
}
|
||||
@@ -1265,6 +1272,8 @@ pfUI:RegisterModule("gui", function ()
|
||||
pfUI.gui.tabs.tooltip.tabs.general:SetScript("OnShow", function()
|
||||
if not this.setup then
|
||||
CreateConfig(this, T["Tooltip Position"], C.tooltip, "position", "dropdown", pfUI.gui.dropdowns.tooltip_position)
|
||||
CreateConfig(this, T["Cursor Tooltip Align"], C.tooltip, "cursoralign", "dropdown", pfUI.gui.dropdowns.tooltip_align)
|
||||
CreateConfig(this, T["Cursor Tooltip Offset"], C.tooltip, "cursoroffset")
|
||||
CreateConfig(this, T["Enable Extended Guild Information"], C.tooltip, "extguild", "checkbox")
|
||||
CreateConfig(this, T["Custom Transparency"], C.tooltip, "alpha")
|
||||
CreateConfig(this, T["Always Show Item Comparison"], C.tooltip.compare, "showalways", "checkbox")
|
||||
|
||||
@@ -5,6 +5,30 @@ CreateBackdrop(GameTooltip, nil, nil, alpha)
|
||||
if C.tooltip.position == "cursor" then
|
||||
function _G.GameTooltip_SetDefaultAnchor(tooltip, parent)
|
||||
tooltip:SetOwner(parent, "ANCHOR_CURSOR")
|
||||
if C.tooltip.cursoralign ~= "native" then
|
||||
-- create mouse follow frame
|
||||
if not tooltip.cursor then
|
||||
tooltip.cursor = CreateFrame("Frame")
|
||||
tooltip.cursor:SetWidth(tonumber(C.tooltip.cursoroffset) * 2)
|
||||
tooltip.cursor:SetHeight(tonumber(C.tooltip.cursoroffset) * 2)
|
||||
tooltip.cursor:SetScript("OnUpdate", function()
|
||||
local x, y = GetCursorPosition()
|
||||
this:SetPoint("CENTER", UIParent, "BOTTOMLEFT", x, y)
|
||||
if C.tooltip.cursoralign == "top" then
|
||||
tooltip.cursor:SetWidth(tooltip:GetWidth())
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
-- adjust tooltip to mouse frame
|
||||
if C.tooltip.cursoralign == "top" then
|
||||
tooltip:SetPoint("BOTTOMLEFT", tooltip.cursor, "TOPLEFT", 0, 0)
|
||||
elseif C.tooltip.cursoralign == "left" then
|
||||
tooltip:SetPoint("BOTTOMRIGHT", tooltip.cursor, "TOPLEFT", 0, 0)
|
||||
elseif C.tooltip.cursoralign == "right" then
|
||||
tooltip:SetPoint("BOTTOMLEFT", tooltip.cursor, "TOPRIGHT", 0, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user