an attempt to fix lua error related to offscreen arrow texture

This commit is contained in:
Bunny67
2021-02-24 08:00:38 +03:00
parent 0c4ecc60a2
commit 64f04c387a
@@ -941,8 +941,9 @@ local function ConstructMoverSizer(parent)
local x, y = mover:GetCenter() local x, y = mover:GetCenter()
if x and y then if x and y then
if mover:GetRight() < margin or mover:GetLeft() + margin > GetScreenWidth() or mover:GetTop() < 20 or mover:GetBottom() + margin > GetScreenHeight() then if mover:GetRight() < margin or mover:GetLeft() + margin > GetScreenWidth() or mover:GetTop() < 20 or mover:GetBottom() + margin > GetScreenHeight() then
frame.arrowTexture:GetRect()
local arrowX, arrowY = frame.arrowTexture:GetCenter() local arrowX, arrowY = frame.arrowTexture:GetCenter()
local arrowAngle = atan2(y - arrowY, x - arrowX) local arrowAngle = atan2(y - (arrowY or 0), x - (arrowX or 0))
frame.offscreenText:Show() frame.offscreenText:Show()
frame.arrowTexture:Show() frame.arrowTexture:Show()
frame.arrowTexture:SetRotation( (arrowAngle - 90) / 180 * math.pi) frame.arrowTexture:SetRotation( (arrowAngle - 90) / 180 * math.pi)