| Package | feathers.layout |
| Interface | public interface ILayout extends IFeathersEventDispatcher |
| Implementors | AnchorLayout, MultiColumnGridLayout |
| Method | Defined By | ||
|---|---|---|---|
![]() | addEventListener(type:String, listener:Function):void | IFeathersEventDispatcher | |
![]() | dispatchEvent(event:Event):void | IFeathersEventDispatcher | |
![]() | dispatchEventWith(type:String, bubbles:Boolean = false, data:Object = null):void | IFeathersEventDispatcher | |
getScrollPositionForIndex(index:int, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point
Using the item dimensions, calculates a scroll position that will
ensure that the item at a given index will be visible within the
specified bounds. | ILayout | ||
![]() | hasEventListener(type:String):Boolean | IFeathersEventDispatcher | |
layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult
Positions (and possibly resizes) the supplied items within the
optional bounds argument. | ILayout | ||
![]() | removeEventListener(type:String, listener:Function):void | IFeathersEventDispatcher | |
![]() | removeEventListeners(type:String = null):void | IFeathersEventDispatcher | |
| Event | Summary | Defined By | ||
|---|---|---|---|---|
| Dispatched when a property of the layout changes, indicating that a redraw is probably needed. | ILayout | |||
| getScrollPositionForIndex | () | method |
public function getScrollPositionForIndex(index:int, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):PointUsing the item dimensions, calculates a scroll position that will ensure that the item at a given index will be visible within the specified bounds.
Parameters
index:int | |
items:Vector.<DisplayObject> | |
x:Number | |
y:Number | |
width:Number | |
height:Number | |
result:Point (default = null) |
Point |
| layout | () | method |
public function layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResultPositions (and possibly resizes) the supplied items within the optional bounds argument. If no bounds are specified, the layout algorithm will assume that the bounds start a 0,0 and have unbounded dimensions. Returns the actual bounds of the content, which may be different than the specified bounds.
Note: The items are not absolutely restricted to appear only within the bounds. The bounds can affect positioning, but the algorithm may very well ignore them completely.
If a layout implementation needs to access accurate width
and height values from items that are of type
IFeathersControl, it must call validate()
manually. For performance reasons, the container that is the parent
of the items will not call validate() before passing the
items to a layout implementation. Meeting this requirement may be as
simple as looping through the items at the beginning of
layout() and validating all items that are Feathers UI
controls:
const itemCount:int = items.length;
for(var i:int = 0; i < itemCount; i++)
{
var item:IFeathersControl = items[i] as IFeathersControl;
if(item)
{
item.validate();
}
}Parameters
items:Vector.<DisplayObject> | |
viewPortBounds:ViewPortBounds (default = null) | |
result:LayoutBoundsResult (default = null) |
LayoutBoundsResult |
See also
| change | Event |
starling.events.Eventstarling.events.Event.CHANGEDispatched when a property of the layout changes, indicating that a redraw is probably needed.
An event type to be utilized in custom events. Not used by Starling right now.