Thread Tools Display Modes
Prev Previous Post   Next Post Next
06-09-18, 02:02 AM   #1
Theroxis
A Fallenroot Satyr
Join Date: Jun 2018
Posts: 24
Strange GameTooltip behavior with SetPoint

So basically, I'm trying to learn lua and AddOn development by adding the features and UI elements I like from big already done stuff, but by only manipulating stock blizzard frames. It's been a neat way to learn how both the stock Blizzard UI and AddOns in general work.
I really like having a tooltip underneath the mouse cursor when I'm hovering over players, and other things in the world. It helps bring attention to what my pointy thing is pointing at. So I wrote this:
Code:
GameTooltip:HookScript("OnUpdate", function(self, elpased)
		local x, y = GetCursorPosition()
		local effScale = self:GetEffectiveScale()
		self:ClearAllPoints()
		self:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", (x / effScale + 25), (y / effScale + -25))
end)
While this does work, and moves the ToolTip frame 25 pixels to the right and 25 pixels below the cursor - I notice that as I rapidly mouse over things, the tooltip appears to draw in the bottom right of the screen at it's default position, then scale to the TOPLEFT position, followed by finally settling on the correct size and position. This results in a twitchy flashing tooltip as I move around. This only happens when the tooltip changes, that is to say if I hover over something and then move while hovered over the same thing it behaves normally, but if I changed the mousefocus to something else, the behavior becomes erratic.

What causes this, and how can I stop it?
I've tried also hooking OnShow and doing the same math there, but that doesn't seem to help.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Strange GameTooltip behavior with SetPoint


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