<constantboundslayout>
Arranges a set of views to a constant 'x' or 'y' value with a bounding rect

JavaScript: lz.constantboundslayout
extends <layout> » <node> » lz.Eventable »

A <view> can have an xoffset and a yoffset. These offsets allow the view to be placed relative to the point (xoffset, yoffset). (Otherwise the view is placed using the view's top left corner as a reference point.) If a view has an offset, then this will effect how layouts position it relative to other views.

The easiest way to see how constantboundslayout works is to contrast it with <constantlayout> as shown here.

The example below shows three views, one with an xoffset value of five. When using just a <constantlayout> the yellow view is shifted left five pixels because of its xoffset.

Example 67. Using constantboundlayout

<canvas height="85">
  <view bgcolor="red">
    <view width="80" height="80" bgcolor="yellow" xoffset="5"/>       
    <view width="60" height="60" bgcolor="silver"/> 
    <view width="40" height="40" bgcolor="green"/>           
    <constantlayout axis="x" value="10"/> 
  </view>
</canvas>

With a constantboundslayout that offset is effectively ignored, meaning only the bounds of the view matters in the layout process. The example below shows all of the subviews now aligned with the use of a constantboundslayout.

Example 68. Aligning on the vertical axis

<canvas height="85">
  <include href="utils/layouts/constantboundslayout.lzx"/>
  <view bgcolor="red">
    <view width="80" height="80" bgcolor="yellow" xoffset="5"/>      
    <view width="60" height="60" bgcolor="silver"/> 
    <view width="40" height="40" bgcolor="green"/>           
    <constantboundslayout axis="x" value="10"/>
  </view>
</canvas>

Attributes

Name (CSS property) Type (tag) Type (js) Default Category
axis string String y read/write
  The axis in which this layout operates either 'x' or 'y'.
value expression any 0 read/write
  The constant value that is applied to the attribute ( defined in 'axis' as 'x' or 'y' ) of each subview in the layout.

Attributes inherited from <layout>

locked, subviews, updateDelegate

Methods

update()
constantboundslayout.update(v);
this method is called by the layout class everytime an event (that has been registered with the updatedelegate) is sent by a subview or the layout's parent view.
Parameter Name Type Description
v    

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Events inherited from <node>

onconstruct, ondata, oninit

Events inherited from lz.Eventable

ondestroy