Package | feathers.layout |
Class | public class HorizontalSpinnerLayout |
Inheritance | HorizontalSpinnerLayout starling.events.EventDispatcher |
Implements | ISpinnerLayout, ITrimmedVirtualLayout |
Product Version : | Feathers 2.2.0 |
SpinnerList
component, positions items from
left to right in a single row and repeats infinitely.
See also
Property | Defined By | ||
---|---|---|---|
afterVirtualizedItemCount : int
Used internally by a component, such as List, to set the
number of virtualized items that appear after the items passed to
layout(). | HorizontalSpinnerLayout | ||
beforeVirtualizedItemCount : int
Used internally by a component, such as List, to set the
number of virtualized items that appear before the items passed to
layout(). | HorizontalSpinnerLayout | ||
gap : Number
The space, in pixels, between items. | HorizontalSpinnerLayout | ||
horizontalAlign : String
The alignment of the items horizontally, on the x-axis. | HorizontalSpinnerLayout | ||
padding : Number
Quickly sets all padding properties to the same value. | HorizontalSpinnerLayout | ||
paddingBottom : Number
The minimum space, in pixels, above the items. | HorizontalSpinnerLayout | ||
paddingLeft : Number
The minimum space, in pixels, to the right of the items, if they
do not repeat. | HorizontalSpinnerLayout | ||
paddingRight : Number
The minimum space, in pixels, to the right of the items, if they
do not repeat. | HorizontalSpinnerLayout | ||
paddingTop : Number
The minimum space, in pixels, above the items. | HorizontalSpinnerLayout | ||
repeatItems : Boolean
If set to true, the layout will repeat the items
infinitely, if there are enough items to allow this behavior. | HorizontalSpinnerLayout | ||
requestedColumnCount : int
Requests that the layout set the view port dimensions to display a
specific number of columns (plus gaps and padding), if possible. | HorizontalSpinnerLayout | ||
requiresLayoutOnScroll : Boolean [read-only]
Determines if the container calls layout() when the
scroll position changes. | HorizontalSpinnerLayout | ||
resetTypicalItemDimensionsOnMeasure : Boolean
If set to true, the width and height of the
typicalItem will be reset to typicalItemWidth
and typicalItemHeight, respectively, whenever the
typical item needs to be measured. | HorizontalSpinnerLayout | ||
selectionBounds : Rectangle [read-only]
A rectangle indicating the bounds of the selected item. | HorizontalSpinnerLayout | ||
snapInterval : Number [read-only]
The interval, in pixels, between snapping points. | HorizontalSpinnerLayout | ||
typicalItem : DisplayObject
Used internally by a component that supports layout virtualization,
such as List, to provide a display object with
dimensions that represent a "typical" item in the layout. | HorizontalSpinnerLayout | ||
typicalItemHeight : Number
Used to reset the height, in pixels, of the typicalItem
for measurement. | HorizontalSpinnerLayout | ||
typicalItemWidth : Number
Used to reset the width, in pixels, of the typicalItem
for measurement. | HorizontalSpinnerLayout | ||
useVirtualLayout : Boolean
Determines if virtual layout should be used. | HorizontalSpinnerLayout | ||
verticalAlign : String
The alignment of the items vertically, on the y-axis. | HorizontalSpinnerLayout |
Method | Defined By | ||
---|---|---|---|
Constructor. | HorizontalSpinnerLayout | ||
calculateNavigationDestination(items:Vector.<DisplayObject>, index:int, keyCode:uint, bounds:LayoutBoundsResult):int
Using the current index and a key press, calculates the new index. | HorizontalSpinnerLayout | ||
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. | HorizontalSpinnerLayout | ||
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. | HorizontalSpinnerLayout | ||
getVisibleIndicesAtScrollPosition(scrollX:Number, scrollY:Number, width:Number, height:Number, itemCount:int, result:Vector.<int> = null):Vector.<int>
Used internally by a component, such as List, to
determines which indices are visible with the specified view port
bounds and scroll position. | HorizontalSpinnerLayout | ||
layout(items:Vector.<DisplayObject>, viewPortBounds:ViewPortBounds = null, result:LayoutBoundsResult = null):LayoutBoundsResult
Positions (and possibly resizes) the supplied items within the
optional bounds argument. | HorizontalSpinnerLayout | ||
measureViewPort(itemCount:int, viewPortBounds:ViewPortBounds = null, result:Point = null):Point
Used internally by a component, such as List, to measure
the view port based on the typical item dimensions or cached
dimensions, if available. | HorizontalSpinnerLayout |
Event | Summary | Defined By | ||
---|---|---|---|---|
Dispatched when a property of the layout changes, indicating that a redraw is probably needed. | HorizontalSpinnerLayout |
afterVirtualizedItemCount | property |
afterVirtualizedItemCount:int
Used internally by a component, such as List
, to set the
number of virtualized items that appear after the items passed to
layout()
. Allows the array of items to be smaller than
the full size. Does not work if the layout has variable item
dimensions.
This property is meant to be set by the List
or other
component that uses the virtual layout. If you're simply creating
a layout for a List
or another component, do not use
this property. It is meant for developers creating custom components
only.
public function get afterVirtualizedItemCount():int
public function set afterVirtualizedItemCount(value:int):void
beforeVirtualizedItemCount | property |
beforeVirtualizedItemCount:int
Used internally by a component, such as List
, to set the
number of virtualized items that appear before the items passed to
layout()
. Allows the array of items to be smaller than
the full size. Does not work if the layout has variable item
dimensions.
This property is meant to be set by the List
or other
component that uses the virtual layout. If you're simply creating
a layout for a List
or another component, do not use
this property. It is meant for developers creating custom components
only.
public function get beforeVirtualizedItemCount():int
public function set beforeVirtualizedItemCount(value:int):void
gap | property |
gap:Number
The space, in pixels, between items.
The default value is 0
.
public function get gap():Number
public function set gap(value:Number):void
horizontalAlign | property |
horizontalAlign:String
The alignment of the items horizontally, on the x-axis.
Note: The HorizontalAlign.JUSTIFY
constant is not supported.
The default value is feathers.layout.HorizontalAlign.CENTER
.
public function get horizontalAlign():String
public function set horizontalAlign(value:String):void
See also
padding | property |
padding:Number
Quickly sets all padding properties to the same value. The
padding
getter always returns the value of
paddingTop
, but the other padding values may be
different.
The default value is 0
.
public function get padding():Number
public function set padding(value:Number):void
See also
paddingBottom | property |
paddingBottom:Number
The minimum space, in pixels, above the items.
The default value is 0
.
public function get paddingBottom():Number
public function set paddingBottom(value:Number):void
paddingLeft | property |
paddingLeft:Number
The minimum space, in pixels, to the right of the items, if they
do not repeat. If items repeat, paddingLeft
will
only be used if horizontalAlign
is set to
HorizontalAlign.LEFT
. In this case, the first item,
starting from the left, will be offset by the value of
paddingLeft
.
The default value is 0
.
public function get paddingLeft():Number
public function set paddingLeft(value:Number):void
paddingRight | property |
paddingRight:Number
The minimum space, in pixels, to the right of the items, if they
do not repeat. If items repeat, paddingRight
will
only be used if horizontalAlign
is set to
HorizontalAlign.RIGHT
. In this case, the first item,
starting from the right, will be offset by the value of
paddingRight
.
The default value is 0
.
public function get paddingRight():Number
public function set paddingRight(value:Number):void
paddingTop | property |
paddingTop:Number
The minimum space, in pixels, above the items.
The default value is 0
.
public function get paddingTop():Number
public function set paddingTop(value:Number):void
repeatItems | property |
repeatItems:Boolean
If set to true
, the layout will repeat the items
infinitely, if there are enough items to allow this behavior. If the
total width of the items is smaller than the width of the view port,
the items cannot repeat.
The default value is true
.
public function get repeatItems():Boolean
public function set repeatItems(value:Boolean):void
requestedColumnCount | property |
requestedColumnCount:int
Requests that the layout set the view port dimensions to display a
specific number of columns (plus gaps and padding), if possible. If
the explicit width of the view port is set, then this value will be
ignored. If the view port's minimum and/or maximum width are set,
the actual number of visible columns may be adjusted to meet those
requirements. Set this value to 0
to display as many
columns as possible.
The default value is 0
.
public function get requestedColumnCount():int
public function set requestedColumnCount(value:int):void
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
resetTypicalItemDimensionsOnMeasure | property |
resetTypicalItemDimensionsOnMeasure:Boolean
If set to true
, the width and height of the
typicalItem
will be reset to typicalItemWidth
and typicalItemHeight
, respectively, whenever the
typical item needs to be measured. The measured dimensions of the
typical item are used to fill in the blanks of a virtualized layout
for virtual items that don't have their own display objects to
measure yet.
The default value is false
.
public function get resetTypicalItemDimensionsOnMeasure():Boolean
public function set resetTypicalItemDimensionsOnMeasure(value:Boolean):void
See also
selectionBounds | property |
selectionBounds:Rectangle
[read-only]
A rectangle indicating the bounds of the selected item. Used by the
SpinnerList
to position its selection overlay skin.
public function get selectionBounds():Rectangle
snapInterval | property |
snapInterval:Number
[read-only] The interval, in pixels, between snapping points.
public function get snapInterval():Number
typicalItem | property |
typicalItem:DisplayObject
Used internally by a component that supports layout virtualization,
such as List
, to provide a display object with
dimensions that represent a "typical" item in the layout. These
dimensions will be used to fill in blanks for the layout when an
item is virtual and isn't actually on the display list. If you are
simply passing a layout to a component, setting this property will
have no effect. It is meant to be used by the component, and the
component will replace any value you pass to this property.
public function get typicalItem():DisplayObject
public function set typicalItem(value:DisplayObject):void
See also
typicalItemHeight | property |
typicalItemHeight:Number
Used to reset the height, in pixels, of the typicalItem
for measurement. The measured dimensions of the typical item are used
to fill in the blanks of a virtualized layout for virtual items that
don't have their own display objects to measure yet.
This value is only used when resetTypicalItemDimensionsOnMeasure
is set to true
. If resetTypicalItemDimensionsOnMeasure
is set to false
, this value will be ignored and the
typicalItem
dimensions will not be reset before
measurement.
If typicalItemHeight
is set to NaN
, the
typical item will auto-size itself to its preferred height. If you
pass a valid Number
value, the typical item's height will
be set to a fixed size. May be used in combination with
typicalItemWidth
.
The default value is NaN
.
public function get typicalItemHeight():Number
public function set typicalItemHeight(value:Number):void
See also
typicalItemWidth | property |
typicalItemWidth:Number
Used to reset the width, in pixels, of the typicalItem
for measurement. The measured dimensions of the typical item are used
to fill in the blanks of a virtualized layout for virtual items that
don't have their own display objects to measure yet.
This value is only used when resetTypicalItemDimensionsOnMeasure
is set to true
. If resetTypicalItemDimensionsOnMeasure
is set to false
, this value will be ignored and the
typicalItem
dimensions will not be reset before
measurement.
If typicalItemWidth
is set to NaN
, the
typical item will auto-size itself to its preferred width. If you
pass a valid Number
value, the typical item's width will
be set to a fixed size. May be used in combination with
typicalItemHeight
.
The default value is NaN
.
public function get typicalItemWidth():Number
public function set typicalItemWidth(value:Number):void
See also
useVirtualLayout | property |
useVirtualLayout:Boolean
Determines if virtual layout should be used. Some components don't
support virtual layouts, and they will always change this property to
false
. In those cases, the virtual layout options
will be ignored.
The default value is true
.
public function get useVirtualLayout():Boolean
public function set useVirtualLayout(value:Boolean):void
verticalAlign | property |
verticalAlign:String
The alignment of the items vertically, on the y-axis.
The default value is feathers.layout.VerticalAlign.TOP
.
public function get verticalAlign():String
public function set verticalAlign(value:String):void
See also
HorizontalSpinnerLayout | () | Constructor |
public function HorizontalSpinnerLayout()
Constructor.
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 |
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 |
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 |
getVisibleIndicesAtScrollPosition | () | method |
public function getVisibleIndicesAtScrollPosition(scrollX:Number, scrollY:Number, width:Number, height:Number, itemCount:int, result:Vector.<int> = null):Vector.<int>
Used internally by a component, such as List
, to
determines which indices are visible with the specified view port
bounds and scroll position. Indices that aren't returned are
typically not displayed and can be replaced virtually. Uses the
typical items dimensions, or cached dimensions, if available.
This function is meant to be called by the List
or
other component that uses the virtual layout. If you're simply
creating a layout for a List
or another component, do
not call this function. It is meant for developers creating custom
components only.
Parameters
scrollX:Number | |
scrollY:Number | |
width:Number | |
height:Number | |
itemCount:int | |
result:Vector.<int> (default = null )
|
Vector.<int> |
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 |
measureViewPort | () | method |
public function measureViewPort(itemCount:int, viewPortBounds:ViewPortBounds = null, result:Point = null):Point
Used internally by a component, such as List
, to measure
the view port based on the typical item dimensions or cached
dimensions, if available.
This function is meant to be called by the List
or
other component that uses the virtual layout. If you're simply
creating a layout for a List
or another component, do
not call this function. It is meant for developers creating custom
components only.
Parameters
itemCount:int | |
viewPortBounds:ViewPortBounds (default = null )
| |
result:Point (default = null )
|
Point |
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. |