Thread Tools Display Modes
07-25-18, 11:03 AM   #1
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Tooltip is constantly reseting the backdrop

I am trying to style the GameTooltip and am providing my own backdrop. On top I set my own backdrop color and backdrop border color. For items I am recoloring the border by item rarity.

When I am hovering over any item (like in the character window) that backdrop will be visible for a split second but then the backdrop changes to the default one including all color settings.

Has anyone worked with tooltips lately and has a tip on how to handle that?

Btw sometimes I am getting blueish tinted tooltip backgrounds. It mostly happens when hovering over objects like a portal. When you hover over a unit thereafter the blueish tint stays since I am only reseting the backdrop OnShow.

Any hints would be appreciated.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
07-25-18, 11:08 AM   #2
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
This is one of the main features of TipTac. You could look to see how Aezay is handling this (which had to be changed for BfA).
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
07-25-18, 11:37 AM   #3
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Originally Posted by zork View Post
Btw sometimes I am getting blueish tinted tooltip backgrounds. It mostly happens when hovering over objects like a portal. When you hover over a unit thereafter the blueish tint stays since I am only reseting the backdrop OnShow.
That's a Blizzard bug, that happens if you don't let the tooltip fadeout completely before hovering over something else.

You can probably do something like this to prevent it from happening:

lua Code:
  1. GameTooltip:HookScript("OnTooltipSetUnit", function() GameTooltip:SetBackdropColor(TOOLTIP_DEFAULT_BACKGROUND_COLOR.r, TOOLTIP_DEFAULT_BACKGROUND_COLOR.g, TOOLTIP_DEFAULT_BACKGROUND_COLOR.b, 1) end)

(Or with your own background colors, of course.)

Last edited by Ammako : 07-25-18 at 11:44 AM.
  Reply With Quote
07-25-18, 12:09 PM   #4
Lolzen
An Aku'mai Servant
 
Lolzen's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 36
Had the same problem, i've just overwritten GAME_TOOLTIP_BACKDROP_STYLE_DEFAULT
  Reply With Quote
07-25-18, 12:13 PM   #5
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Do you think overriding a default constant is a good idea? That can lead to a myriad of taints since the tooltip is used god knows where.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
07-25-18, 12:38 PM   #6
Lolzen
An Aku'mai Servant
 
Lolzen's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 36
Originally Posted by zork View Post
Do you think overriding a default constant is a good idea? That can lead to a myriad of taints since the tooltip is used god knows where.
No, but hey, at least it doesn't "reset".

You could probably hook into GameTooltip_SetBackdropStyle() see here

Last edited by Lolzen : 07-25-18 at 01:39 PM.
  Reply With Quote
07-25-18, 04:01 PM   #7
VincentSDSH
Non-Canadian Luzer!
 
VincentSDSH's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 350
Originally Posted by zork View Post
Do you think overriding a default constant is a good idea? That can lead to a myriad of taints since the tooltip is used god knows where.
Altering the GAME_TOOLTIP_BACKDROP_STYLE_DEFAULT doesn't cause any issues. You can update the functions or alter the data and it doesn't mind. Keep in mind that there's another default (GAME_TOOLTIP_BACKDROP_STYLE_AZERITE_ITEM) that gets conditionally applied if it's azerite gear.

This is what Tiptac wound up doing (see this ticket) and we've been testing it pretty heavily w/o any tainting issues.
__________________
AddonsExecutive Assistant User Configurable To-Do ListLegible Mail Choose the Font for Your Mail
  Reply With Quote
07-25-18, 04:03 PM   #8
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Thanks all.

I was able to fix my issues. Here is the commit:

https://github.com/zorker/rothui/com...a1e35a75e8fc38

I opted for not using the OnUpdate. Not using it shows sometimes a blue tinted tooltip on portals/mailbox etc which I am totally fine with. Everything else is fixed now.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
07-26-18, 11:59 PM   #9
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Where did the post from nevereg go? I thought about it a bit more and I think going for the GameTooltip_SetBackdropStyle hook might be a the best approach.

We can get rid of so many other hooks and we have access to the backdrop attributes from blizzard.

You could just match style against GAME_TOOLTIP_BACKDROP_STYLE_AZERITE_ITEM and know that the style you are handling is for azerite.

alternative A
Lua Code:
  1. local azerite = style == GAME_TOOLTIP_BACKDROP_STYLE_AZERITE_ITEM or false

alternative B
Lua Code:
  1. local _, itemLink = self:GetItem()
  2. local azerite = false
  3. if itemLink and (C_AzeriteEmpoweredItem.IsAzeriteEmpoweredItemByID(itemLink) or C_AzeriteItem.IsAzeriteItemByID(itemLink)) then
  4.   azerite = true
  5. end

I am going to change my tooltip to that method. It seems convenient for what I am trying to do.

*edit* Commit hooking into SetBackdropStyle https://github.com/zorker/rothui/com...ceda45d583d2fa
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 07-27-18 at 12:49 AM.
  Reply With Quote
07-27-18, 02:31 AM   #10
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Originally Posted by zork View Post

*edit* Commit hooking into SetBackdropStyle https://github.com/zorker/rothui/com...ceda45d583d2fa
Isn't line 172 missing a ) at the end?
  Reply With Quote
07-27-18, 03:02 AM   #11
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Totally possible. It is a dry code atm.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Tooltip is constantly reseting the backdrop

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off