Skip to content

Commit

Permalink
Add missing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPushkin committed Oct 31, 2023
1 parent a8f5219 commit 3f39b8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/ru/spbu/depnav/utils/map/Clustering.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
Expand Down Expand Up @@ -83,6 +84,7 @@ private fun createClusterFactory(alphaState: State<Float>, 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
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/ru/spbu/depnav/utils/map/MarkerAlpha.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3f39b8f

Please sign in to comment.