OAP Lizzard A game interface engine
Game interfaces, outside the game Settings
← XML guide

Documentation / XML guide

Sizes and stretching

When the size counts, when anchors stretch a region, and when it has no place at all.

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 directionResultEvidence
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)
Two anchors stretch a region; one anchor without a size places nothing On the left, an inset anchored by its TOPLEFT and BOTTOMRIGHT fills its parent less the offsets, and its 50 by 50 size is ignored. On the right, a frame with one TOPLEFT anchor and no size has no position at all. parent TOPLEFT x 10, y -30 BOTTOMRIGHT x -10, y 10 Size 50 × 50, ignored parent TOPLEFT only, no Size: no position, not drawn, GetLeft() is nil
Left: stretched between two anchors, so the size doesn't count. Right: the dashed box is where you might expect the frame; it isn't there at all.

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 LEFT and a CENTER): 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>
Which anchor wins an edge two anchors give TOPLEFT and BOTTOMLEFT both give the left edge; TOPLEFT wins, so the left edge is at 20, not 60. RIGHT and the right side give the right edge. The order the anchors win in is TOP, BOTTOM, LEFT, RIGHT, then TOPLEFT, TOPRIGHT, BOTTOMLEFT, BOTTOMRIGHT. parent TOPLEFT x 20: wins the left BOTTOMLEFT x 60: loses the left, still gives the bottom RIGHT Who wins an edge 1 TOP 2 BOTTOM 3 LEFT 4 RIGHT 5 TOPLEFT 6 TOPRIGHT 7 BOTTOMLEFT 8 BOTTOMRIGHT A side beats a corner; corners in UI.xsd's order.
The dashed line is where BOTTOMLEFT would have put the left edge. It still fixes the bottom, which nothing else gives.

How sure each part of that order is:

  • TOPLEFT beats BOTTOMLEFT for the left, and beats TOPRIGHT for the top, whichever was set first. Measured (Retail)
  • A side beats a corner: RIGHT beats BOTTOMRIGHT for 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.xsd lists 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, TOPLEFT and BOTTOMRIGHT, to the parent's same points, so the region fills its parent. In Lua, SetAllPoints first clears any other points. Measured (Retail)
  • A texture or font string with setAllPoints and 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.