Clip pager to bounds during collapse animation to prevent content overflow
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
151b15d09e
commit
1c232762b1
@ -15,6 +15,7 @@ import androidx.compose.runtime.rememberCoroutineScope
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.draw.clipToBounds
|
||||||
import androidx.compose.ui.layout.onSizeChanged
|
import androidx.compose.ui.layout.onSizeChanged
|
||||||
import androidx.compose.ui.platform.LocalDensity
|
import androidx.compose.ui.platform.LocalDensity
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@ -66,6 +67,14 @@ fun CalendarMonthView(
|
|||||||
val cardTopPx = headerHeightPx + gridHeightPx
|
val cardTopPx = headerHeightPx + gridHeightPx
|
||||||
val cardHeightPx = screenHeightPx - cardTopPx
|
val cardHeightPx = screenHeightPx - cardTopPx
|
||||||
|
|
||||||
|
val pagerModifier = if (p > 0.01f && expandedGridHeightPx > 0) {
|
||||||
|
Modifier
|
||||||
|
.height(with(density) { gridHeightPx.toDp() })
|
||||||
|
.clipToBounds()
|
||||||
|
} else {
|
||||||
|
Modifier
|
||||||
|
}
|
||||||
|
|
||||||
if (p > 0f) {
|
if (p > 0f) {
|
||||||
println("[View] p=$p monthH=$monthHeaderHeightPx weekdayH=$weekdayHeaderHeightPx expandedGridH=$expandedGridHeightPx gridH=$gridHeightPx cardTop=$cardTopPx cardH=$cardHeightPx screenH=$screenHeightPx calH=$calendarHeightPx isCollapsed=${viewModel.isCollapsed}")
|
println("[View] p=$p monthH=$monthHeaderHeightPx weekdayH=$weekdayHeaderHeightPx expandedGridH=$expandedGridHeightPx gridH=$gridHeightPx cardTop=$cardTopPx cardH=$cardHeightPx screenH=$screenHeightPx calH=$calendarHeightPx isCollapsed=${viewModel.isCollapsed}")
|
||||||
}
|
}
|
||||||
@ -117,7 +126,8 @@ fun CalendarMonthView(
|
|||||||
currentYear = year
|
currentYear = year
|
||||||
currentMonth = month
|
currentMonth = month
|
||||||
},
|
},
|
||||||
collapseProgress = viewModel.collapseProgress
|
collapseProgress = viewModel.collapseProgress,
|
||||||
|
modifier = pagerModifier
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user