GetUnscaledFrameRect()
Jump to navigation
Jump to search
- This function is implemented in
FrameXML/Util.lua
.
- This function is implemented in
Extends GetScaledRect() to return position and size from the lower-left screen corner in any arbitrary coordinate system.
left, bottom, width, height = GetUnscaledScaledRect(frame, scale)
Arguments
- frame
- Region - A region positioned somewhere on the screen
- scale
- Number - Size of the arbitrary coordinate system, divided into Region:GetScaledRect()
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
Notes
- Despite the name, this function will work with any Region and not merely its Frame subtype.
- This function is useful to determine the position of one frame relative to the coordinate system of another
Examples
The example below shows the difference of GetRect, GetScaledRect and GetUnscaledFrameRect 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 print(GetUnscaledFrameRect(myFrame, 4)) -- 50, 50, 0.5, 0.5
Patch changes
- Patch 8.2.0 (2019-06-25): No longer permitted on restricted frames.[1]
- This function is not mentioned, but protection derrives from GetScaledRect()
- This function is not mentioned, but protection derrives from GetScaledRect()
- Patch 8.1.0 (2018-12-11): Added.[2]
See also
- GetRect() - Returns the scale in a region's own coordinate system (scale = GetEffectiveScale())
- GetScaledRect() - Returns the scale in a standardized coordinate system (scale = 1)
References
- ^ Kaivax 2019-06-19. UI Changes in Rise of Azshara.
- ^ 2018-12-07, Util.lua, version 8.1.0.28724, near line 1462, archived at Townlong-Yak