Skip to content

Commit

Permalink
v1.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaminariss committed Oct 1, 2019
1 parent 05864f8 commit 774accc
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions widgets/Tooltip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if not StdUi then
return;
end

local module, version = 'Tooltip', 1;
local module, version = 'Tooltip', 2;
if not StdUi:UpgradeNeeded(module, version) then return end;

StdUi.tooltips = {}
Expand Down Expand Up @@ -47,6 +47,7 @@ function StdUi:Tooltip(owner, text, tooltipName, anchor, automatic)
tip:ClearAllPoints();
this:GlueOpposite(tip, tip.owner, 0, 0, tip.anchor);
end);

owner:HookScript('OnLeave', function ()
tip:Hide();
end);
Expand All @@ -55,15 +56,14 @@ function StdUi:Tooltip(owner, text, tooltipName, anchor, automatic)
return tip;
end

function StdUi:FrameTooltip(owner, text, tooltipName, anchor, automatic)
--- @type GameTooltip
function StdUi:FrameTooltip(owner, text, tooltipName, anchor, automatic, manualPosition)
local tip;
local this = self;

if tooltipName and self.frameTooltips[tooltipName] then
tip = self.frameTooltips[tooltipName];
else
tip = self:Panel(UIParent, 10, 10);
tip = self:Panel(owner, 10, 10);
tip:SetFrameStrata('TOOLTIP');
self:ApplyBackdrop(tip, 'panel');

Expand Down Expand Up @@ -102,11 +102,13 @@ function StdUi:FrameTooltip(owner, text, tooltipName, anchor, automatic)
tip:SetSize(tip.text:GetWidth() + padding * 2, tip.text:GetHeight() + padding * 2);
end

hooksecurefunc(tip, 'Show', function(self)
self:RecalculateSize();
self:ClearAllPoints();
this:GlueOpposite(self, self.owner, 0, 0, self.anchor);
end);
if manualPosition then
hooksecurefunc(tip, 'Show', function(self)
self:RecalculateSize();
self:ClearAllPoints();
this:GlueOpposite(self, self.owner, 0, 0, self.anchor);
end);
end
end

tip.owner = owner;
Expand Down

0 comments on commit 774accc

Please sign in to comment.