Nameplates - Reposition for big units causes problems
adamjedlicka opened this issue ยท 2 comments
btw if by "causes problems" you mean nameplate jumping above/below unit then the issue is that wndNameplate:GetPos() sometimes returns random values which is causing this. Anyways there is function unit:GetOverheadAnchor() which returns table with coords for nameplate and it's pretty simple fix
function ForgeUI_Nameplates:RepositionNameplate(tNameplate)
if tNameplate.tSettings.bReposition then
local wndNameplate = tNameplate.wndNameplate
local tOverhead = tNameplate.unitOwner:GetOverheadAnchor()
if tOverhead == nil then return end
if tOverhead.y < 25 and not tNameplate.bRepositioned then
tNameplate.bRepositioned = true
wndNameplate:SetUnit(tNameplate.unitOwner, 0)
elseif tOverhead.y > 25 and tNameplate.bRepositioned then
tNameplate.bRepositioned = false
wndNameplate:SetUnit(tNameplate.unitOwner, 1)
end
end
end
You can also get rid of "wndReposition" since it no longer needed.