Wowpedia
Advertisement
Wowpedia
240,483
pages

Regions, abstract rectangular areas to position something on the screen, provide two functions for quickly returning position and size from the lower-left screen corner:

  • GetRect() uses the region's own coordinate system (affected by its scale)
  • GetScaledRect() uses a standard coordinate system (scale = 1)
left, bottom, width, height = GetRect()
left, bottom, width, height = GetScaledRect()     -- multiplied by GetEffectiveScale()

Returns

The following returns only apply if the region has a defined position and size (nil otherwise).

left 
Number - Distance between the region and left edge of the screen (negative values are beyond the screen edge)
bottom 
Number - Distance between the region and bottom edge of the screen (negative values are beyond the screen edge)
width 
Number - Width between the region's left and right edges
height 
Number - Height between the region's bototm and top edges

Example

The example below shows the difference between each function using a tiny 1x1 box a short distance from the lower-left corner of the screen.

local myFrame = CreateFrame("Frame")     -- a frame is a type of region
myFrame:SetScale(2)                      -- the frame's coordinate system is 2x larger
myFrame:SetPoint("BOTTOMLEFT", 100, 100)
myFrame:SetSize(1,1)
print(myFrame:GetRect())                 -- 100, 100, 1, 1
print(myFrame:GetScaledRect())           -- 200, 200, 2, 2

Notes

Patch changes

See also

References

 
  1. ^ Blizzard Entertainment Kaivax 2019-06-19. UI Changes in Rise of Azshara.
  2. ^ 2018-12-07, Util.lua, version 8.1.0.28724, near line 1462, archived at Townlong-Yak
  3. ^ Blizzard Entertainment Slouken 2006-10-06. Re: Expansion Changes - Concise List)6. Archived from the original
Advertisement