Improve window resize behaviour

This commit is contained in:
2025-04-28 05:29:16 +02:00
parent 53c535e127
commit d02043bbdb

View File

@@ -24,6 +24,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.shadow
@@ -78,17 +79,19 @@ fun App(modifier: Modifier = Modifier) {
Box(modifier = modifier) {
Row(modifier = Modifier.blurOnFinished(isSolved)) {
PuzzleGrid(
modifier = Modifier
.aspectRatio(1f)
.weight(0.6f)
.fillMaxHeight(),
grid = game.grid,
onUpdate = {
horizontalClues.forEach { it.update(game.grid) }
verticalClues.forEach { it.update(game.grid) }
}
)
Column(modifier = Modifier.weight(0.6f)) {
PuzzleGrid(
modifier = Modifier
.aspectRatio(1f)
.fillMaxWidth()
.align(Alignment.CenterHorizontally),
grid = game.grid,
onUpdate = {
horizontalClues.forEach { it.update(game.grid) }
verticalClues.forEach { it.update(game.grid) }
}
)
}
Column(
modifier = Modifier.padding(start = 16.dp).weight(0.4f).fillMaxHeight()
) {
@@ -299,42 +302,3 @@ fun ClueCard(
content()
}
}
//fun Modifier.advanceShadow(
// color: Color = Color.Black,
// borderRadius: Dp = 16.dp,
// blurRadius: Dp = 16.dp,
// offsetY: Dp = 0.dp,
// offsetX: Dp = 0.dp,
// spread: Float = 1f,
//) = drawBehind {
// this.drawIntoCanvas {
// val paint = Paint()
// val frameworkPaint = paint.asFrameworkPaint()
// val spreadPixel = spread.dp.toPx()
// val leftPixel = (0f - spreadPixel) + offsetX.toPx()
// val topPixel = (0f - spreadPixel) + offsetY.toPx()
// val rightPixel = (this.size.width)
// val bottomPixel = (this.size.height + spreadPixel)
//
// if (blurRadius != 0.dp) {
// /*
// The feature maskFilter used below to apply the blur effect only works
// with hardware acceleration disabled.
// */
// frameworkPaint.maskFilter =
// BlurEffect(blurRadius.toPx(), blurRadius.toPx())
// }
//
// frameworkPaint.color = color.toArgb()
// it.drawRoundRect(
// left = leftPixel,
// top = topPixel,
// right = rightPixel,
// bottom = bottomPixel,
// radiusX = borderRadius.toPx(),
// radiusY = borderRadius.toPx(),
// paint
// )
// }
//}