Class PageScroller
The PageScroller class manages scrolling within a PageSlider component. It handles user interaction for swiping between pages and snapping to the closest page on release.
Inheritance
System.Object
PageScroller
Implements
IBeginDragHandler
IEndDragHandler
Namespace: TS.PageSlider
Assembly: .dll
Syntax
public class PageScroller : MonoBehaviour, IBeginDragHandler, IEndDragHandler
Fields
OnPageChangeEnded
Event triggered when a page change ends. The event arguments are the index of the current page and the index of the new active page.
Declaration
public UnityEvent<int, int> OnPageChangeEnded
Field Value
| Type | Description |
|---|---|
| UnityEvent<int, int> |
OnPageChangeStarted
Declaration
public UnityEvent<int, int> OnPageChangeStarted
Field Value
| Type | Description |
|---|---|
| UnityEvent<int, int> |
Properties
Content
Gets the RectTransform of the content being scrolled within the ScrollRect.
Declaration
public RectTransform Content { get; }
Property Value
| Type | Description |
|---|---|
| RectTransform |
Rect
Gets the rectangle of the ScrollRect component used for scrolling.
Declaration
public Rect Rect { get; }
Property Value
| Type | Description |
|---|---|
| Rect |
Methods
OnBeginDrag(PointerEventData)
Declaration
public void OnBeginDrag(PointerEventData eventData)
Parameters
| Type | Name | Description |
|---|---|---|
| PointerEventData | eventData |
OnEndDrag(PointerEventData)
Declaration
public void OnEndDrag(PointerEventData eventData)
Parameters
| Type | Name | Description |
|---|---|---|
| PointerEventData | eventData |
SetPage(int)
Declaration
public void SetPage(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index |
Implements
IBeginDragHandler
IEndDragHandler