Skip to content

Commit aba8b49

Browse files
Align recall button color to marker color or selected zoom out color
1 parent d532eec commit aba8b49

1 file changed

Lines changed: 12 additions & 19 deletions

File tree

  • lib-compose/src/main/java/com/what3words/components/compose/maps

lib-compose/src/main/java/com/what3words/components/compose/maps/W3WMapManager.kt

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,27 +1605,20 @@ class W3WMapManager(
16051605
private suspend fun updateRecallButtonColor() {
16061606
withContext(dispatcher) {
16071607
val selectedLatLng = getSelectedAddress()?.center ?: return@withContext
1608-
1609-
val markersAtSelectedSquare =
1610-
getMarkersAt(selectedLatLng)
1611-
1612-
val markerSlashColor = if (markersAtSelectedSquare.size == 1) {
1613-
markersAtSelectedSquare.first().marker.color.slash
1614-
} else {
1615-
Color.White
1616-
}
1617-
1618-
val markerBackgroundColor = if (markersAtSelectedSquare.size == 1) {
1619-
markersAtSelectedSquare.first().marker.color.background
1620-
} else {
1621-
Color(0xFFE11F26) // TODO: Define name for this color
1608+
val markersAtSelectedSquare = getMarkersAt(selectedLatLng)
1609+
val markerColor = when (markersAtSelectedSquare.size) {
1610+
0 -> mapConfig?.markerConfig?.selectedZoomOutColor
1611+
1 -> markersAtSelectedSquare.first().marker.color
1612+
else -> mapConfig?.markerConfig?.defaultMarkerColor
16221613
}
16231614

1624-
_buttonState.update {
1625-
it.copy(
1626-
recallArrowColor = markerSlashColor,
1627-
recallBackgroundColor = markerBackgroundColor
1628-
)
1615+
markerColor?.let { color ->
1616+
_buttonState.update {
1617+
it.copy(
1618+
recallArrowColor = color.slash,
1619+
recallBackgroundColor = color.background,
1620+
)
1621+
}
16291622
}
16301623
}
16311624
}

0 commit comments

Comments
 (0)