IVariableVirtualLayout
public interface
feathers.layout.IVariableVirtualLayout
Description
A virtual layout that supports variable item dimensions.
API overview
Constructor
Attributes
Public attributes
| hasVariableItemDimensions: Boolean |
When the layout is virtualized, and this value is true, the items may have variable dimensions |
Functions
Public functions
| addToVariableVirtualCacheAtIndex ( index: Number , item: DisplayObject = null ): Void |
Inserts an item in to the cache at the specified index, pushing the old cached value at that index, and all following values, up one index |
| removeFromVariableVirtualCacheAtIndex ( index: Number ): Void |
Removes an item in to the cache at the specified index, moving the values at following indexes down by one |
| resetVariableVirtualCache (): Void |
Clears the cached dimensions for all virtualized indices |
| resetVariableVirtualCacheAtIndex ( index: Number , item: DisplayObject = null ): Void |
Clears the cached dimensions for one specific virtualized index |
Constructor
IVariableVirtualLayout ()
Attributes
hasVariableItemDimensions: Boolean
When the layout is virtualized, and this value is true, the items may have variable dimensions. If false, the items will all share the same dimensions as the typical item. Performance is better for layouts where all items have the same dimensions.
typicalItemHeight: Number
Inherited from IVirtualLayout
The height, in pixels, of a "typical" item that is used to virtually
fill in blanks for the layout. This value is usually set by a
component that is using the layout, such as a List. For
instance, the List class provides a typicalItem
property that will be used to calculate this value. If you set
typicalItemHeight manually, your value will be completely
replaced by the value calculated by the List. In other
words, you should use that typicalItem property instead.
typicalItemWidth: Number
Inherited from IVirtualLayout
The width, in pixels, of a "typical" item that is used to virtually
fill in blanks for the layout. This value is meant to be set by a
component that is using the layout, such as a List. For
instance, the List class provides a typicalItem
property that will be used to calculate this value. If you set
typicalItemWidth manually, your value will be completely
replaced by the value calculated by the List. In other
words, you should use that typicalItem property instead.
useVirtualLayout: Boolean
Inherited from IVirtualLayout
Determines if virtual layout can be used. Some components don't support virtual layouts. In those cases, the virtual layout options will be ignored.
Functions
addEventListener
(
type: String
,
listener: Function
): Void
Inherited from IFeathersEventDispatcher
See also:
loom2d.events.EventDispatcher#addEventListener()
Parameters
| type: String | |
| listener: Function |
addToVariableVirtualCacheAtIndex ( index: Number , item: DisplayObject = null ): Void
Inserts an item in to the cache at the specified index, pushing the old cached value at that index, and all following values, up one index.
Parameters
| index: Number | |
| item: DisplayObject = null |
dispatchEvent
(
event: Event
): Void
Inherited from IFeathersEventDispatcher
See also:
loom2d.events.EventDispatcher#dispatchEvent()
Parameters
| event: Event |
dispatchEventWith
(
type: String
,
bubbles: Boolean
= false
,
data: Object
= null
): Void
Inherited from IFeathersEventDispatcher
See also:
loom2d.events.EventDispatcher#dispatchEventWith()
Parameters
| type: String | |
| bubbles: Boolean = false | |
| data: Object = null |
getScrollPositionForIndex
(
index: Number
,
items: Vector.<DisplayObject>
,
x: Number
,
y: Number
,
width: Number
,
height: Number
): Point
Inherited from ILayout
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.
Parameters
| index: Number | |
| items: Vector.<DisplayObject> | |
| x: Number | |
| y: Number | |
| width: Number | |
| height: Number |
getVisibleIndicesAtScrollPosition
(
scrollX: Number
,
scrollY: Number
,
width: Number
,
height: Number
,
itemCount: Number
,
result: Vector.<Number>
= null
): Vector.<Number>
Inherited from IVirtualLayout
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.
Parameters
| scrollX: Number | |
| scrollY: Number | |
| width: Number | |
| height: Number | |
| itemCount: Number | |
| result: Vector.<Number> = null |
hasEventListener
(
type: String
): Boolean
Inherited from IFeathersEventDispatcher
See also:
loom2d.events.EventDispatcher#hasEventListener()
Parameters
| type: String |
layout
(
items: Vector.<DisplayObject>
,
viewPortBounds: ViewPortBounds
= null
,
result: LayoutBoundsResult
= null
): LayoutBoundsResult
Inherited from ILayout
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();
}
}
See also:
feathers.core.IFeathersControl#validate()
Parameters
| items: Vector.<DisplayObject> | |
| viewPortBounds: ViewPortBounds = null | |
| result: LayoutBoundsResult = null |
measureViewPort
(
itemCount: Number
,
viewPortBounds: ViewPortBounds
= null
): Point
Inherited from IVirtualLayout
Using the typical item bounds and suggested bounds, returns a set of calculated dimensions for the view port.
Parameters
| itemCount: Number | |
| viewPortBounds: ViewPortBounds = null |
removeEventListener
(
type: String
,
listener: Function
): Void
Inherited from IFeathersEventDispatcher
See also:
loom2d.events.EventDispatcher#removeEventListener()
Parameters
| type: String | |
| listener: Function |
removeEventListeners
(
type: String
= null
): Void
Inherited from IFeathersEventDispatcher
See also:
loom2d.events.EventDispatcher#removeEventListeners()
Parameters
| type: String = null |
removeFromVariableVirtualCacheAtIndex ( index: Number ): Void
Removes an item in to the cache at the specified index, moving the values at following indexes down by one.
Parameters
| index: Number |
resetVariableVirtualCacheAtIndex ( index: Number , item: DisplayObject = null ): Void
Clears the cached dimensions for one specific virtualized index.
Parameters
| index: Number | |
| item: DisplayObject = null |