Skip to content

feat: add z-index support across geometry styles and layer mappers - #1787

Draft
dkhawk wants to merge 1 commit into
mainfrom
feat/zindex-support
Draft

dkhawk wants to merge 1 commit into
mainfrom
feat/zindex-support

Conversation

@dkhawk

@dkhawk dkhawk commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #1785 to complete z-index support across remaining styles and layer mappers in the data module.

Changes

  • Style.kt:
    • Adds zIndex: Float = 0.0f to PointStyle and LineStyle (matching PolygonStyle and GroundOverlayStyle), with KDoc documentation.
  • MapViewRenderer.kt:
    • Propagates style.zIndex to MarkerOptions and AdvancedMarkerOptions in createMarkerOptions and createAdvancedMarkerOptions.
    • Propagates style.zIndex to PolylineOptions in createPolylineOptions.
  • GeoJsonLayer.kt:
    • Forwards getZIndex() from GeoJsonPointStyle, GeoJsonLineStringStyle, and GeoJsonPolygonStyle when mapping to ModelPointStyle, ModelLineStyle, and ModelPolygonStyle.
  • KmlLayer.kt:
    • Forwards zIndex (and isGeodesic) from inline marker, polyline, and polygon options when converting to platform-agnostic model styles.
  • Interactive Demo (ZIndexDemoActivity):
    • Added interactive demo showcasing independent z-index controls for overlapping polygons, polylines, and a marker using MapViewRenderer.
    • Registered in MainActivity and AndroidManifest.
  • Visual Tests (ZIndexVisualTest):
    • Added automated visual regression tests extending BaseVisualTest to verify initial stacking hierarchy and dynamic layering updates on device.
  • Unit Tests:
    • Added unit tests in MapViewRendererTest for PointStyle.zIndex (legacy markers and advanced markers) and LineStyle.zIndex (polylines).
    • Added unit tests in GeoJsonLayerObserverTest verifying zIndex propagation for point markers, polylines, and polygons.

Verification

  • ./gradlew :data:testDebugUnitTest: Passed (143 unit tests).
  • ./gradlew :data:lintDebug: Passed (0 errors).
  • ./gradlew :demo:connectedStandardDebugAndroidTest: Passed (2/2 visual tests on Pixel 6).

@dkhawk
dkhawk requested review from LoyalAbbas and kikoso September 18, 2026 16:35
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
@googlemaps-bot

googlemaps-bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 51.51% -0.14% 🍏
Files changed 48.96%

Module Coverage
Kover Gradle Plugin XML report for :data 50.85% -0.25%
Files
Module File Coverage
Kover Gradle Plugin XML report for :data Style.kt 100% 🍏
MapViewRenderer.kt 60.7% -0.66% 🍏
GeoJsonLayer.kt 55.2% 🍏
KmlLayer.kt 37.93% -2.22%

Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
Comment thread demo/src/main/res/layout/activity_zindex_demo.xml Fixed
@dkhawk
dkhawk force-pushed the feat/zindex-support branch 2 times, most recently from 45fdc21 to b731b02 Compare September 18, 2026 23:27
…demo

Follow-up to #1785 to complete z-index support across the remaining geometry
styles (PointStyle, LineStyle), layer mappers (GeoJsonLayer, KmlLayer), and add
an interactive demo and visual regression test suite.

Key changes:
- Model Layer: Add zIndex property (default 0.0f) to PointStyle and LineStyle with KDoc.
- Renderer Engine: Propagate style.zIndex to MarkerOptions, AdvancedMarkerOptions, and PolylineOptions in MapViewRenderer.
- Layer Bridges: Forward getZIndex() in GeoJsonLayer and inline zIndex in KmlLayer when converting to platform-agnostic models.
- Interactive Sample: Add ZIndexDemoActivity showcasing in-place zIndex updates and reset for overlapping polygons, polylines, and markers with Material 3 filled tonal icon buttons and reset action.
- Testing:
  - Unit tests verifying z-index propagation in MapViewRendererTest, GeoJsonLayerObserverTest, and KmlLayerOnMapTest.
  - On-device visual regression test (ZIndexVisualTest) verifying initial stacking hierarchy, dynamic updates, and reset action.
@dkhawk
dkhawk force-pushed the feat/zindex-support branch from b731b02 to 50b78dd Compare September 18, 2026 23:30
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.

3 participants