Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ class W3WMapManager(
*
* @param newCameraState The new camera state to set.
*/
internal suspend fun updateCameraState(newCameraState: W3WCameraState<*>) = withContext(IO) {
suspend fun updateCameraState(newCameraState: W3WCameraState<*>) = withContext(IO) {
_mapState.update {
it.copy(
cameraState = newCameraState,
Expand Down Expand Up @@ -1846,7 +1846,7 @@ class W3WMapManager(
*
* @param textDataSource The text data source implementation to use for API calls.
*/
internal fun setTextDataSource(textDataSource: W3WTextDataSource) {
fun setTextDataSource(textDataSource: W3WTextDataSource) {
this.textDataSource = textDataSource
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ fun W3WGoogleMap(
* @param gridLinesConfig Configuration for the grid lines, including scale factor
* @param onCameraBoundUpdate Callback that receives the calculated grid bounds and visible bounds
*/
private suspend fun updateCameraBound(
suspend fun updateCameraBound(
projection: Projection,
gridLinesConfig: W3WMapDefaults.GridLinesConfig,
onCameraBoundUpdate: (gridBound: W3WRectangle, visibleBound: W3WRectangle) -> Unit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ fun W3WGoogleMapDrawMarkers(
) {
val drawZoomIn = remember(zoomLevel) {
derivedStateOf {
zoomLevel > zoomSwitchLevel && zoomLevel >= MIN_SUPPORT_GRID_ZOOM_LEVEL_GOOGLE
zoomLevel >= zoomSwitchLevel && zoomLevel >= MIN_SUPPORT_GRID_ZOOM_LEVEL_GOOGLE
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ fun W3WMapBox(
* The grid bound is scaled according to the configuration, while the visible bound
* represents the actual visible area on the map.
*/
private fun updateGridBound(
fun updateGridBound(
mapboxMap: MapboxMap,
gridLinesConfig: W3WMapDefaults.GridLinesConfig,
onCameraBoundUpdate: (gridBound: W3WRectangle, visibleBound: W3WRectangle) -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ fun W3WMapBoxDrawMarkers(
) {
val drawZoomIn = remember(zoomLevel) {
derivedStateOf {
zoomLevel > zoomSwitchLevel && zoomLevel >= MIN_SUPPORT_GRID_ZOOM_LEVEL_MAP_BOX
zoomLevel >= zoomSwitchLevel && zoomLevel >= MIN_SUPPORT_GRID_ZOOM_LEVEL_MAP_BOX
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import com.what3words.core.types.geometry.W3WRectangle
@Immutable
interface W3WCameraState<T> {

val cameraState: T
var cameraState: T

var gridBound: W3WRectangle?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class W3WGoogleCameraState(initialCameraState: CameraPositionState) :
const val MY_LOCATION_ZOOM = 20f
}

override val cameraState: CameraPositionState by mutableStateOf(initialCameraState)
override var cameraState: CameraPositionState by mutableStateOf(initialCameraState)

override var gridBound: W3WRectangle? by mutableStateOf(null)

Expand Down Expand Up @@ -74,18 +74,20 @@ class W3WGoogleCameraState(initialCameraState: CameraPositionState) :
override suspend fun moveToPosition(
listLatLng: List<W3WCoordinates>,
) {
val latLngBounds = LatLngBounds.Builder()
listLatLng.forEach {
latLngBounds.include(LatLng(it.lat, it.lng))
}
if (listLatLng.isNotEmpty()) {
val latLngBounds = LatLngBounds.Builder()
listLatLng.forEach {
latLngBounds.include(LatLng(it.lat, it.lng))
}

withContext(Main) {
cameraState.animate(
update =
CameraUpdateFactory.newLatLngBounds(
latLngBounds.build(), 10
)
)
withContext(Main) {
cameraState.animate(
update =
CameraUpdateFactory.newLatLngBounds(
latLngBounds.build(), 10
)
)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class W3WMapboxCameraState(initialCameraState: MapViewportState) :
const val MY_LOCATION_ZOOM = 20.0
}

override val cameraState: MapViewportState by mutableStateOf(initialCameraState)
override var cameraState: MapViewportState by mutableStateOf(initialCameraState)

override var gridBound: W3WRectangle? by mutableStateOf(null)

Expand Down
Loading