Difference between revisions of "Tile Systems (MenuQue)"
→FocusBox
imported>Kyoma m (→FocusBox) |
imported>Kyoma |
||
Line 74: | Line 74: | ||
===FocusBox=== | ===FocusBox=== | ||
A focus system will react to the active element (e.g. the mouse is over it). It will then get the same <width>,<height>, <x> and <y> traits as the active element. But this only happens if the active element has a "&true;" <focus> and a "&true;" <target> trait. The position offset can be adjusted with the <focusinset> trait. The difference in size can be adjusted with the <focussize> trait. | A focus system will react to the active element (e.g. the mouse is over it). It will then get the same <width>,<height>, <x> and <y> traits as the active element. But this only happens if the active element has a "&true;" <focus> and a "&true;" <target> trait. The position offset can be adjusted with the <focusinset> trait. The difference in size can be adjusted with the <focussize> trait. | ||
A quick template | |||
<pre>... | |||
<rect name="focus_box"> | |||
<include src="focus_box.xml"/> | |||
<id> &FocusBox; </id> | |||
<visible> &false; </visible> | |||
</rect> | |||
... | |||
<rect name="some_element"> | |||
<width> ... </width> | |||
<height> ... </height> | |||
<x> ... </x> | |||
<y> ... </y> | |||
<!-- when the mouse is over this element its dimension | |||
and position will be copied to the focus box --> | |||
<focus> &true; </focus> | |||
<!-- this gets added to the width and height before they are copied. | |||
And half of it gets substracted from X and Y to even the increase in size | |||
between the outline. --> | |||
<focussize> 20 </focussize> | |||
<!-- this gets added to the X and Y before they are copied --> | |||
<focusinset> 0 </focusinset> | |||
</rect> | |||
</pre>To put things in a couple of simple formulas: | |||
focusBox_X = (element_X - (focussize / 2) + focusinset) | |||
focusBox_Y = (element_Y - (focussize / 2) + focusinset) | |||
focusBox_Width = (element_Width + focussize) | |||
focusBox_Height = (element_Height + focussize) | |||
===TextEdit=== | ===TextEdit=== |