XML/Dimension
< XML
Jump to navigation
Jump to search
<Dimension> defines a dimension (size, offset, etc.) as x and y, or with a child element to specify the coordinate system.
<Dimension x="" y=""> <AbsDimension x="" y="" /> <RelDimension x="" y="" /> </Dimension>
Attributes
- x (xs:int? ) - Horizontal distance affected by UI scaling; (+) right and (-) left.
- y (xs:int? ) - Vertical distance affected by UI scaling; (+) up and (-) down.
Child elements
<AbsDimension> defines coordinates in scaling-dependent units (same as <Dimension>).
- x (xs:int) - Horizontal distance affected by UI scaling; (+) right and (-) left.
- y (xs:int) - Vertical distance affected by UI scaling; (+) up and (-) down.
<RelDimension> defines coordinates relative to the entire screen, where 0 and 1 are the edges.
- x (xs:float) - Ratio of screen width, from left to right edges.
- y (xs:float) - Ratio of screen height, from bottom to top edges.
Example
Creates a parent frame that fills one quarter of the screen, and a child frame that is set to 200x100 units and is 22 units from the top edge of its parent.
<Frame name="MyFrame">
<Size>
<RelDimension x="0.5" y="0.5"/>
</Size>
<Frames>
<Frame name="$parentChild">
<Size x="200" y="100"/>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="-22" />
</Offset>
</Anchor>
</Anchors>
</Frame>
</Frames>
</Frame>
N.B.: <Anchor> also has its own x and y attributes, so this could be written in fewer lines without <Offset> and <AbsDimension>.