[fix] Too big cover

This commit is contained in:
acite
2025-10-01 23:04:16 +08:00
parent 200cf33e5a
commit 2c4d5d2366

View File

@@ -56,6 +56,7 @@ import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.min
import androidx.compose.ui.unit.sp
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
@@ -96,6 +97,7 @@ fun ComicGridView(
LaunchedEffect(Unit) {
comicGridViewModel.coverHeight = screenHeight * 0.4f
comicGridViewModel.maxHeight = screenHeight * 0.8f
}
val dens = LocalDensity.current
@@ -164,7 +166,7 @@ fun ComicGridView(
val width = drawable.width
val height = drawable.height
val aspectRatio = width.toFloat() / height.toFloat()
comicGridViewModel.maxHeight = screenWidth / aspectRatio
comicGridViewModel.maxHeight = min(screenWidth / aspectRatio, screenHeight * 0.8f)
if(comicGridViewModel.coverHeight > comicGridViewModel.maxHeight)
comicGridViewModel.coverHeight = comicGridViewModel.maxHeight