diff options
author | Allan Wang <me@allanwang.ca> | 2021-11-18 14:45:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 14:45:22 -0800 |
commit | 4c06d0ae4a4b2c8450ec68dd9b64d472cdd0202d (patch) | |
tree | 859d3dc7021d31f807c5ad90ddea31f711fa793d /core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt | |
parent | e2ac8e3e82b842ea05c8c7a2c92d566553d8ea91 (diff) | |
parent | a9b8b69ab5e053e9106a98564e3a4047628387d6 (diff) | |
download | kau-4c06d0ae4a4b2c8450ec68dd9b64d472cdd0202d.tar.gz kau-4c06d0ae4a4b2c8450ec68dd9b64d472cdd0202d.tar.bz2 kau-4c06d0ae4a4b2c8450ec68dd9b64d472cdd0202d.zip |
Merge pull request #270 from AllanWang/versions6.4.0
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt b/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt index e3baa94..78bf253 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/swipe/RelativeSlider.kt @@ -48,14 +48,18 @@ internal class RelativeSlider(var curPage: SwipeBackPage) : SwipeListener { return } when (edgeFlag) { - SWIPE_EDGE_LEFT -> page.swipeBackLayout.x = - min(-offset * max(1 - percent, 0f) + DEFAULT_OFFSET, 0f) - SWIPE_EDGE_RIGHT -> page.swipeBackLayout.x = - min(offset * max(1 - percent, 0f) - DEFAULT_OFFSET, 0f) - SWIPE_EDGE_TOP -> page.swipeBackLayout.y = - min(-offset * max(1 - percent, 0f) + DEFAULT_OFFSET, 0f) - SWIPE_EDGE_BOTTOM -> page.swipeBackLayout.y = - min(offset * max(1 - percent, 0f) - DEFAULT_OFFSET, 0f) + SWIPE_EDGE_LEFT -> + page.swipeBackLayout.x = + min(-offset * max(1 - percent, 0f) + DEFAULT_OFFSET, 0f) + SWIPE_EDGE_RIGHT -> + page.swipeBackLayout.x = + min(offset * max(1 - percent, 0f) - DEFAULT_OFFSET, 0f) + SWIPE_EDGE_TOP -> + page.swipeBackLayout.y = + min(-offset * max(1 - percent, 0f) + DEFAULT_OFFSET, 0f) + SWIPE_EDGE_BOTTOM -> + page.swipeBackLayout.y = + min(offset * max(1 - percent, 0f) - DEFAULT_OFFSET, 0f) } } |