refactor: 折叠态切换年视图保持折叠形态,移除多余的展开过渡
原先折叠态切年视图会先展开回月视图再切换,多了一段冗余动画; 现在折叠态直接以折叠形态参与缩放转场,从年视图返回时仍保留周视图状态。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ba742f1597
commit
57f61987df
@ -108,7 +108,8 @@ class CalendarViewModel(
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换年视图。仅在展开态可用。
|
||||
* 切换年视图。折叠态下保持折叠(`isCollapsed` 不变),
|
||||
* 月视图层以折叠形态参与缩放转场;从年视图返回时仍是周视图。
|
||||
*
|
||||
* 切换瞬间立即翻转 isYearView,让对应方向的目标视图立刻接管渲染,
|
||||
* 当前视图被直接移除;动画只作用在目标视图的 scale/alpha 上。
|
||||
@ -116,13 +117,6 @@ class CalendarViewModel(
|
||||
fun toggleYearView() {
|
||||
yearViewJob?.cancel()
|
||||
yearViewJob = coroutineScope.launch {
|
||||
// 折叠态先展开回月视图,再切换年视图
|
||||
if (isCollapsed) {
|
||||
_collapseAnimatable.animateTo(
|
||||
0f, spring(dampingRatio = 0.8f, stiffness = 400f)
|
||||
)
|
||||
isCollapsed = false
|
||||
}
|
||||
if (isYearView) {
|
||||
// 年 → 月:先启动动画(年视图开始淡出),等一帧后翻转 isYearView(月视图开始组合)
|
||||
composeTraceBeginSection("YearView→MonthView")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user