Skip to content

Conversation

@kikoso
Copy link
Collaborator

@kikoso kikoso commented Jan 8, 2026

Fix for the GroundOverlay Rendering Issue

Description

This PR fixes an issue where the GroundOverlay composable was added to the composition tree but failed to render on the map (#824).

Root Cause

The GroundOverlayPosition class was not a data class, meaning it lacked a value-based equals() implementation. In Compose, a new instance of GroundOverlayPosition was being created during recompositions. Because Compose couldn't identify these instances as equal, it triggered redundant updates to the underlying Google Maps SDK, leading to rendering instability that prevented the overlay from appearing

Changes

Core Fix: Converted GroundOverlayPosition to a data class in GroundOverlay.kt
.
API Enhancement: Added an update block for anchor in the GroundOverlay composable.

Sample App: Added GroundOverlayActivity.kt to demonstrate the fix and provide a "stress-test"

Verification Plan

Manual Verification

  1. Run the maps-app.
  2. Navigate to Map Features > Ground Overlay.
  3. Verify that two overlays are visible:
    • One using stable (remembered) state.
    • One "stress-test" overlay that recreates its position on every recomposition.
  4. Use the sliders to adjust transparency and bearing to ensure updates are smooth and correctly applied.

Fixes #824

@googlemaps-bot
Copy link
Contributor

Code Coverage

There is no coverage information present for the Files changed

@kikoso kikoso marked this pull request as ready for review January 29, 2026 15:06
@kikoso kikoso changed the title fix: GroundOverlay fix: fixed GroundOverlay and added sample Jan 29, 2026
@dkhawk dkhawk merged commit f54d4ea into main Jan 29, 2026
9 checks passed
@dkhawk dkhawk deleted the fix/groundoverlay branch January 29, 2026 17:38
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.

GroundOverlay composable added to composition tree but does not render on map

3 participants