Package | feathers.layout |
Interface | public interface ILayout extends IFeathersEventDispatcher |
Implementors | AnchorLayout |
Product Version : | Feathers 1.0.0 |
Property | Defined By | ||
---|---|---|---|
requiresLayoutOnScroll : Boolean [read-only]
Determines if the container calls layout() when the
scroll position changes. | ILayout |
Method | Defined By | ||
---|---|---|---|
addEventListener(type:String, listener:Function):void
Adds a listener for an event type. | IFeathersEventDispatcher | ||
calculateNavigationDestination(items:Vector.<DisplayObject>, index:int, keyCode:uint, bounds:LayoutBoundsResult):int
Using the current index and a key press, calculates the new index. | ILayout | ||
dispatchEvent(event:Event):void
Dispatches an event to all listeners added for the specified event type. | IFeathersEventDispatcher | ||
dispatchEventWith(type:String, bubbles:Boolean = false, data:Object = null):void
Dispatches an event from the pool with the specified to all listeners
for the specified event type. | IFeathersEventDispatcher | ||
getNearestScrollPositionForIndex(index:int, scrollX:Number, scrollY:Number, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point
Calculates the scroll position nearest to the current scroll position
that will display the full bounds of the item within the view port. | ILayout | ||
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, listener:Function = null):Boolean
Checks if a listener has been added for the specified event type. | 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
Removes a listener for an event type. | IFeathersEventDispatcher | ||
removeEventListeners(type:String = null):void
Removes all listeners for an event type. | IFeathersEventDispatcher |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when a property of the layout changes, indicating that a redraw is probably needed. | ILayout |
requiresLayoutOnScroll | property |
requiresLayoutOnScroll:Boolean
[read-only]
Determines if the container calls layout()
when the
scroll position changes. Useful for transforming items as the view
port scrolls. This value should be true
for layouts that
implement the IVirtualLayout
interface and the
useVirtualLayout
property is set to true
.
May also be used by layouts that toggle item visibility as the items
scroll into and out of the view port.
public function get requiresLayoutOnScroll():Boolean
calculateNavigationDestination | () | method |
public function calculateNavigationDestination(items:Vector.<DisplayObject>, index:int, keyCode:uint, bounds:LayoutBoundsResult):int
Using the current index and a key press, calculates the new index.
This might be use to change a list's selectedIndex
when
a key is pressed.
Parameters
items:Vector.<DisplayObject> | |
index:int | |
keyCode:uint | |
bounds:LayoutBoundsResult |
int |
See also
getNearestScrollPositionForIndex | () | method |
public function getNearestScrollPositionForIndex(index:int, scrollX:Number, scrollY:Number, items:Vector.<DisplayObject>, x:Number, y:Number, width:Number, height:Number, result:Point = null):Point
Calculates the scroll position nearest to the current scroll position that will display the full bounds of the item within the view port. If the item is already fully displayed in the view port, the current scroll position will be returned unchanged.
While the item will be displayed in the view port without being
clipped in any way, it may not be placed in the most prominent
position possible. To give the item a more prominent location, use
getScrollPositionForIndex()
instead.
This function should always be called after the
layout()
function. The width and height arguments are
the final bounds of the view port, which may be calculated in the
layout() function.
Parameters
index:int | |
scrollX:Number | |
scrollY:Number | |
items:Vector.<DisplayObject> | |
x:Number | |
y:Number | |
width:Number | |
height:Number | |
result:Point (default = null )
|
Point |
See also
getScrollPositionForIndex | () | method |
public function 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.
Typically, this function is used to show the item in the most
prominent way, such as centering. To scroll a minimum distance
required to display the full bounds of the item in the view port,
use getNearestScrollPositionForIndex()
instead.
This function should always be called after the
layout()
function. The width and height arguments are
the final bounds of the view port, which may be calculated in the
layout() function.
Parameters
index:int | |
items:Vector.<DisplayObject> | |
x:Number | |
y:Number | |
width:Number | |
height:Number | |
result:Point (default = null )
|
Point |
See also
layout | () | method |
public function layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult
Positions (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.Event
starling.events.Event.CHANGE
Dispatched when a property of the layout changes, indicating that a redraw is probably needed.
The properties of the event object have the following values:
Property | Value |
---|---|
bubbles | false |
currentTarget | The Object that defines the
event listener that handles the event. For example, if you use
myButton.addEventListener() to register an event listener,
myButton is the value of the currentTarget . |
data | null |
target | The Object that dispatched the event;
it is not always the Object listening for the event. Use the
currentTarget property to always access the Object
listening for the event. |