feat(ui/map): use second invisible circle layer for bigger hitbox

This commit is contained in:
Cilly Leang 2026-02-27 23:21:12 +11:00
parent b3f68d9e15
commit d3edabce36
Signed by: cilly
GPG key ID: 6500251E087653C9

View file

@ -11,6 +11,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
@ -158,6 +159,12 @@ fun Maps(
radius = const(3.dp), radius = const(3.dp),
strokeWidth = const(2.dp), strokeWidth = const(2.dp),
strokeColor = colorTypeExpression, strokeColor = colorTypeExpression,
)
CircleLayer(
id = "maps-stops0-clickhandler",
source = stopsSource,
color = const(Color.Transparent),
radius = const(12.dp),
onClick = { features -> onClick = { features ->
val feature = features[0] val feature = features[0]
val marker = Json.decodeFromJsonElement<MarkerProps>(feature.properties!!) val marker = Json.decodeFromJsonElement<MarkerProps>(feature.properties!!)