Skip to content

Commit

Permalink
Revert "feat: Rename example codes that were using the position `para…
Browse files Browse the repository at this point in the history
…meter` to `initialPosition`. googlemaps#637"

This reverts commit 565007e.
  • Loading branch information
JSpiner authored and smith.jspiner committed Dec 17, 2024
1 parent 97ed22c commit a266768
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AccessibilityActivity : ComponentActivity() {
super.onCreate(savedInstanceState)
enableEdgeToEdge()
setContent {
val singaporeState = rememberMarkerState(initialPosition = singapore)
val singaporeState = rememberMarkerState(position = singapore)
val cameraPositionState = rememberCameraPositionState {
position = defaultCameraPosition
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ fun GoogleMapView(
mapColorScheme: ComposeMapColorScheme = ComposeMapColorScheme.FOLLOW_SYSTEM,
content: @Composable () -> Unit = {}
) {
val singaporeState = rememberMarkerState(initialPosition = singapore)
val singapore2State = rememberMarkerState(initialPosition = singapore2)
val singapore3State = rememberMarkerState(initialPosition = singapore3)
val singapore4State = rememberMarkerState(initialPosition = singapore4)
val singapore5State = rememberMarkerState(initialPosition = singapore5)
val singaporeState = rememberMarkerState(position = singapore)
val singapore2State = rememberMarkerState(position = singapore2)
val singapore3State = rememberMarkerState(position = singapore3)
val singapore4State = rememberMarkerState(position = singapore4)
val singapore5State = rememberMarkerState(position = singapore5)

var circleCenter by remember { mutableStateOf(singapore) }
if (!singaporeState.isDragging) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private fun GoogleMapViewInColumn(
cameraPositionState: CameraPositionState,
onMapLoaded: () -> Unit,
) {
val singaporeState = rememberMarkerState(initialPosition = singapore)
val singaporeState = rememberMarkerState(position = singapore)

var uiSettings by remember { mutableStateOf(MapUiSettings(compassEnabled = false)) }
var mapProperties by remember {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class RecompositionActivity : ComponentActivity() {
cameraPositionState: CameraPositionState = rememberCameraPositionState(),
content: @Composable () -> Unit = {},
) {
val markerState = rememberMarkerState(initialPosition = singapore)
val markerState = rememberMarkerState(position = singapore)

val uiSettings by remember { mutableStateOf(MapUiSettings(compassEnabled = false)) }
val mapProperties by remember {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ class AdvancedMarkersActivity : ComponentActivity(), OnMapsSdkInitializedCallbac
val mapProperties by remember {
mutableStateOf(MapProperties(mapType = MapType.NORMAL))
}
val marker1State = rememberMarkerState(initialPosition = santiago)
val marker2State = rememberMarkerState(initialPosition = bogota)
val marker3State = rememberMarkerState(initialPosition = lima)
val marker4State = rememberMarkerState(initialPosition = salvador)
val marker1State = rememberMarkerState(position = santiago)
val marker2State = rememberMarkerState(position = bogota)
val marker3State = rememberMarkerState(position = lima)
val marker4State = rememberMarkerState(position = salvador)

// Drawing on the map is accomplished with a child-based API
val markerClick: (Marker) -> Boolean = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ fun GoogleMapClustering(items: List<MyItem>) {
}

MarkerInfoWindow(
state = rememberMarkerState(initialPosition = singapore),
state = rememberMarkerState(position = singapore),
onClick = {
Log.d(TAG, "Non-cluster marker clicked! $it")
true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private fun DraggableMarker(
onDrag: (LatLng) -> Unit = {},
onDragEnd: () -> Unit = {}
) {
val markerState = rememberMarkerState(initialPosition = singapore)
val markerState = rememberMarkerState(position = singapore)

Marker(
state = markerState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,6 @@ fun rememberUpdatedMarkerState(position: LatLng): MarkerState =
// rememberUpdatedState() uses MutableState, we use MarkerState.
// This is more efficient than updating position in an effect,
// as we avoid an additional recomposition.
remember { MarkerState(initialPosition = position) }.also {
remember { MarkerState(position = position) }.also {
it.position = position
}

0 comments on commit a266768

Please sign in to comment.