Skip to content

Commit 3a0e02b

Browse files
Update ScrollSnap docs
1 parent 0c6fd4d commit 3a0e02b

3 files changed

Lines changed: 67 additions & 7 deletions

File tree

Controls/HorizontalScrollSnap.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ A paged scroll rect that can work in steps / pages, includes button support. No
3131
A scroll snap style control which is focused on a horizontal layout, enabling a paged view of child elements.
3232
Pages can be moved by keys, swipes or via the use of buttons.
3333

34-
![](Images/HSSInspector.jpg)
34+
![Horizontal ScrollSnap Inspector](Images/HSSInspector.jpg)
3535

3636
Implements its own infinite scrolling method and additional events for when pages change.
3737

@@ -57,7 +57,7 @@ Property | Description
5757
*Mask Area*|Maskable area for control, pages outside this area will be made inactive. Used in conjunction with the Mask Buffer. Recommended to also add a RectMask2D to MaskArea GO.
5858
*Mask Buffer*|The amount of page buffer to surround the Mask Area and control which pages are active / inactive. Lower value equals more active pages.
5959
*Jump On Enable*|By default the container will lerp to the start when enabled in the scene, this option overrides this and forces it to simply jump without lerping
60-
*Restart On Enable*|By default the container will return to the original starting page when enabled, this option overrides this behaviour and stays on the current selection
60+
*Restart On Enable*|By default the container will stay on the current selection, this option overrides this behaviour and returns to the original starting page when enabled.
6161
*Use Parent Transform*|When using prefabs in the ChildObjects array, the control with use the prefab transform values instead of resetting to the parent.
6262
*Child Objects*|An array of prefabs to load the control with. Can EITHER add children in to the scene or via this array but NOT both.
6363
***On Selection Change Start*** (event) |The Event fired when the user starts changing the page via swipe or mouse
@@ -72,6 +72,21 @@ CurrentPage|int|The current snapped page, or selected page as the user swipes
7272

7373
---------
7474

75+
## Methods
76+
77+
Method | Arguments | Description
78+
|-|-|-|
79+
*DistributePages*|N/A|Forces a refresh of the currently available Scroll Snap Pages
80+
*Add Child*|Go (GameObject)|Add a new child to this Scroll Snap and recalculate its children
81+
*Add Child*|Go (GameObject), WorldPositionStays (bool)|Add a new child to this Scroll Snap and recalculate its children, and resets the world position of the new child.
82+
*Remove Child*|index (int), (out) ChildRemoved (GameObject)|Remove a new child to this Scroll Snap and recalculate its children, outputs the removed object to a variable.
83+
*Remove Child*|index (int), WorldPositionStays (bool), (out) ChildRemoved (GameObject)|Remove a new child to this Scroll Snap and recalculate its children, outputs the removed object to a variable. Resets the world position of the removed GameObject.
84+
*RemoveAllChildren*|(out) ChildrenRemoved (GameObject[])|Remove all children from this ScrollSnap, outputs a GameObject array of all removed children.
85+
*RemoveAllChildren*|WorldPositionStays (bool), (out) ChildrenRemoved (GameObject[])|Remove all children from this ScrollSnap, outputs a GameObject array of all removed children. Resets the world position for all removed children.
86+
*UpdateLayout*|N/A|Used for changing / updating between screen resolutions
87+
88+
---------
89+
7590
## Usage
7691

7792
Like with other Layout controls, simply add this to the parent RectTransform for a collection of child elements through the Add Component menu as follows:

Controls/ScrollSnap.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# ScrollSnap
22

3-
An alternate scroll snap control supporting both Horizontal and Vertial layous in one control
4-
5-
<!--![](Images/ Game Image.jpg)-->
3+
An alternate scroll snap control supporting both Horizontal and Vertical layouts in one control
64

75
---------
86

@@ -35,6 +33,38 @@ Pages can be moved by keys, swipes or via the use of buttons.
3533

3634
---------
3735

36+
## Properties
37+
38+
The properties of the Horizontal Scroll Snap control are as follows:
39+
40+
Property | Description
41+
|-|-|
42+
*Next Button*|Optional button to move the ScrollSnap forward.
43+
*Prev Button*|Optional button to move the ScrollSnap backward.
44+
*Items Visible at once*|How many items should be visible at the same time.
45+
*Auto Layout Items*|Should the ScrollSnap contents be automatically aligned, or left untouched.
46+
*Link Scrollbar Steps*|Use the base ScrollRect steps configuration for the ScrollSnap.
47+
*Link Scrollbar Scroll Sensitivity*|Use the base ScrollRect scroll sensitivity configuration for the ScrollSnap.
48+
*Use Fast Swipe*|Should "Fast Swipe" be used to progress pages.
49+
*Fast Swipe Threshold*|The speed of the ScrollSnap is moving before a "Fast Swipe" motion is detected.
50+
*Direction*|The direction the ScrollSnap flows in, Horizontal or Vertical.
51+
***On Page Change*** (event) |The Event fired when the current page changes, either via swipe, mouse, Next/Prev Buttons
52+
53+
---------
54+
55+
## Methods
56+
57+
Method | Arguments | Description
58+
|-|-|-|
59+
*ChangePage*|Index (int)|Move the ScrollSNap to a specific page (0 indexed)
60+
*CurrentPage*|None|Returns the Current Page selected for the ScrollSnap
61+
*NextScreen*|None|Forces the control to move to the "Next" page
62+
*PreviousScreen*|None|Forces the control to move to the "Previous" page
63+
*ResetPage*|None|Resets the currently selected page to the starting page, usually page 0
64+
*SetLerp*|value (bool)|Enable or disable smooth Lerp movement
65+
66+
---------
67+
3868
## Usage
3969

4070
Like with other Layout controls, simply add this to the parent RectTransform for a collection of child elements through the Add Component menu as follows:

Controls/VerticalScrollSnap.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ A paged scroll rect that can work in steps / pages, includes button support. No
3131
A scroll snap style control which is focused on a Vertical layout, enabling a paged view of child elements.
3232
Pages can be moved by keys, swipes or via the use of buttons.
3333

34-
![](Images/VSSInspector.jpg)
34+
![Vertical Scroll Snap Inspector](Images/VSSInspector.jpg)
3535

3636
Now also supports infinite scrolling and additional events for when pages change.
3737

@@ -57,7 +57,7 @@ Property | Description
5757
*Mask Area*|Maskable area for control, pages outside this area will be made inactive. Used in conjunction with the Mask Buffer. Recommended to also add a RectMask2D to MaskArea GO.
5858
*Mask Buffer*|The amount of page buffer to surround the Mask Area and control which pages are active / inactive. Lower value equals more active pages.
5959
*Jump On Enable*|By default the container will lerp to the start when enabled in the scene, this option overrides this and forces it to simply jump without lerping
60-
*Restart On Enable*|By default the container will return to the original starting page when enabled, this option overrides this behaviour and stays on the current selection
60+
*Restart On Enable*|By default the container will stay on the current selection, this option overrides this behaviour and returns to the original starting page when enabled.
6161
*Use Parent Transform*|When using prefabs in the ChildObjects array, the control with use the prefab transform values instead of resetting to the parent.
6262
*Child Objects*|An array of prefabs to load the control with. Can EITHER add children in to the scene or via this array but NOT both.
6363
*On Selection Change Start* (event) |The Event fired when the user starts changing the page via swipe or mouse
@@ -72,6 +72,21 @@ CurrentPage|int|The current snapped page, or selected page as the user swipes
7272

7373
---------
7474

75+
## Methods
76+
77+
Method | Arguments | Description
78+
|-|-|-|
79+
*DistributePages*|N/A|Forces a refresh of the currently available Scroll Snap Pages
80+
*Add Child*|Go (GameObject)|Add a new child to this Scroll Snap and recalculate its children
81+
*Add Child*|Go (GameObject), WorldPositionStays (bool)|Add a new child to this Scroll Snap and recalculate its children, and resets the world position of the new child.
82+
*Remove Child*|index (int), (out) ChildRemoved (GameObject)|Remove a new child to this Scroll Snap and recalculate its children, outputs the removed object to a variable.
83+
*Remove Child*|index (int), WorldPositionStays (bool), (out) ChildRemoved (GameObject)|Remove a new child to this Scroll Snap and recalculate its children, outputs the removed object to a variable. Resets the world position of the removed GameObject.
84+
*RemoveAllChildren*|(out) ChildrenRemoved (GameObject[])|Remove all children from this ScrollSnap, outputs a GameObject array of all removed children.
85+
*RemoveAllChildren*|WorldPositionStays (bool), (out) ChildrenRemoved (GameObject[])|Remove all children from this ScrollSnap, outputs a GameObject array of all removed children. Resets the world position for all removed children.
86+
*UpdateLayout*|N/A|Used for changing / updating between screen resolutions
87+
88+
---------
89+
7590
## Usage
7691

7792
Like with other Layout controls, simply add this to the parent RectTransform for a collection of child elements through the Add Component menu as follows:

0 commit comments

Comments
 (0)