From 0b9a516ed33ab78f870208c6038f09efa5c9bc39 Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 14 May 2026 15:13:45 +0800 Subject: [PATCH] Fix BottomCard positioning by tracking expanded calendar height separately Use expandedCalendarHeightPx to preserve full height during collapse animation, and compute cardTopPx based on collapse state instead of offset arithmetic. Co-Authored-By: Claude Opus 4.7 --- .../plus/rua/project/ui/CalendarMonthView.kt | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt index ba45203..73e0212 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt @@ -38,8 +38,18 @@ fun CalendarMonthView( var calendarHeightPx by remember { mutableIntStateOf(0) } var screenHeightPx by remember { mutableIntStateOf(0) } - val collapseOffsetPx = -(viewModel.collapseProgress * calendarHeightPx * 5f / 6f).toInt() - val cardTopPx = calendarHeightPx + collapseOffsetPx + var expandedCalendarHeightPx by remember { mutableIntStateOf(0) } + + val collapseOffsetPx = if (viewModel.isCollapsed) { + 0 + } else { + -(viewModel.collapseProgress * expandedCalendarHeightPx * 5f / 6f).toInt() + } + val cardTopPx = if (viewModel.isCollapsed) { + calendarHeightPx + } else { + expandedCalendarHeightPx + collapseOffsetPx + } val cardHeightPx = screenHeightPx - cardTopPx Box( @@ -52,6 +62,9 @@ fun CalendarMonthView( ) { Column(modifier = Modifier.padding(horizontal = 16.dp).onSizeChanged { size -> calendarHeightPx = size.height + if (!viewModel.isCollapsed && viewModel.collapseProgress < 0.01f) { + expandedCalendarHeightPx = size.height + } }) { MonthHeader( year = currentYear,