Class ScrollingObjectCollection
A set of child objects organized in a series of Rows/Columns that can scroll in either the X or Y direction.
Implements
Namespace: Microsoft.MixedReality.Toolkit.Experimental.UI
Assembly: cs.temp.dll.dll
Syntax
public class ScrollingObjectCollection : BaseObjectCollection, IMixedRealityPointerHandler, IMixedRealityTouchHandler, IMixedRealitySourceStateHandler, IMixedRealityInputHandler
Fields
ClickEvent
Event that is fired on the target object when the ScrollingObjectCollection deems event as a Click.
Declaration
public ScrollingObjectCollection.ScrollEvent ClickEvent
Field Value
Type | Description |
---|---|
ScrollingObjectCollection.ScrollEvent |
ListMomentumEnded
Event that is fired on the target object when the ScrollingObjectCollection is no longer in motion from velocity
Declaration
public UnityEvent ListMomentumEnded
Field Value
Type | Description |
---|---|
UnityEvent |
TouchEnded
Event that is fired on the target object when the ScrollingObjectCollection is no longer touched.
Declaration
public ScrollingObjectCollection.ScrollEvent TouchEnded
Field Value
Type | Description |
---|---|
ScrollingObjectCollection.ScrollEvent |
TouchStarted
Event that is fired on the target object when the ScrollingObjectCollection is touched.
Declaration
public ScrollingObjectCollection.ScrollEvent TouchStarted
Field Value
Type | Description |
---|---|
ScrollingObjectCollection.ScrollEvent |
Properties
AnimationLength
The amount of time (in seconds) the PaginationCurve will take to evaluate.
Declaration
public float AnimationLength { get; set; }
Property Value
Type | Description |
---|---|
Single |
BounceMultiplier
Multiplier to add more bounce to the overscroll of a list when using FalloffPerFrame or FalloffPerItem.
Declaration
public float BounceMultiplier { get; set; }
Property Value
Type | Description |
---|---|
Single |
CanScroll
Enables/disables scrolling with near/far interaction.
Declaration
public bool CanScroll { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Helpful for controls where you may want pagination or list movement without freeform scrolling.
CellHeight
Height of the cell per object in the collection.
Declaration
public float CellHeight { get; set; }
Property Value
Type | Description |
---|---|
Single |
CellWidth
Width of the cell per object in the collection.
Declaration
public float CellWidth { get; set; }
Property Value
Type | Description |
---|---|
Single |
ClipBox
The ScrollingObjectCollection's ClippingBox that is used for clipping items in and out of the list.
Declaration
public ClippingBox ClipBox { get; }
Property Value
Type | Description |
---|---|
ClippingBox |
ClippingObject
The empty GameObject containing the ScrollingObjectCollection's ClippingBox.
Declaration
public GameObject ClippingObject { get; }
Property Value
Type | Description |
---|---|
GameObject |
DisableClippedItems
Declaration
public bool DisableClippedItems { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
DragTimeThreshold
Seconds the user's pointer can intersect a controller item before it is considered a drag.
Declaration
public float DragTimeThreshold { get; set; }
Property Value
Type | Description |
---|---|
Single |
FirstItemInViewIndex
First item (visible) in the ViewableArea.
Declaration
public int FirstItemInViewIndex { get; }
Property Value
Type | Description |
---|---|
Int32 |
HandDeltaMagThreshold
The distance the user's pointer can make before its considered a drag.
Declaration
public float HandDeltaMagThreshold { get; set; }
Property Value
Type | Description |
---|---|
Single |
OcclusionPositionPadding
Manual offset adjust the position calculation of the ClippingBox.
Declaration
public Vector3 OcclusionPositionPadding { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
OcclusionScalePadding
Manual offset adjust the scale calculation of the ClippingBox.
Declaration
public Vector3 OcclusionScalePadding { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Remarks
Setting to zero may result in z fighting."
PaginationCurve
Animation curve used to interpolate the pagination and movement methods.
Declaration
public AnimationCurve PaginationCurve { get; set; }
Property Value
Type | Description |
---|---|
AnimationCurve |
ScrollDirection
The direction in which content should scroll.
Declaration
public ScrollingObjectCollection.ScrollDirectionType ScrollDirection { get; set; }
Property Value
Type | Description |
---|---|
ScrollingObjectCollection.ScrollDirectionType |
SetUpAtRuntime
Automatically set up scroller at runtime.
Declaration
public bool SetUpAtRuntime { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Tiers
Number of columns or rows in respect to ViewableArea and ScrollDirection.
Declaration
public int Tiers { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
TypeOfVelocity
The desired type of velocity for the scroller.
Declaration
public ScrollingObjectCollection.VelocityType TypeOfVelocity { get; set; }
Property Value
Type | Description |
---|---|
ScrollingObjectCollection.VelocityType |
UseNearScrollBoundary
Determines whether a near scroll gesture is released when the engaged fingertip is dragged outside of the viewable area.
Declaration
public bool UseNearScrollBoundary { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
UseOnPreRender
Toggles whether the ScrollingObjectCollection" will use the Camera OnPreRender event to hide items in the list. The fallback is MonoBehaviour.LateUpdate().
Declaration
public bool UseOnPreRender { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
This is especially helpful if you're trying to scroll dynamically created objects that may be added to the list after LateUpdate,
VelocityDampen
Amount of drag applied to velocity.
Declaration
public float VelocityDampen { get; set; }
Property Value
Type | Description |
---|---|
Single |
Remarks
This can't be 0.0f since that won't allow ANY velocity - set TypeOfVelocity to None. It can't be 1.0f since that won't allow ANY drag.
VelocityMultiplier
Amount of (extra) velocity to be applied to scroller.
Declaration
public float VelocityMultiplier { get; set; }
Property Value
Type | Description |
---|---|
Single |
Remarks
Helpful if you want a small movement to fling the list.
ViewableArea
Number of lines visible in scroller. Orthogonal to Microsoft.MixedReality.Toolkit.Experimental.UI.ScrollingObjectCollection.tiers.
Declaration
public int ViewableArea { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
IsItemVisible(Int32)
Checks whether the given item is visible in the list
Declaration
public bool IsItemVisible(int indexOfItem)
Parameters
Type | Name | Description |
---|---|---|
Int32 | indexOfItem | the index of the item in the list |
Returns
Type | Description |
---|---|
Boolean | true when item is visible |
LayoutChildren()
Arranges our child objects in the scrollContainer per our set up instructions The layout method uses modulo with Columns / Rows
Declaration
protected override void LayoutChildren()
ModuloCheck(Int32, Int32)
Helper to get the remainder from an itemindex in the list in relation to rows/columns
Declaration
public static int ModuloCheck(int itemIndex, int divisor)
Parameters
Type | Name | Description |
---|---|---|
Int32 | itemIndex | Index of node item in NodeList to be compared |
Int32 | divisor | Rows / Columns |
Returns
Type | Description |
---|---|
Int32 | The remainder from the divisor |
MoveByItems(Int32, Boolean, Action)
Moves scroller a relative number of items
Declaration
public void MoveByItems(int numberOfItemsToMove, bool animateToPosition = true, Action callback = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | numberOfItemsToMove | number of items to move by |
Boolean | animateToPosition | if true, scroller will animate to new position |
Action | callback | An optional action to pass in to get notified that the ScrollingObjectCollection is finished moving |
MoveByLines(Int32, Boolean, Action)
Moves scroller a relative number of Tiers of items.
Declaration
public void MoveByLines(int numberOfLinesToMove, bool animateToPosition = true, Action callback = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | numberOfLinesToMove | number of lines to move by |
Boolean | animateToPosition | if true, scroller will animate to new position |
Action | callback | An optional action to pass in to get notified that the ScrollingObjectCollection is finished moving |
MoveTo(Int32, Boolean, Action)
Moves scroller to an absolute position where indexOfItem is in the first column of the viewable area
Declaration
public void MoveTo(int indexOfItem, bool animateToPosition = true, Action callback = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | indexOfItem | Item to move to, will be first (or closest to in respect to scroll maximum) in viewable area |
Boolean | animateToPosition | if true, scroller will animate to new position |
Action | callback | An optional action to pass in to get notified that the ScrollingObjectCollection is finished moving |
PageBy(Int32, Boolean, Action)
Moves scroller by a multiplier of ViewableArea
Declaration
public void PageBy(int numOfPages, bool animateToPage = true, Action callback = null)
Parameters
Type | Name | Description |
---|---|---|
Int32 | numOfPages | number of ViewableArea to move scroller by |
Boolean | animateToPage | if true, scroller will animate to new position |
Action | callback | An optional action to pass in to get notified that the ScrollingObjectCollection is finished moving |
StepMultiplier(Int32, Int32)
Helper to get the number of rows / columns deep the item is
Declaration
public static int StepMultiplier(int itemIndex, int divisor)
Parameters
Type | Name | Description |
---|---|---|
Int32 | itemIndex | Index of node item in NodeList to be compared |
Int32 | divisor | Rows / Columns |
Returns
Type | Description |
---|---|
Int32 | The multiplier to get the row / column index the item is in |
TimeTest(Single, Single, Single)
Simple time threshold check
Declaration
public static bool TimeTest(float initTime, float currTime, float pressMargin)
Parameters
Type | Name | Description |
---|---|---|
Single | initTime | Initial time |
Single | currTime | Current time |
Single | pressMargin | Time threshold |
Returns
Type | Description |
---|---|
Boolean | true if amount of time surpasses |
TryGetObjectAlignedBoundsSize(Transform, out Vector3)
Finds the object-aligned size of a Transform.
Declaration
public static bool TryGetObjectAlignedBoundsSize(Transform obj, out Vector3 alignedSize)
Parameters
Type | Name | Description |
---|---|---|
Transform | obj | Transform representing the object to get offset from |
Vector3 | alignedSize | the object-aligned size of obj |
Returns
Type | Description |
---|---|
Boolean | true if alignedSize is valid |
UpdateCollection()
Declaration
public override void UpdateCollection()