diff --git a/Core2/Onboarding/src/main/java/com/infomaniak/library/onboarding/HorizontalPagerIndicator.kt b/Core2/Onboarding/src/main/java/com/infomaniak/library/onboarding/HorizontalPagerIndicator.kt index 81342cfc03..3dc54f4d0a 100644 --- a/Core2/Onboarding/src/main/java/com/infomaniak/library/onboarding/HorizontalPagerIndicator.kt +++ b/Core2/Onboarding/src/main/java/com/infomaniak/library/onboarding/HorizontalPagerIndicator.kt @@ -80,7 +80,9 @@ private fun computeIndicatorProperties( } private fun computePageProgresses(index: Int, pagerState: PagerState): Pair { - // Extended offset fraction of the current page relative to the screen + // Extended offset fraction of the current page relative to the screen. It's as if pagerState.currentPageOffsetFraction went + // beyond -0.5 up to -1 and beyond 0.5 up to 1 + // // Range: [-1, 1] // 0: Page is centered on the screen // -1: Page is completely off-screen to the left @@ -100,10 +102,10 @@ private fun computePageProgresses(index: Int, pagerState: PagerState): Pair 1f } - // Progress of the page visibility + // Progress of the page visibility i.e. what fraction of the page is currently visible // Range: [0, 1] // 0: Page is completely off-screen - // 1: Page is fully centered on the screen + // 1: Page is fully centered on the screen and therefore fully visible val pageVisibilityProgress = 1 - abs(extendedCurrentPageOffsetFraction) return extendedCurrentPageOffsetFraction to pageVisibilityProgress