Este site faz uso extensivo de JavaScript.
Favor habilite JavaScript em seu navegador.
No ar
RTP
10.2.7
RTP
10.2.6
Beta
Tooltip Offset
Resposta da Mensagem
Retornar ao índice do fórum
Postado por
123476
This post was from a user who has deleted their account.
Postado por
MeanMachine
Well that's fairly easy. You probably overlooked the fact that SetOwner can take two additional arguments - x and y offset.
Postado por
123476
This post was from a user who has deleted their account.
Postado por
Wanderingfox
Anchor it to UIParent and offset by the screen dimensions?
something like this (Warning pseudo code):
local cursorX, cursorY = GetCursorPosition()
local offsetX = 0
local offsetY = 0
GameTooltip:SetOwner(CurrentCursorAnchor, UIParent, cursorX + offsetX, cursorY + offsetY)
edit:
Though doing something like that can put the tooltip off the screen, but that can be resolved with some more math and dealing with offsets.
If you want some real code to look at, I believe Cowtip (
http://files.wowace.com/CowTip/
) has some nice clean code for doing it (check in the position.lua file).
Postado por
91244
This post was from a user who has deleted their account.
Postado por
Wanderingfox
I'm really not sure there is an elegant solution, almost every addon I've seen that deals with custom tooltip positioning has it anchored either off UIParent, or some other static frame (which would yield the same results).
edit:
Come to think of it... is there a reason you can't offset from the cursor anchor? I can't think of any >_<
Postado por
123476
This post was from a user who has deleted their account.
Postado por
MeanMachine
Well you could try to "emulate" the mouse anchoring by setting the tooltip's position every time the cursor moves. It's basically the way it works anyway. Though nefarion's work-around doesn't work? I guess the tooltip doesn't depend so much on the owner frame rather than the anchor.
Postado por
91244
This post was from a user who has deleted their account.
Postado por
Wanderingfox
This is how cowtip does it, so it obviously does work >_>
local function ReanchorTooltip()
GameTooltip:ClearAllPoints()
local scale = GameTooltip:GetEffectiveScale()
if currentAnchorType == "PARENT" then
GameTooltip:SetPoint(currentCursorAnchor, currentOwner, anchorOpposite, currentOffsetX, currentOffsetY)
else -- CURSOR
local x, y = GetCursorPosition()
x, y = x / scale + currentOffsetX, y / scale + currentOffsetY
GameTooltip:SetPoint(currentCursorAnchor, UIParent, "BOTTOMLEFT", x, y)
end
end
Credit to ckknight et all
Postado por
MeanMachine
Well, looks basically like what I suggested. It'll still have to be constantly "reanchored". Anyway, call it ugly but it's basically how it works. At some point you just have to update every time the cursor moves. Personally I don't mind doing it in the addon code, but then again I don't program addons much.
Oh, and for the love of god don't update it 1000 times per second. Set some manageable baseline.
Oh and yeah, won't hurt to suggest cursor offsets on the wow forums.
Postado por
123476
This post was from a user who has deleted their account.
Postado por
91244
This post was from a user who has deleted their account.
Postado por
Wanderingfox
You don't even need to update it every on update either, updating it every x onupdates should be enough (I think cowtip uses something like every 6).
Postado por
91244
This post was from a user who has deleted their account.
Postado por
Wanderingfox
Oh I know, I was just pointing out that if he's that worried about it causing an issue it could be throttled further XD
Resposta da Mensagem
Você não iniciou a seção. Por favor, faça
login
para escrever uma resposta ou
registre-se
se ainda não tiver uma conta.