From 270346e6eff357633654e885500db6caefc91190 Mon Sep 17 00:00:00 2001 From: xfy Date: Fri, 15 May 2026 16:52:23 +0800 Subject: [PATCH] Lower collapse threshold to 25% for easier fold/unfold triggering Collapse triggers when progress > 0.25 (was 0.5). Expand triggers when progress < 0.75 (1 - threshold), creating asymmetric thresholds that make both fold and unfold easy to trigger with a short drag. Co-Authored-By: Claude Opus 4.7 --- .../commonMain/kotlin/plus/rua/project/CalendarViewModel.kt | 2 +- .../commonMain/kotlin/plus/rua/project/ui/CalendarUtils.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shared/src/commonMain/kotlin/plus/rua/project/CalendarViewModel.kt b/shared/src/commonMain/kotlin/plus/rua/project/CalendarViewModel.kt index 3cc09e7..980bc9c 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/CalendarViewModel.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/CalendarViewModel.kt @@ -102,7 +102,7 @@ class CalendarViewModel( val shouldExpand = when { velocityDpPerSec < -FLING_VELOCITY_THRESHOLD_DP -> true // 快速下滑→展开 velocityDpPerSec > FLING_VELOCITY_THRESHOLD_DP -> false // 快速上滑→保持折叠 - else -> progress < COLLAPSE_THRESHOLD // 慢速按 progress 判断 + else -> progress < 1f - COLLAPSE_THRESHOLD // 慢速按 progress 判断 } if (shouldExpand) { _collapseAnimatable.animateTo( diff --git a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarUtils.kt b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarUtils.kt index aec9c04..380643b 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarUtils.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarUtils.kt @@ -9,8 +9,8 @@ import kotlinx.datetime.plus /** 无限分页中心页,用于 HorizontalPager 的起始位置 */ const val START_PAGE = Int.MAX_VALUE / 2 -/** 折叠判定阈值:progress > 此值时折叠,< 此值时展开 */ -const val COLLAPSE_THRESHOLD = 0.5f +/** 折叠判定阈值:折叠时 progress > 此值触发,展开时 progress < (1-此值) 触发 */ +const val COLLAPSE_THRESHOLD = 0.25f /** 滑动偏移插值阈值:abs(offsetFraction) > 此值时启用插值 */ const val OFFSET_FRACTION_THRESHOLD = 0.01f