Tooltips conflicting with MyRolePlay
Katoriehooves opened this issue ยท 3 comments
When running this add-on alongside the MyRolePlay addon, tooltip lines do not word wrap properly in the MRP text (especially the Currently and OOC fields). Also, when holding modifier keys (which displays Raider.IO info) the tooltip does not change back to MRP upon release of the key. Disabling Raider.io corrects the issue.
Thanks for the report. I will download MyRolePlay and test it out and see how it behaves when combined with RIO. Looking at the code I didn't see anything that would break, so I am curious if it might also be something else interfering. I will test and see how it goes on my end.
Thanks for the reply. In case you've never used the addon before, you'd need to go into the MRP editor (in the character panel) and add text long enough to the "currently" and "ooc" fields for it to need to wrap the text in the tooltip. (Hope this helps maybe). Also this happens with no other addons except these two loaded.
Ok I think I got the hang of it. I added some text in both fields and tested to see how the addon works on its own:
I tested by enabling RIO then hacking a bit to make my level 1 use my main profile on RIO, but my level 1 profile from MyRolePlay so both addons would try to show data on the same tooltip.
I can confirm that yes RIO will SetUnit and discard any changes MyRolePlay has made to the tooltip:
Quickly looking over code I can see one improvement that might be a benefit for MyRolePlay in terms of compatibility with other addons that might fight over updating the tooltip. RIO uses the GameTooltip:SetUnit()
method to re-apply the unit and trigger the OnTooltipSetUnit
handler on the GameTooltip widget to handle the updating process.
I attempted to make a draft solution, at least potential solution, I am not sure exactly how the entire addon hangs together, I only looked at the UI_Tooltip.lua
file and worked on that one to see if I could resolve the compatibility issue. I assume it might conflict with other tooltip addons that rely on the method handler to know when to alter the tooltip, so it's worth to look into I believe.
This is what I changed in the file in this test:
L76
--tooltipFrame:SetScript( "OnEvent", mrp_MouseoverEvent ) -- the old handler to update the tooltip
L826
tooltip.mrpNumLines = nil; -- CommonTooltip_ResetToUnit(tooltip, unit); -- not sure what mrpNumLines is used for but I added this here since it was the only part in the ResetToUnit that is probably required for this process
Added on the bottom:
GameTooltip:HookScript("OnTooltipSetUnit", function(self)
if not mrpSaved.Options.Enabled then
return
end
local _, unit = self:GetUnit()
if not unit then
return
end
if UnitIsUnit( "player", unit ) then
mrp:UpdateTooltip( UnitName("player"), "player" )
elseif UnitIsPlayer(unit) then
msp:Request( mrp:UnitNameWithRealm(unit), {'TT', 'PE'} )
mrp:UpdateTooltip( mrp:UnitNameWithRealm(unit), unit )
else
mrp.TTShown = nil
end
end)
This just replaced the original "when to update" behavior to use the handler instead. The good news is that it did not crash or break, at least to my knowledge. Good news it that it seems to have resolved the compatibility issue:
The bad news is that I don't know how this affects the addon, maybe the anchoring logic or something, since I don't account for calling any anchoring functions and such, but both parts of the tooltip get put on there so that's a nice improvement. I can recommend to show this to Meorawr I know he lurks on Discord in the wowuidev server so I can assist on there more directly.