-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Enable seamless forward and backward transition in VirtualizingCarouselPanel #14125
Fix: Enable seamless forward and backward transition in VirtualizingCarouselPanel #14125
Conversation
Changes the calculation of the "forward" flag for the page transition to enable seamless forward and backward transitions.
@dotnet-policy-service agree |
Added Check for more than 2 items in carousel as there is actually no way to determine the correct transition with only 2 items. If there are only 2 items the transition behaviour is not changed.
There is currently no way to calculate the correct transition direction when using only 2 items. So the fix only applies when using more than 2 items in a carousel. Description |
You can test this PR using the following package version. |
Added Unit Tests for cycling through list forward and backward
Maybe the carousel should be reworked to work with deltas? I think that's the only way to get a circular behavior. |
You can test this PR using the following package version. |
Thought about it. But how would you calculate the delta direction if the user changes But this will not solve the issue when using only 2 items as you have no idea what the user really wants. The only way to make this work correctly is to make |
In my opinion, the carousel, being a circular control, should have readonly selection properties and some kind of Anyway, I don't make decisions here, so someone from the core team will have to confirm what approach is preferred for the future. |
You can test this PR using the following package version. |
…arouselPanel (#14125) * Update VirtualizingCarouselPanel.cs Changes the calculation of the "forward" flag for the page transition to enable seamless forward and backward transitions. * Update VirtualizingCarouselPanel.cs Added Check for more than 2 items in carousel as there is actually no way to determine the correct transition with only 2 items. If there are only 2 items the transition behaviour is not changed. * Update VirtualizingCarouselPanelTests.cs Added Unit Tests for cycling through list forward and backward
What does the pull request do?
The calculation of the 'forward' flag has been changed. The change only applies when using more than 2 items in the carousel. If using only 2 items the flag is calculated as before.
What is the current behavior?
Currently the flag changes from forward to backward when transitioning from the last element to the first element in the item list and the flag changes from backward to forward when transitioning from the first item to the last item. The transition is not like a carousel but more like a linear stack.
What is the updated/expected behavior with this PR?
The transition direction does not change when transitioning from the first or last item when using more than 2 items. The transition is now seamless.
How was the solution implemented (if it's not obvious)?
When using more than 2 items it is checked if the
_transitionFromIndex
is the last one and the_realizedIndex
is the first or if the_transitionFromIndex
is the first and the_realizedIndex
is the last.Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes #14115