ScriptRegion:GetRect

From Warcraft Wiki
Jump to navigation Jump to search
GitHub Octocat.png  Dragonflight-Icon-Inline.png  BTNTemp.png  Wowprogramming.png ScriptRegion:GetRect
GitHub Octocat.png  Dragonflight-Icon-Inline.png  BTNTemp.png ScriptRegion:GetScaledRect
GitHub Octocat.png  Dragonflight-Icon-Inline.png  BTNTemp.png ScriptRegion:IsRectValid

Returns the coords and size of the region.

left, bottom, width, height = ScriptRegion:GetRect()
                            = ScriptRegion:GetScaledRect()

Returns

Returns nil if the region has no points.

left
number? - Bottom side of the screen to the bottom edge of the region.
bottom
number? - Left side of the screen to the left edge of the region.
width
number? - Distance between the left and right edges.
height
number? - Distance between the bottom and top edges.

Example

GetScaledRect() is the result of multiplying by GetScale

local f = CreateFrame("Frame")
f:SetPoint("BOTTOMLEFT", 100, 100)
f:SetSize(25, 25)
f:SetScale(2)

print(f:GetRect())       -- 100, 100, 25, 25
print(f:GetScaledRect()) -- 200, 200, 50, 50

Patch changes

Battle for Azeroth Patch 8.2.0 (2019-06-25): Not allowed on restricted frames.
Battle for Azeroth Patch 8.1.0 (2018-12-11): Added GetScaledRect
Bc icon.gif Patch 2.0.1 (2006-12-05): Added GetRect[1]

See also