Skip to content

Commit a47d694

Browse files
Added argument to the UpdateLayout method for the HSS/VSS to move to a new starting page
Resolves: #451
1 parent 9c7a59c commit a47d694

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Runtime/Scripts/Layout/HorizontalScrollSnap.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,21 @@ private void SetScrollContainerPosition()
223223
/// <summary>
224224
/// used for changing / updating between screen resolutions
225225
/// </summary>
226-
public void UpdateLayout()
226+
public void UpdateLayout(bool resetPositionToStart = false)
227227
{
228228
_lerp = false;
229229
DistributePages();
230+
231+
if (resetPositionToStart)
232+
{
233+
_currentPage = StartingScreen;
234+
}
235+
230236
if (MaskArea)
237+
{
231238
UpdateVisible();
239+
}
240+
232241
SetScrollContainerPosition();
233242
OnCurrentScreenChange(_currentPage);
234243
}

Runtime/Scripts/Layout/VerticalScrollSnap.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,21 @@ private void SetScrollContainerPosition()
218218
/// <summary>
219219
/// used for changing / updating between screen resolutions
220220
/// </summary>
221-
public void UpdateLayout()
221+
public void UpdateLayout(bool resetPositionToStart = false)
222222
{
223223
_lerp = false;
224224
DistributePages();
225-
if (MaskArea) UpdateVisible();
225+
226+
if (resetPositionToStart)
227+
{
228+
_currentPage = StartingScreen;
229+
}
230+
231+
if (MaskArea)
232+
{
233+
UpdateVisible();
234+
}
235+
226236
SetScrollContainerPosition();
227237
OnCurrentScreenChange(_currentPage);
228238
}

0 commit comments

Comments
 (0)