Repository navigation
Conversation
SimonDarksideJ
previously approved these changes
Dec 1, 2026
Contributor
|
@Labu1 , new work needs to target the |
ScrollSnap calculated its page anchor positions and the current page using only the item size, ignoring the spacing of a Horizontal or Vertical Layout Group on the list container. With any spacing set, each page snapped short by an extra spacing amount, so the error grew with every page. Read the spacing from the container's HorizontalOrVerticalLayoutGroup (if present) and use item size + spacing as the per-page step for both the anchor positions and CurrentPage(). Behaviour is unchanged when no layout group or zero spacing is used. Fixes Unity-UI-Extensions#313.
Labu1
force-pushed
the
repodestek/issue-313
branch
from
December 3, 2026 06:51
b728f7c to
9016efc
Compare
Author
|
@SimonDarksideJ Thanks for retargeting it. I rebuilt the branch on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unity UI Extensions - Pull Request
Overview
ScrollSnap did not snap to the correct positions when the list container had a Horizontal/Vertical Layout Group with
spacingset. The page anchor positions (and theCurrentPage()calculation) stepped by the item size only, so every page was off by an extra spacing amount, accumulating with each page.This change reads the spacing from the list container's
HorizontalOrVerticalLayoutGroup(when present) and usesitemSize + spacingas the per-page step for both the anchor positions and the current page calculation. When there is no layout group, or spacing is 0, behaviour is identical to before.Changes
ScrollSnap: include layout group spacing in page anchor positions andCurrentPage()(guarded against a non-positive step).Breaking Changes
Related Submodule Changes
Testing status
No automated test command was detected, so tests were not run.
Manual testing status
Not manually verified in the Unity editor as part of this PR. Suggested check: a ScrollSnap with a Horizontal (or Vertical) Layout Group on the content, spacing e.g. 20, several items; use Next/Prev buttons and swipes and confirm each page aligns to the viewport edge.
This PR was prepared with AI assistance (Claude) and reviewed by me before submitting.