Skip to content

Commit

Permalink
- fixed sticky top/bottom overlay currently highlighting TipTac devel…
Browse files Browse the repository at this point in the history
…oper
  • Loading branch information
frozn committed May 20, 2024
1 parent 923dfe3 commit 19bc271
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 44 deletions.
24 changes: 22 additions & 2 deletions TipTac/modules/ttStyle.lua
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ function ttStyle:HighlightTipTacDeveloper(tip, currentDisplayParams, unitRecord,
if (tip.TopOverlay) then
local isTopOverlayShown = tip.TopOverlay:IsShown();

if (style) and (style.overlayTextureTop) then -- part from SharedTooltip_SetBackdropStyle() only for top overlay
if (style) and (style.overlayTextureTop) and (not isTopOverlayShown) then -- part from SharedTooltip_SetBackdropStyle() only for top overlay
-- tip.TopOverlay:SetAtlas(style.overlayAtlasTop, true); -- available in DF, but not available in WotLKC
tip.TopOverlay:SetTexture(style.overlayTextureTop);
tip.TopOverlay:SetSize(style.overlayTextureTopWidth, style.overlayTextureTopHeight);
Expand All @@ -308,13 +308,15 @@ function ttStyle:HighlightTipTacDeveloper(tip, currentDisplayParams, unitRecord,
tip.TopOverlay:SetScale(style.overlayAtlasTopScale or 1.0);
tip.TopOverlay:SetPoint("CENTER", tip, "TOP", style.overlayAtlasTopXOffset or 0, style.overlayAtlasTopYOffset or 0);
tip.TopOverlay:Show();

currentDisplayParams.isSetTopOverlayToHighlightTipTacDeveloper = true;
end
end

if (tip.BottomOverlay) then
local isBottomOverlayShown = tip.BottomOverlay:IsShown();

if (style) and (style.overlayTextureBottom) then -- part from SharedTooltip_SetBackdropStyle() only for bottom overlay
if (style) and (style.overlayTextureBottom) and (not isBottomOverlayShown) then -- part from SharedTooltip_SetBackdropStyle() only for bottom overlay
-- tip.BottomOverlay:SetAtlas(style.overlayAtlasBottom, true); -- available in DF, but not available in WotLKC
tip.BottomOverlay:SetTexture(style.overlayTextureBottom);
tip.BottomOverlay:SetSize(style.overlayTextureBottomWidth, style.overlayTextureBottomHeight);
Expand All @@ -323,6 +325,8 @@ function ttStyle:HighlightTipTacDeveloper(tip, currentDisplayParams, unitRecord,
tip.BottomOverlay:SetScale(style.overlayAtlasBottomScale or 1.0);
tip.BottomOverlay:SetPoint("CENTER", tip, "BOTTOM", style.overlayAtlasBottomXOffset or 0, style.overlayAtlasBottomYOffset or 0);
tip.BottomOverlay:Show();

currentDisplayParams.isSetBottomOverlayToHighlightTipTacDeveloper = true;
end
end
end
Expand Down Expand Up @@ -758,6 +762,8 @@ function ttStyle:OnTipSetCurrentDisplayParams(TT_CacheForFrames, tip, currentDis
currentDisplayParams.tipLineTargetedByIndex = nil;
currentDisplayParams.petLineLevelIndex = nil;
currentDisplayParams.mergeLevelLineWithGuildName = nil;
currentDisplayParams.isSetTopOverlayToHighlightTipTacDeveloper = nil;
currentDisplayParams.isSetBottomOverlayToHighlightTipTacDeveloper = nil;
end

function ttStyle:OnTipStyle(TT_CacheForFrames, tip, currentDisplayParams, first)
Expand Down Expand Up @@ -788,3 +794,17 @@ function ttStyle:OnTipResetCurrentDisplayParams(TT_CacheForFrames, tip, currentD
currentDisplayParams.petLineLevelIndex = nil;
currentDisplayParams.mergeLevelLineWithGuildName = nil;
end

function ttStyle:OnTipPostResetCurrentDisplayParams(TT_CacheForFrames, tip, currentDisplayParams)
-- hide tip's top/bottom overlay currently highlighting TipTac developer
if (currentDisplayParams.isSetTopOverlayToHighlightTipTacDeveloper) and (tip.TopOverlay) then
tip.TopOverlay:Hide();
end
if (currentDisplayParams.isSetBottomOverlayToHighlightTipTacDeveloper) and (tip.BottomOverlay) then
tip.BottomOverlay:Hide();
end

-- reset current display params for unit appearance
currentDisplayParams.isSetTopOverlayToHighlightTipTacDeveloper = nil;
currentDisplayParams.isSetBottomOverlayToHighlightTipTacDeveloper = nil;
end
87 changes: 45 additions & 42 deletions TipTac/ttCore.lua
Original file line number Diff line number Diff line change
Expand Up @@ -783,60 +783,63 @@ local TT_TipsToModifyFromOtherMods = {};
-- gradient optional. gradient texture for frame

-- params for 2nd key (currentDisplayParams):
-- isSet true if current display parameters are set, false otherwise.
-- isSetTemporarily true if current display parameters are temporarily set, false otherwise.
-- isSet true if current display parameters are set, false otherwise.
-- isSetTemporarily true if current display parameters are temporarily set, false otherwise.
--
-- isSetTimestamp timestamp of current display parameters were set, nil otherwise.
-- isSetTimestamp timestamp of current display parameters were set, nil otherwise.
--
-- tipContent see TT_TIP_CONTENT
-- hideTip true if tip will be hidden, false otherwise.
-- ignoreSetCurrentDisplayParamsOnTimestamp timestamp of ignoring tooltip's current display parameters to be set, nil otherwise.
-- tipContent see TT_TIP_CONTENT
-- hideTip true if tip will be hidden, false otherwise.
-- ignoreSetCurrentDisplayParamsOnTimestamp timestamp of ignoring tooltip's current display parameters to be set, nil otherwise.
--
-- lockedBackdropInfo locked backdropInfo, nil otherwise.
-- lockedBackdropColor locked backdrop color, nil otherwise.
-- lockedBackdropBorderColor locked backdrop border color, nil otherwise.
-- lockedBackdropInfo locked backdropInfo, nil otherwise.
-- lockedBackdropColor locked backdrop color, nil otherwise.
-- lockedBackdropBorderColor locked backdrop border color, nil otherwise.
--
-- extraPaddingRightForMinimumWidth value for extra padding right for minimum width, nil otherwise.
-- extraPaddingRightForCloseButton value for extra padding right to fit close button, nil otherwise.
-- extraPaddingBottomForBars value for extra padding bottom to fit health/power bars, nil otherwise.
-- extraPaddingRightForMinimumWidth value for extra padding right for minimum width, nil otherwise.
-- extraPaddingRightForCloseButton value for extra padding right to fit close button, nil otherwise.
-- extraPaddingBottomForBars value for extra padding bottom to fit health/power bars, nil otherwise.
--
-- defaultAnchored true if tip is default anchored, false otherwise.
-- defaultAnchoredParentFrame tip's parent frame if default anchored, nil otherwise.
-- anchorFrameName anchor frame name of tip, values "WorldUnit", "WorldTip", "FrameUnit", "FrameTip"
-- anchorType anchor type for tip
-- anchorPoint anchor point for tip
-- defaultAnchored true if tip is default anchored, false otherwise.
-- defaultAnchoredParentFrame tip's parent frame if default anchored, nil otherwise.
-- anchorFrameName anchor frame name of tip, values "WorldUnit", "WorldTip", "FrameUnit", "FrameTip"
-- anchorType anchor type for tip
-- anchorPoint anchor point for tip
--
-- unitRecord table with information about the displayed unit, nil otherwise.
-- .guid guid of unit
-- .id id of unit
-- .isPlayer true if it's a player unit, false for other units.
-- .name name of unit
-- .nameWithTitle name with title of unit
-- .rpName role play name of unit (Mary Sue Protocol)
-- .originalName original name of unit in GameTooltip
-- unitRecord table with information about the displayed unit, nil otherwise.
-- .guid guid of unit
-- .id id of unit
-- .isPlayer true if it's a player unit, false for other units.
-- .name name of unit
-- .nameWithTitle name with title of unit
-- .rpName role play name of unit (Mary Sue Protocol)
-- .originalName original name of unit in GameTooltip
--
-- .className localized class name of unit, e.g. "Warrior" or "Guerrier"
-- .classFile locale-independent class file of unit, e.g. "WARRIOR"
-- .classID class id of unit
-- .className localized class name of unit, e.g. "Warrior" or "Guerrier"
-- .classFile locale-independent class file of unit, e.g. "WARRIOR"
-- .classID class id of unit
--
-- .reactionIndex unit reaction index, see LFF_UNIT_REACTION_INDEX
-- .health unit health
-- .healthMax unit max health
-- .reactionIndex unit reaction index, see LFF_UNIT_REACTION_INDEX
-- .health unit health
-- .healthMax unit max health
--
-- .powerType unit power type
-- .power unit power
-- .powerMax unit max power
-- .powerType unit power type
-- .power unit power
-- .powerMax unit max power
--
-- .isColorBlind true if color blind mode is enabled, false otherwise.
-- .isTipTacDeveloper true if it's a unit of a TipTac developer, false for other units.
-- .isColorBlind true if color blind mode is enabled, false otherwise.
-- .isTipTacDeveloper true if it's a unit of a TipTac developer, false for other units.
--
-- firstCallDoneUnitAppearance true if first call of unit appearace is done, false otherwise.
-- timestampStartUnitAppearance timestamp of start of unit appearance, nil otherwise.
-- timestampStartCustomUnitFadeout timestamp of start of custom unit fadeout, nil otherwise.
-- firstCallDoneUnitAppearance true if first call of unit appearace is done, false otherwise.
-- timestampStartUnitAppearance timestamp of start of unit appearance, nil otherwise.
-- timestampStartCustomUnitFadeout timestamp of start of custom unit fadeout, nil otherwise.
--
-- tipLineInfoIndex line index of ttStyle's info for tip, nil otherwise.
-- tipLineTargetedByIndex line index of ttStyle's target by for tip, nil otherwise.
-- petLineLevelIndex line index of ttStyle's level for pet, nil otherwise.
-- tipLineInfoIndex line index of ttStyle's info for tip, nil otherwise.
-- tipLineTargetedByIndex line index of ttStyle's target by for tip, nil otherwise.
-- petLineLevelIndex line index of ttStyle's level for pet, nil otherwise.
-- mergeLevelLineWithGuildName true if there is no separate line for the guild name. in this case the guild name has to be merged with the level line if not in color blind mode. nil otherwise.
-- isSetTopOverlayToHighlightTipTacDeveloper true if the top overlay has been set to highlight TipTac developer, nil otherwise.
-- isSetBottomOverlayToHighlightTipTacDeveloper true if the bottom overlay has been set to highlight TipTac developer, nil otherwise.
--
-- hint: resolved frames from "TT_ExtendedConfig.tipsToModify" will be added here. frames from other mods added with TipTac:AddModifiedTip(tip, noHooks) will be added here, too.
local TT_CacheForFrames = {};
Expand Down

0 comments on commit 19bc271

Please sign in to comment.