From d9aebc33ac9350b810763ea13e815e6563c65c28 Mon Sep 17 00:00:00 2001 From: Masashi Katsumata Date: Sat, 7 Nov 2026 23:35:42 -0800 Subject: [PATCH] Stack overlays in one band order, whatever order they arrive in Google compares one zIndex across polylines, polygons, circles, ground overlays and tile layers. Each overlay passed its own zIndex through (all 0 by default; ground overlays and the marker tile layer never set one), so equal values fell back to add order: a re-sent ground image covered the polygons, a circle covered the polyline. The zIndex is now OverlayStacking.globalZIndex (ios-sdk-core): each band gets its own range, raster layers < ground images < polygons < circles < polylines < markers, the overlay's zIndex orders within the band. The marker tile layer is in the marker band. Markers are still drawn above every non-marker overlay by the SDK itself. Basemap labels stay above the overlays: Google draws its labels over polygons and the rest regardless (unchanged). Requires ios-sdk-core fix/overlay-stacking-order (OverlayStacking). --- .../circle/GoogleMapCircleOverlayRenderer.swift | 6 +++--- .../GoogleMapGroundImageOverlayRenderer.swift | 3 ++- .../marker/GoogleMapMarkerController.swift | 3 ++- .../marker/GoogleMapMarkerRenderer.swift | 4 ++-- .../polygon/GoogleMapPolygonOverlayRenderer.swift | 6 +++--- .../polyline/GoogleMapPolylineOverlayRenderer.swift | 6 +++--- .../raster/GoogleMapRasterLayerOverlayRenderer.swift | 10 +++++----- 7 files changed, 20 insertions(+), 18 deletions(-) diff --git a/Sources/MapConductorForGoogleMaps/circle/GoogleMapCircleOverlayRenderer.swift b/Sources/MapConductorForGoogleMaps/circle/GoogleMapCircleOverlayRenderer.swift index ba8a58f..9c90c48 100644 --- a/Sources/MapConductorForGoogleMaps/circle/GoogleMapCircleOverlayRenderer.swift +++ b/Sources/MapConductorForGoogleMaps/circle/GoogleMapCircleOverlayRenderer.swift @@ -1,6 +1,6 @@ import CoreLocation import GoogleMaps -import MapConductorCore +@_spi(MapConductorDriver) import MapConductorCore import UIKit @MainActor @@ -25,7 +25,7 @@ final class GoogleMapCircleOverlayRenderer: AbstractCircleOverlayRenderer { @@ -16,6 +16,7 @@ final class GoogleMapGroundImageOverlayRenderer: AbstractGroundImageOverlayRende guard let bounds = toCoordinateBounds(state.bounds) else { return nil } let overlay = GMSGroundOverlay(bounds: bounds, icon: state.image) + overlay.zIndex = OverlayStacking.globalZIndex(OverlayStackKey(.groundImage, zIndex: 0)) overlay.opacity = Float(state.opacity) overlay.isTappable = false overlay.userData = state.id diff --git a/Sources/MapConductorForGoogleMaps/marker/GoogleMapMarkerController.swift b/Sources/MapConductorForGoogleMaps/marker/GoogleMapMarkerController.swift index 85738e5..c75b776 100644 --- a/Sources/MapConductorForGoogleMaps/marker/GoogleMapMarkerController.swift +++ b/Sources/MapConductorForGoogleMaps/marker/GoogleMapMarkerController.swift @@ -359,7 +359,8 @@ final class GoogleMapMarkerController: AbstractMarkerController