Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Set initial map padding (#326) #327

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kkris
Copy link

@kkris kkris commented Jun 12, 2023

Fixes #326 馃

With this fix applied, the example from #326 now behaves correctly: https://github.com/googlemaps/android-maps-compose/assets/232214/7a07bcbb-c9fc-4924-8131-762926f36e29

@kikoso
Copy link
Collaborator

kikoso commented Oct 13, 2023

Thanks for the contribution @kkris ! This fixes the issue.

@kkris
Copy link
Author

kkris commented Oct 26, 2023

@kikoso Thanks for reviewing! Any idea how to fix the Run instrumentation tests check?

java.lang.IllegalStateException: Maps API key not specified
	at com.google.maps.android.compose.MapInColumnTests.initMap(MapInColumnTests.kt:43)

@kikoso
Copy link
Collaborator

kikoso commented Oct 27, 2023

Hi @kkris ! Since you are running it from another branch, the instrumented tests are going to fail since you do not have a local API Key.

We have thought of a couple of solutions here, but nothing in place so far. What you can do in the meantime is run the instrumentation test locally.

Before merging the external contributions we run the test locally too.

@@ -152,15 +155,7 @@ internal inline fun MapUpdater(
set(mapProperties.maxZoomPreference) { map.setMaxZoomPreference(it) }
set(mapProperties.minZoomPreference) { map.setMinZoomPreference(it) }
set(contentPadding) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to change from set() to update(). Perhaps could move up to the other update() calls purely for consistency.

Suggested change
set(contentPadding) {
update(contentPadding) {

Comment on lines +41 to 42
applyContentPadding(map, contentPadding)
cameraPositionState.setMap(map)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a brief comment here to inform a reader why padding must precede camera position?

Suggested change
applyContentPadding(map, contentPadding)
cameraPositionState.setMap(map)
applyContentPadding(map, contentPadding)
// set camera position after padding for correct centering
cameraPositionState.setMap(map)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content padding is not used for initial rendering
4 participants