Skip to content

Commit

Permalink
- considered new nineslice layout. default tooltip backdrop will be c…
Browse files Browse the repository at this point in the history
…hanged with configured backdrop. further styling (background/border texture and backdrop edge size) and 100% solid background is now possible again.

- fixed selecting of "None" for backdrop/border texture and saving this settings.
- fixed flickering or wrong placement for item comparison tooltips if "Anchors->Frame Tip Type" = "Mouse Anchor".
  • Loading branch information
frozn committed Dec 22, 2021
1 parent f4d12dc commit 0222248
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 48 deletions.
2 changes: 1 addition & 1 deletion TipTac/TipTac-BCC.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 20502
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTac
## Author: Aezay (Earthen Ring EU)
## Notes: Highly Customizable Tooltip Enhancement Addon
Expand Down
2 changes: 1 addition & 1 deletion TipTac/TipTac-Classic.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 11401
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTac
## Author: Aezay (Earthen Ring EU)
## Notes: Highly Customizable Tooltip Enhancement Addon
Expand Down
2 changes: 1 addition & 1 deletion TipTac/TipTac.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 90105
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTac
## Author: Aezay (Earthen Ring EU)
## Notes: Highly Customizable Tooltip Enhancement Addon
Expand Down
109 changes: 78 additions & 31 deletions TipTac/ttCore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,16 @@ function tt:ApplySettings()
end

-- Set Backdrop -- not setting "tileSize" as we dont tile
tipBackdrop.bgFile = cfg.tipBackdropBG;
tipBackdrop.edgeFile = cfg.tipBackdropEdge;
if (cfg.tipBackdropBG == "nil") then
tipBackdrop.bgFile = nil;
else
tipBackdrop.bgFile = cfg.tipBackdropBG;
end
if (cfg.tipBackdropEdge == "nil") then
tipBackdrop.edgeFile = nil;
else
tipBackdrop.edgeFile = cfg.tipBackdropEdge;
end
tipBackdrop.tile = false;
tipBackdrop.tileEdge = false;
tipBackdrop.edgeSize = cfg.backdropEdgeSize;
Expand Down Expand Up @@ -545,12 +553,45 @@ end

-- Applies the backdrop, color and border color. The GTT will often reset these internally.
function tt:ApplyTipBackdrop(tip)
SharedTooltip_SetBackdropStyle(tip,tipBackdrop);
-- remove default tip backdrop
if (tip.NineSlice) then
local nineSlicePieces = { -- keys have to match pieceNames in nineSliceSetup table
"TopLeftCorner",
"TopRightCorner",
"BottomLeftCorner",
"BottomRightCorner",
"TopEdge",
"BottomEdge",
"LeftEdge",
"RightEdge",
"Center"
};

for index, pieceName in ipairs(nineSlicePieces) do
local region = tip[pieceName];
region = tip.NineSlice[pieceName];
if region then
region:SetTexture(nil);
end
end
end

tip.backdropInfo = nil;
tip.layoutType = nil;
tip.layoutTextureKit = nil;

-- apply tip backdrop
--SharedTooltip_SetBackdropStyle(tip, tipBackdrop);
tip:SetBackdrop(tipBackdrop);

tip:SetBackdropColor(tipBackdrop.backdropColor:GetRGBA());
tip:SetBackdropBorderColor(tipBackdrop.backdropBorderColor:GetRGBA());
if (tip.ttBackdropBorderColor) then
tip.ttBackdropBorderColor = nil;
tip:SetBackdropBorderColor(tip.ttBackdropBorderColor:GetRGBA());
else
tip:SetBackdropBorderColor(tipBackdrop.backdropBorderColor:GetRGBA());
end

tip:SetPadding(tipBackdrop.insets.right, tipBackdrop.insets.bottom, tipBackdrop.insets.left, tipBackdrop.insets.top);
end

--------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -749,7 +790,7 @@ end
-- EventHook: OnShow
function gttScriptHooks:OnShow()
-- Anchor GTT to Mouse -- Az: Initial mouse anchoring is now being done in GTT_SetDefaultAnchor (remove if there are no issues)
-- gtt_anchorType, gtt_anchorPoint = GetAnchorPosition(self);
gtt_anchorType, gtt_anchorPoint = GetAnchorPosition(self);
-- if (gtt_anchorType == "mouse") then
-- local gttAnchor = self:GetAnchorType();
-- if (gttAnchor ~= "ANCHOR_CURSOR") and (gttAnchor ~= "ANCHOR_CURSOR_RIGHT") then
Expand All @@ -759,43 +800,45 @@ function gttScriptHooks:OnShow()

-- Ensures that default anchored world frame tips have the proper color, their internal function seems to set them to a dark blue color
-- Tooltips from world objects that change cursor seems to also require this. (Tested in 8.0/BfA)
if (self:IsOwned(UIParent)) and (not self:GetUnit()) then
self:SetBackdropColor(unpack(cfg.tipColor));
end
-- if (self:IsOwned(UIParent)) and (not self:GetUnit()) then
-- self:SetBackdropColor(unpack(cfg.tipColor));
-- end

-- backdropBorderColor from TipTacItemRef needs to be reapplied including the backdropColor from config
-- backdropBorderColor from TipTacItemRef needs to be reapplied
if (self.ttBackdropBorderColor) then
self:SetBackdropColor(unpack(cfg.tipColor));
self:SetBackdropBorderColor(self.ttBackdropBorderColor:GetRGBA());
end
end

-- EventHook: OnUpdate
function gttScriptHooks:OnUpdate(elapsed)
-- This ensures that mouse anchored world frame tips have the proper color, their internal function seems to set them to a dark blue color
local gttAnchor = self:GetAnchorType();
if (gttAnchor == "ANCHOR_CURSOR") or (gttAnchor == "ANCHOR_CURSOR_RIGHT") then
self:SetBackdropColor(unpack(cfg.tipColor));
self:SetBackdropBorderColor(unpack(cfg.tipBorderColor));
-- local gttAnchor = self:GetAnchorType();
-- if (gttAnchor == "ANCHOR_CURSOR") or (gttAnchor == "ANCHOR_CURSOR_RIGHT") then
-- self:SetBackdropColor(unpack(cfg.tipColor));
-- self:SetBackdropBorderColor(unpack(cfg.tipBorderColor));
-- backdropBorderColor from TipTacItemRef needs to be reapplied including the backdropColor from config
if (self.ttBackdropBorderColor) then
self:SetBackdropColor(unpack(cfg.tipColor));
self:SetBackdropBorderColor(self.ttBackdropBorderColor:GetRGBA());
-- if (self.ttBackdropBorderColor) then
-- self:SetBackdropColor(unpack(cfg.tipColor));
-- self:SetBackdropBorderColor(self.ttBackdropBorderColor:GetRGBA());
-- end
-- return;
-- else
-- Anchor GTT to Mouse (no anchoring e.g. for tooltips from AddModifiedTip() or compare items)
if (self == gtt and gtt_anchorType == "mouse") then
local gttAnchor = self:GetAnchorType();
if (gttAnchor ~= "ANCHOR_CURSOR") and (gttAnchor ~= "ANCHOR_CURSOR_RIGHT") then
tt:AnchorFrameToMouse(self);
end
return;
-- Anchor GTT to Mouse
elseif (gtt_anchorType == "mouse") then
tt:AnchorFrameToMouse(self);
end

-- WoD: This background color reset, from OnShow(), has been copied down here. It seems resetting the color in OnShow() wasn't enough, as the color changes after the tip is being shown
if (self:IsOwned(UIParent)) and (not self:GetUnit()) then
self:SetBackdropColor(unpack(cfg.tipColor));
end
-- if (self:IsOwned(UIParent)) and (not self:GetUnit()) then
-- self:SetBackdropColor(unpack(cfg.tipColor));
-- end

-- backdropBorderColor from TipTacItemRef needs to be reapplied including the backdropColor from config
-- backdropBorderColor from TipTacItemRef needs to be reapplied
if (self.ttBackdropBorderColor) then
self:SetBackdropColor(unpack(cfg.tipColor));
self:SetBackdropBorderColor(self.ttBackdropBorderColor:GetRGBA());
end

Expand Down Expand Up @@ -873,6 +916,9 @@ end
function gttScriptHooks:OnTooltipCleared()
-- WoD: resetting the back/border color seems to be a necessary action, otherwise colors may stick when showing the next tooltip thing (world object tips)
-- BfA: The tooltip now also clears the backdrop in adition to color and bordercolor, so set it again here
if (self.ttBackdropBorderColor) then
self.ttBackdropBorderColor = nil;
end
tt:ApplyTipBackdrop(self);

-- remove the padding that might have been set to fit health/power bars
Expand Down Expand Up @@ -927,8 +973,8 @@ local function ResolveGlobalNamedObjects(tipTable)
if (resolved[tip]) then
tip = false;
elseif (tip) then
if (type(tip.SetBackdrop) ~= "function" and TooltipBackdropTemplateMixin and "TooltipBackdropTemplate") then
Mixin(tip, TooltipBackdropTemplateMixin);
if (type(tip) == "table" and type(tip.SetBackdrop) ~= "function" and BackdropTemplateMixin and "BackdropTemplate") then
Mixin(tip, BackdropTemplateMixin);
end
resolved[tip] = index;
end
Expand Down Expand Up @@ -1032,8 +1078,8 @@ function tt:AddModifiedTip(tip,noHooks)
if (tIndexOf(TT_TipsToModify,tip)) then
return;
end
if (type(tip.SetBackdrop) ~= "function" and TooltipBackdropTemplateMixin and "TooltipBackdropTemplate") then
Mixin(tip, TooltipBackdropTemplateMixin);
if (type(tip) == "table" and type(tip.SetBackdrop) ~= "function" and BackdropTemplateMixin and "BackdropTemplate") then
Mixin(tip, BackdropTemplateMixin);
end
TT_TipsToModify[#TT_TipsToModify + 1] = tip;

Expand All @@ -1045,6 +1091,7 @@ function tt:AddModifiedTip(tip,noHooks)
if (not noHooks) then
tip:HookScript("OnShow", function()
tip.ttBackdropBorderColor = CreateColor(unpack(cfg.tipBorderColor));
tt:ApplyTipBackdrop(tip);
gttScriptHooks.OnShow(tip);
end);
tip:HookScript("OnUpdate", gttScriptHooks.OnUpdate);
Expand Down
2 changes: 1 addition & 1 deletion TipTacItemRef/TipTacItemRef-BCC.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 20502
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTacItemRef
## Author: Aezay (Earthen Ring EU)
## Notes: Improved ItemRefTooltip
Expand Down
2 changes: 1 addition & 1 deletion TipTacItemRef/TipTacItemRef-Classic.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 11401
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTacItemRef
## Author: Aezay (Earthen Ring EU)
## Notes: Improved ItemRefTooltip
Expand Down
2 changes: 1 addition & 1 deletion TipTacItemRef/TipTacItemRef.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 90105
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTacItemRef
## Author: Aezay (Earthen Ring EU)
## Notes: Improved ItemRefTooltip
Expand Down
7 changes: 5 additions & 2 deletions TipTacItemRef/ttItemRef.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ local function ResolveGlobalNamedObjects(tipTable)
if (resolved[tip]) then
tip = false;
elseif (tip) then
if (type(tip.SetBackdrop) ~= "function" and TooltipBackdropTemplateMixin and "TooltipBackdropTemplate") then
Mixin(tip, TooltipBackdropTemplateMixin);
if (type(tip) == "table" and type(tip.SetBackdrop) ~= "function" and BackdropTemplateMixin and "BackdropTemplate") then
Mixin(tip, BackdropTemplateMixin);
end
resolved[tip] = index;
end
Expand Down Expand Up @@ -197,6 +197,9 @@ end
-- OnTooltipSetItem
local function OnTooltipSetItem(self,...)
if (cfg.if_enable) and (not tipDataAdded[self]) then
if (TipTac) then
TipTac:ApplyTipBackdrop(self);
end
local _, link = self:GetItem();
if (link) then
local linkType, id = link:match("H?(%a+):(%d+)");
Expand Down
14 changes: 11 additions & 3 deletions TipTacOptions/Libs/AzOptionsFactory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -498,15 +498,23 @@ local function SharedMediaLib_Init(dropDown,list)
for _, name in next, LSM:List(query) do
local tbl = list[#list + 1];
tbl.text = name;
tbl.value = LSM:Fetch(query,name);
local preparedValue = LSM:Fetch(query,name);
if ((query == "background" or query == "border") and preparedValue == nil) then
preparedValue = "nil";
end
tbl.value = preparedValue;
tbl.tip = tbl.value;
end
else
for name, value in next, azof.LibSharedMediaSubstitute[query] do
local tbl = list[#list + 1];
tbl.text = name;
tbl.value = value;
tbl.tip = value;
local preparedValue = value;
if ((query == "background" or query == "border") and preparedValue == nil) then
preparedValue = "nil";
end
tbl.value = preparedValue;
tbl.tip = tbl.value;
end
end
table.sort(list,function(a,b) return a.text < b.text end);
Expand Down
2 changes: 1 addition & 1 deletion TipTacOptions/TipTacOptions-BCC.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 20502
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTacOptions
## Author: Aezay (Earthen Ring EU)
## Notes: Option Dialog for TipTac
Expand Down
2 changes: 1 addition & 1 deletion TipTacOptions/TipTacOptions-Classic.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 11401
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTacOptions
## Author: Aezay (Earthen Ring EU)
## Notes: Option Dialog for TipTac
Expand Down
2 changes: 1 addition & 1 deletion TipTacOptions/TipTacOptions.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 90105
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTacOptions
## Author: Aezay (Earthen Ring EU)
## Notes: Option Dialog for TipTac
Expand Down
2 changes: 1 addition & 1 deletion TipTacTalents/TipTacTalents-BCC.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 20502
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTacTalents
## Author: Aezay (Earthen Ring EU)
## Notes: Adds Talent Spec to Player Tooltips
Expand Down
2 changes: 1 addition & 1 deletion TipTacTalents/TipTacTalents-Classic.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 11401
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTacTalents
## Author: Aezay (Earthen Ring EU)
## Notes: Adds Talent Spec to Player Tooltips
Expand Down
2 changes: 1 addition & 1 deletion TipTacTalents/TipTacTalents.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 90105
## Version: 21.12.20
## Version: 21.12.22
## Title: TipTacTalents
## Author: Aezay (Earthen Ring EU)
## Notes: Adds Talent Spec to Player Tooltips
Expand Down

0 comments on commit 0222248

Please sign in to comment.