Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CoreLocation
import GoogleMaps
import MapConductorCore
@_spi(MapConductorDriver) import MapConductorCore
import UIKit

@MainActor
Expand All @@ -25,7 +25,7 @@ final class GoogleMapCircleOverlayRenderer: AbstractCircleOverlayRenderer<GMSPol
// Use mapView(_:didTapAt:) + CircleManager hit-testing for click handling.
// If we set this tappable, Google Maps consumes taps and we'd need mapView(_:didTap:) overlay handling.
polygon.isTappable = false
polygon.zIndex = Int32(state.zIndex ?? 0)
polygon.zIndex = OverlayStacking.globalZIndex(OverlayStackKey(.circle, zIndex: state.zIndex ?? 0))
polygon.geodesic = state.geodesic
polygon.map = mapView
polygon.userData = state.id
Expand Down Expand Up @@ -71,7 +71,7 @@ final class GoogleMapCircleOverlayRenderer: AbstractCircleOverlayRenderer<GMSPol
}

if finger.zIndex != prevFinger.zIndex {
circle.zIndex = Int32(current.state.zIndex ?? 0)
circle.zIndex = OverlayStacking.globalZIndex(OverlayStackKey(.circle, zIndex: current.state.zIndex ?? 0))
}

return circle
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CoreLocation
import GoogleMaps
import MapConductorCore
@_spi(MapConductorDriver) import MapConductorCore

@MainActor
final class GoogleMapGroundImageOverlayRenderer: AbstractGroundImageOverlayRenderer<GMSGroundOverlay> {
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ final class GoogleMapMarkerController: AbstractMarkerController<GMSMarker, Googl
// タイル差し替え時のフェードを切る。フェード中の升は古い絵と新しい絵の
// 合成で、そこにジェスチャが重なると途中の絵が残ることがある。
layer.fadeIn = false
layer.zIndex = 0
// マーカーのタイルはマーカーと同じ帯(GMSTileLayer の zIndex はポリゴン等と比べられる)。
layer.zIndex = OverlayStacking.globalZIndex(OverlayStackKey(.marker, zIndex: 0))
layer.map = mapView
tileTileLayer = layer
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import CoreGraphics
import CoreLocation
import GoogleMaps
import MapConductorCore
@_spi(MapConductorDriver) import MapConductorCore

@MainActor
final class GoogleMapMarkerRenderer: MarkerOverlayRendererProtocol {
Expand Down Expand Up @@ -295,7 +295,7 @@ final class GoogleMapMarkerRenderer: MarkerOverlayRendererProtocol {
marker.isTappable = state.clickable
marker.icon = bitmapIcon.bitmap
marker.groundAnchor = bitmapIcon.anchor
marker.zIndex = Int32(state.zIndex ?? 0)
marker.zIndex = OverlayStacking.globalZIndex(OverlayStackKey(.marker, zIndex: state.zIndex ?? 0))
// Avoid a 1-frame "flash" at the target position when an animation is specified at
// construction (or during a state update). Keep it hidden until `onAnimate` repositions
// it to the offscreen start point.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import GoogleMaps
import MapConductorCore
@_spi(MapConductorDriver) import MapConductorCore
import UIKit

@MainActor
Expand All @@ -22,7 +22,7 @@ final class GoogleMapPolygonOverlayRenderer: AbstractPolygonOverlayRenderer<GMSP
polygon.strokeWidth = CGFloat(resolved.strokeWidth)
polygon.fillColor = resolved.fillColor
polygon.geodesic = resolved.geodesic
polygon.zIndex = Int32(truncatingIfNeeded: resolved.zIndex)
polygon.zIndex = OverlayStacking.globalZIndex(OverlayStackKey(.polygon, zIndex: resolved.zIndex))
polygon.holes = resolved.holes.map { holePoints in
ringPath(for: holePoints, geodesic: resolved.geodesic, mapView: mapView)
}
Expand Down Expand Up @@ -62,7 +62,7 @@ final class GoogleMapPolygonOverlayRenderer: AbstractPolygonOverlayRenderer<GMSP
}

if finger.zIndex != prevFinger.zIndex {
polygon.zIndex = Int32(truncatingIfNeeded: current.state.zIndex)
polygon.zIndex = OverlayStacking.globalZIndex(OverlayStackKey(.polygon, zIndex: current.state.zIndex))
}

return polygon
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import GoogleMaps
import MapConductorCore
@_spi(MapConductorDriver) import MapConductorCore
import UIKit

@MainActor
Expand All @@ -21,7 +21,7 @@ final class GoogleMapPolylineOverlayRenderer: AbstractPolylineOverlayRenderer<GM
polyline.strokeWidth = CGFloat(state.strokeWidth)
polyline.geodesic = state.geodesic
polyline.isTappable = false
polyline.zIndex = Int32(state.zIndex)
polyline.zIndex = OverlayStacking.globalZIndex(OverlayStackKey(.polyline, zIndex: state.zIndex))
polyline.map = mapView
polyline.userData = state.id
return polyline
Expand Down Expand Up @@ -50,7 +50,7 @@ final class GoogleMapPolylineOverlayRenderer: AbstractPolylineOverlayRenderer<GM
}

if finger.zIndex != prevFinger.zIndex {
polyline.zIndex = Int32(current.state.zIndex)
polyline.zIndex = OverlayStacking.globalZIndex(OverlayStackKey(.polyline, zIndex: current.state.zIndex))
}

return polyline
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import GoogleMaps
import MapConductorCore
@_spi(MapConductorDriver) import MapConductorCore
import UIKit

@MainActor
Expand All @@ -18,7 +18,7 @@ final class GoogleMapRasterLayerOverlayRenderer: AbstractRasterLayerOverlayRende
guard let mapView else { return nil }
guard let layer = makeTileLayer(from: state) else { return nil }
layer.opacity = Float(state.opacity)
layer.zIndex = Int32(clamping: state.zIndex)
layer.zIndex = OverlayStacking.globalZIndex(OverlayStacking.rasterKey(stateId: state.id, zIndex: state.zIndex))
applyVisibility(layer: layer, state: state, mapView: mapView)
return layer
}
Expand Down Expand Up @@ -48,7 +48,7 @@ final class GoogleMapRasterLayerOverlayRenderer: AbstractRasterLayerOverlayRende
guard let mapView else { return nil }
guard let newLayer = makeTileLayer(from: current.state) else { return nil }
newLayer.opacity = Float(current.state.opacity)
newLayer.zIndex = Int32(clamping: current.state.zIndex)
newLayer.zIndex = OverlayStacking.globalZIndex(OverlayStacking.rasterKey(stateId: current.state.id, zIndex: current.state.zIndex))
applyVisibility(layer: newLayer, state: current.state, mapView: mapView)
return newLayer
}
Expand All @@ -58,7 +58,7 @@ final class GoogleMapRasterLayerOverlayRenderer: AbstractRasterLayerOverlayRende
}

if finger.zIndex != prevFinger.zIndex {
layer.zIndex = Int32(clamping: current.state.zIndex)
layer.zIndex = OverlayStacking.globalZIndex(OverlayStacking.rasterKey(stateId: current.state.id, zIndex: current.state.zIndex))
}

if finger.visible != prevFinger.visible {
Expand All @@ -84,7 +84,7 @@ final class GoogleMapRasterLayerOverlayRenderer: AbstractRasterLayerOverlayRende
tileSources.removeValue(forKey: ObjectIdentifier(local))
localLayers.removeValue(forKey: ObjectIdentifier(local))
next.opacity = Float(current.state.opacity)
next.zIndex = Int32(clamping: current.state.zIndex)
next.zIndex = OverlayStacking.globalZIndex(OverlayStacking.rasterKey(stateId: current.state.id, zIndex: current.state.zIndex))
applyVisibility(layer: next, state: current.state, mapView: mapView)
return next
}
Expand Down