Documentation / XML guide
Sizes and stretching
When the size counts, when anchors stretch a region, and when it has no place at all.
- Three cases, in each direction
- Other ways to have no position
- Two anchors that give the same edge
- setAllPoints, and regions with no anchors
- Regions that size themselves
Lizzard works out each region's rectangle from its anchors and its size, one direction at a time: across (left, centre, right) and up and down (bottom, centre, top). For each direction there are three cases.
Three cases, in each direction
| Anchors in that direction | Result | Evidence |
|---|---|---|
| Both sides (a left and a right, or a top and a bottom) | The anchors fix both edges. The set size is ignored. | Measured (Retail) |
| One point, and a size in that direction | The point fixes one place, the size the rest. | Measured (Retail) |
| One point and no size (0, set or not); or no anchor at all | No position. The region isn't drawn, and GetLeft gives nil. |
Measured (Retail) |
The stretched inset on the left
<Frame parentKey="Inset">
<Size x="50" y="50"/> <!-- ignored: both sides are anchored -->
<Anchors>
<Anchor point="TOPLEFT" x="10" y="-30"/>
<Anchor point="BOTTOMRIGHT" x="-10" y="10"/>
</Anchors>
</Frame>
Other ways to have no position
- An anchor to a region that has no position counts as missing, so the problem spreads to everything anchored to it. Measured (Retail)
- An edge and the centre in one direction (a
LEFTand aCENTER): the edge and the size win, whichever anchor was set first; the centre doesn't stretch the region. Measured (Retail)
Two anchors that give the same edge
TOPLEFT and BOTTOMLEFT both give a region's left edge. When both are set, the point
decides which one wins, not the order they were set in:
<Anchors>
<Anchor point="TOPLEFT" x="20" y="-20"/>
<Anchor point="BOTTOMLEFT" x="60" y="20"/>
<Anchor point="RIGHT" x="-20"/>
</Anchors>
How sure each part of that order is:
TOPLEFTbeatsBOTTOMLEFTfor the left, and beatsTOPRIGHTfor the top, whichever was set first. Measured (Retail)- A side beats a corner:
RIGHTbeatsBOTTOMRIGHTfor the right. In Forever's World Map, the map ends at the quest log's left edge, which only this gives. Screenshot - The rest of the order: the sides among themselves, and the corners in the order
UI.xsdlists them. Blizzard's Graphics Quality settings rows rely on the corner order. Guessed for the pairs not yet measured.
setAllPoints, and regions with no anchors
setAllPoints="true"gives two anchors,TOPLEFTandBOTTOMRIGHT, to the parent's same points, so the region fills its parent. In Lua,SetAllPointsfirst clears any other points. Measured (Retail)- A texture or font string with
setAllPointsand its own<Anchors>takes its own anchors instead. A divider in Forever's group finder shows this way in the game. Screenshot - A texture in a
<Layer>with no anchors at all fills its frame. Blizzard's slider buttons rely on it. Blizzard's code Guessed whether its size then counts; Lizzard ignores it. - A font string in a layer with no anchors fills its frame too, until something anchors it. Guessed
- A texture made in Lua with no anchor has no position and isn't drawn. Guessed
Regions that size themselves
- Font strings. With no width set, and not stretched, a font string is as wide as its text on one line; with no height, as high as its text laid out in its width. Empty, it is 1 by 1. Measured (Retail)
- A scroll frame's child needs no anchors: the scroll frame places it, and its size is enough.
- A multi-line edit box with a width and no height is as high as its text plus its insets, so it can scroll. Guessed the exact height.
collapsesLayout: a hidden region with it takes no room, so what is anchored to it closes up.clampedToScreen: the frame is moved, not resized, to keep it on the screen. Measured (Retail), in part.roundLayoutToNearestPixel: sizes and offsets are rounded to whole pixels. Measured (Retail). Without it, Lizzard doesn't snap positions to pixels. Guessed
<Size x="" y=""/> and the older <Size><AbsDimension x="" y=""/></Size>
both work. A part left out keeps what the region already had.