Fix icon scaling

This commit is contained in:
MM20 2023-05-22 21:31:33 +02:00
parent 0ecc9420c0
commit 875043c214
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -19,6 +19,7 @@ import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.GenericShape
@ -165,7 +166,7 @@ fun ShapedLauncherIcon(
if (bmp != null && ic != null) {
Canvas(
modifier = Modifier
.size(defaultIconSize)
.requiredSize(defaultIconSize)
.scale(size / defaultIconSize, TransformOrigin.Center)
) {
val brush = BitmapShaderBrush(bmp)
@ -230,8 +231,7 @@ fun ShapedLauncherIcon(
val color = MaterialTheme.colorScheme.secondaryContainer
Canvas(
modifier = Modifier
.size(defaultIconSize)
.scale(size / defaultIconSize, TransformOrigin.Center)
.fillMaxSize()
) {
val outline =
shape.createOutline(this.size, layoutDirection, Density(density, fontScale))