ScriptRegionResizing:ClearAllPoints

From Warcraft Wiki
Jump to navigation Jump to search

Removes all anchor points from the region.

ScriptRegionResizing:ClearAllPoints()

Example

Typically used before repositioning a frame with SetPoint() to prevent invalid rects or distorted textures.

PlayerFrame:ClearAllPoints()
PlayerFrame:SetPoint("CENTER", UIParent)

Details

The renderer will only resolve rects on the next frame or when methods like GetSize force it to resolve the rects.

local f = CreateFrame("Frame")
f:SetPoint("CENTER")
f:SetSize(100, 100)
f.tex = f:CreateTexture()
f.tex:SetColorTexture(1, 1, 0)
f.tex:SetAllPoints()
-- rects will be invalid on the next frame
f:ClearAllPoints() -- not visible
-- rects are forced to be validated beforehand
f:GetSize()
f:ClearAllPoints() -- visible

This generally does not invalidate rects once validated, i.e. after calling ClearAllPoints() the region will still be visible.

C_Timer.After(0, function() f:ClearAllPoints(); print(f:IsRectValid()) end) -- visible, true

Patch changes

Battle for Azeroth Patch 8.0.1 (2018-07-17): Clearing points no longer triggers anchor-processing.[1]