/
factionIconY = "-4", |
onCursor = false, |
anchor = "BOTTOMRIGHT", |
anchorTo = "BOTTOMRIGHT", |
offsetX = "-2", |
offsetY = "109", |
showTargetText = true, |
end |
end |
local function CreateMover() |
--mover = CreateFrame("Frame", nil, UIParent) |
mover = CreateFrame("Frame", "TipTopMover", UIParent) |
mover:SetSize(200, 100) |
mover:SetPoint(db.anchor, UIParent, db.anchor, db.offsetX, db.offsetY) |
local function SetUpMover() |
mover.t = mover:CreateTexture() |
mover.t:SetAllPoints() |
mover.t:SetTexture("Interface\\Buttons\\WHITE8x8") |
mover.t:SetVertexColor(0,0,1,.4) |
mover.t:SetColorTexture(0,0,1,.4) |
mover.l = mover:CreateLine() |
mover.l:SetThickness(1) |
mover.l:SetStartPoint("CENTER", mover) |
mover.l:SetEndPoint(db.anchor, mover) |
mover.l:SetColorTexture(1,1,1,1) |
mover:EnableMouse(true) |
mover:SetMovable(true) |
mover:SetClampedToScreen(true) |
button1 = "Save", |
button2 = "Cancel", |
OnAccept = function() |
db.anchor, _, _, x, y = mover:GetPoint() |
db.anchorTo, _, _, x, y = mover:GetPoint() |
db.offsetX, db.offsetY = tostring(x), tostring(y) |
mover:Hide() |
InterfaceOptionsFrame:Show() |
order = 10, |
}, |
anchor = { |
name = "Anchor To...", |
desc = "What side of the screen you would like the tooltip located at.", |
name = "Grow from...", |
desc = "What side/corner of the tooltip you would like it to expand from.", |
type = "select", |
disabled = function() return db.onCursor end, |
values = positions, |
end, |
set = function(_, anchor) |
db.anchor = positions[anchor] |
mover.l:SetEndPoint(db.anchor, mover) |
end, |
order = 11, |
}, |
anchorTo = { |
name = "Anchor To...", |
desc = "What side of the screen you would like the tooltip located at.", |
type = "select", |
disabled = function() return db.onCursor end, |
values = positions, |
get = function() |
for k, v in pairs(positions) do |
if db.anchorTo == v then |
return k |
end |
end |
end, |
set = function(_, anchorTo) |
db.anchorTo = positions[anchorTo] |
end, |
order = 12, |
}, |
empty1 = { |
name = " ", |
type = "description", |
order = 12, |
order = 13, |
}, |
offsetX = { |
name = "X Offset", |
end |
db.offsetX = offsetX |
end, |
order = 13, |
order = 14, |
}, |
offsetY = { |
name = "Y Offset", |
end |
db.offsetY = offsetY |
end, |
order = 14, |
order = 15, |
}, |
mover = { |
name = "Draggable Mover", |
desc = "Shows an anchor to move the tooltip's position.", |
desc = "Shows an anchor to move the tooltip's position. The line shows from which side/corner the tooltip will grow from.", |
type = "execute", |
disabled = function() return db.onCursor end, |
func = function() |
print("clicked button") |
InterfaceOptionsFrame:Hide() |
if not mover then |
print("creating mover") |
CreateMover() |
if not mover.t then |
SetUpMover() |
end |
mover:ClearAllPoints() |
mover:SetPoint(db.anchor, UIParent, db.anchor, db.offsetX, db.offsetY) |
mover:SetPoint(db.anchorTo, UIParent, db.anchorTo, db.offsetX, db.offsetY) |
mover:Show() |
StaticPopup_Show("TIPTOP_MOVER") |
end, |
order = 15, |
order = 16, |
}, |
}, |
}, |
local function OnInitialize() |
SetUpDB() |
--create mover to anchor the tooltip to |
mover = CreateFrame("Frame", "TipTopMover", UIParent) |
TipTop.mover = mover |
mover:SetSize(200, 100) |
mover:SetPoint(db.anchorTo, UIParent, db.anchorTo, db.offsetX, db.offsetY) |
LibStub("AceConfig-3.0"):RegisterOptionsTable("TipTop", options) |
TipTop.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("TipTop", "TipTop", nil, "general") |
TipTop.optionsFrame.baropts = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("TipTop", "Health Bar", "TipTop", "baropts") |
end |
--moves tooltip |
local mover = TipTop.mover |
hooksecurefunc("GameTooltip_SetDefaultAnchor", function (tooltip, parent) |
if db.onCursor then |
tooltip:SetOwner(parent, "ANCHOR_CURSOR") |
else |
tooltip:SetOwner(parent, "ANCHOR_NONE") |
tooltip:ClearAllPoints() |
tooltip:SetPoint(db.anchor, UIParent, db.anchor, db.offsetX, db.offsetY) |
tooltip:SetPoint(db.anchor, mover) |
end |
end) |
end |
ttSBar:HookScript("OnValueChanged", CalcHealth) |
ttSBar:HookScript("OnUpdate", TargetTextUpdate) |
local timer, hasUnit = 0, false |
tt:HookScript("OnUpdate", function(self, elapsed) --hack to fix when the background doesn't resize correctly (when the tooltip's or bg's OnShow isn't fired) |
if timer >= .5 and db.insideBar then |
if self:GetUnit() then |
if not hasUnit then --if I didn't have a unit before but do now |
BGPosition() |
hasUnit = true |
end |
else |
if hasUnit then --if I did have a unit and don't anymore |
TipTop:ClearAllPoints() |
TipTop:SetAllPoints(tt) |
TipTop:SetBackdropBorderColor(db.borderColor.r, db.borderColor.g, db.borderColor.b, db.borderColor.a) |
hasUnit = false |
end |
end |
timer = 0 |
end |
timer = timer + elapsed |
end) |
PlayerLogin = nil --let this function be garbage collected |
end |
## Interface: 70300 |
## Interface: 80000 |
## Title: TipTop |
## Author: Seerah |
## Notes: Tooltip enhancement |
## Version: 2.19.3 |
## Version: 2.20 |
## SavedVariables: TipTopDB |
## SavedVariablesPerCharacter: TipTopPCDB |
## OptionalDeps: Ace3, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets |