Mathematically positioning controls in 3.0

From TrillWiki

Jump to: navigation, search

Using 3.0's skin math, we are given new possibilities for positioning our controls. For example:

[edit] Horizontal

You can center an object horizontally (# equals object's width or height):

<rect>
<left num="(%window.width%/2)-#" width="0" />
<right num="(%window.width%/2)-#" width="1" />
<top />
<bottom />
</rect>

[edit] Vertical

...or vertically

<rect>
<left />
<right />
<top num="(%window.height%/2)-#" height="0" />
<bottom num="(%window.height%/2)-#" height="1" />
</rect>

[edit] Both

...or both

<rect>
<left num="(%window.width%/2)-#" width="0" />
<right num="(%window.width%/2)-#" width="1" />
<top num="(%window.height%/2)-#" height="0" />
<bottom num="(%window.height%/2)-#" height="1" />
</rect>

Other techniques to position something can be used as well...

Experimenting is fun!

Personal tools