Skip to content

Commit

Permalink
fix pin with new dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Aug 9, 2024
1 parent f1d9d51 commit a6ccb24
Showing 1 changed file with 32 additions and 14 deletions.
46 changes: 32 additions & 14 deletions app/src/main/java/de/westnordost/streetcomplete/ui/common/Pin.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
package de.westnordost.streetcomplete.ui.common

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.absoluteOffset
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import de.westnordost.streetcomplete.R

Expand All @@ -17,19 +23,31 @@ fun Pin(
iconPainter: Painter,
modifier: Modifier = Modifier
) {
Box(modifier) {
Image(
painter = painterResource(R.drawable.pin),
contentDescription = null,
modifier = Modifier.size(66.dp)
)
Image(
painter = iconPainter,
contentDescription = null,
modifier = Modifier
.absoluteOffset(x = 20.dp, y = 7.dp)
.size(42.dp)
)
CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) {
Box(modifier) {
Image(
painter = painterResource(R.drawable.pin_shadow),
contentDescription = null,
modifier = Modifier
.padding(end = 10.dp, bottom = 71.dp)
.size(71.dp, 71.dp)
)
Image(
painter = painterResource(R.drawable.pin),
contentDescription = null,
modifier = Modifier
.padding(top = 5.dp)
.align(Alignment.TopCenter)
)
Image(
painter = iconPainter,
contentDescription = null,
modifier = Modifier
.padding(top = 7.dp)
.size(48.dp)
.align(Alignment.TopCenter)
)
}
}
}

Expand Down

0 comments on commit a6ccb24

Please sign in to comment.