diff --git a/app/src/main/java/ru/spbu/depnav/ui/component/MarkerCluster.kt b/app/src/main/java/ru/spbu/depnav/ui/component/MarkerCluster.kt index acde468f..c26329b9 100644 --- a/app/src/main/java/ru/spbu/depnav/ui/component/MarkerCluster.kt +++ b/app/src/main/java/ru/spbu/depnav/ui/component/MarkerCluster.kt @@ -45,6 +45,7 @@ import ru.spbu.depnav.ui.theme.DEFAULT_PADDING /** Maximum size a marker cluster composable can have in each dimension. */ val MAX_MARKER_CLUSTER_VIEW_SIZE = 50.dp +/** Multiple markers clustered together. */ @Composable fun MarkersCluster( markerIds: List, diff --git a/app/src/main/java/ru/spbu/depnav/utils/map/Clustering.kt b/app/src/main/java/ru/spbu/depnav/utils/map/Clustering.kt index d9afd58b..e75327f5 100644 --- a/app/src/main/java/ru/spbu/depnav/utils/map/Clustering.kt +++ b/app/src/main/java/ru/spbu/depnav/utils/map/Clustering.kt @@ -38,6 +38,7 @@ private const val ELEVATOR_CLUSTERER_ID = "elevators" private const val WC_CLUSTERER_ID = "wcs" private const val OTHER_CLUSTERER_ID = "others" +/** Adds clusterers for each marker type group. */ @OptIn(ExperimentalClusteringApi::class) fun MapState.addClusterers() { val clusterAlphaState = derivedStateOf { getMarkerAlpha() } @@ -83,6 +84,7 @@ private fun createClusterFactory(alphaState: State, type: Marker.MarkerTy } } +/** Returns ID of the clustersr responsible for the specified marker type. */ fun getClustererId(markerType: Marker.MarkerType) = when (markerType) { Marker.MarkerType.ROOM -> ROOMS_CLUSTERER_ID Marker.MarkerType.ENTRANCE -> ENTRANCE_CLUSTERER_ID diff --git a/app/src/main/java/ru/spbu/depnav/utils/map/MarkerAlpha.kt b/app/src/main/java/ru/spbu/depnav/utils/map/MarkerAlpha.kt index e2ef8f67..a6d36654 100644 --- a/app/src/main/java/ru/spbu/depnav/utils/map/MarkerAlpha.kt +++ b/app/src/main/java/ru/spbu/depnav/utils/map/MarkerAlpha.kt @@ -8,6 +8,7 @@ import ovh.plrapps.mapcompose.ui.state.MapState private const val MARKERS_INVISIBLE_UNTIL_SCALE = 0.2f private const val MARKERS_FULLY_VISIBLE_FROM_SCALE = 0.5f +/** Returns alpha value to use for map markers calculated based on the current map scale. */ fun MapState.getMarkerAlpha(): Float { val minScale = minScale.coerceAtLeast(MARKERS_INVISIBLE_UNTIL_SCALE) val maxScale = maxScale.coerceAtMost(MARKERS_FULLY_VISIBLE_FROM_SCALE)