WoW:API Region SetPoint: Difference between revisions

→‎Details: details on edges
m (lead in, signature whitespace)
(→‎Details: details on edges)
Line 32: Line 32:
* Behavior of this function with multiple anchors is complex. Generally, you can override points by setting them again (so repeated assignment to the "TOPLEFT" point of a frame would move the frame, unless other anchor points interfere). If you're repositioning a frame, call <code>obj:[[API Region ClearAllPoints|ClearAllPoints]]()</code> to eliminate unwanted interactions.
* Behavior of this function with multiple anchors is complex. Generally, you can override points by setting them again (so repeated assignment to the "TOPLEFT" point of a frame would move the frame, unless other anchor points interfere). If you're repositioning a frame, call <code>obj:[[API Region ClearAllPoints|ClearAllPoints]]()</code> to eliminate unwanted interactions.
* Offset units are relative to the screen's effective scale. WoW's screen always has a height of 768 units, while screen width varies with aspect ratio.
* Offset units are relative to the screen's effective scale. WoW's screen always has a height of 768 units, while screen width varies with aspect ratio.
=== Edge definitions ===
The edge "points" (TOP, RIGHT, BOTTOM, LEFT) are not actual points, but... edges. To fully define a region position using edges alone, you will need to define all four (as opposed to using corners, where you only need two) edges.
Therefore, defining an edge does not necessarily place a region relative to the center of that edge (For example, if you define TOP and RIGHT, the region will be placed at the TOPRIGHT corner). However, by default a region is "pulled" to the center if the number of points defined is insufficient.
Example:
Region:ClearAllPoints();
Region:SetPoint("TOP", relativeframe);
Region:SetWidth(100);
Region:SetHeight(100);
will place ''Region'' to the top center of the ''relativeframe'' while adding a
Region:SetPoint("RIGHT", relativeframe);
will place ''Region'' in the top right corner and now ''Region'' is fully defined.
Anonymous user