Skip to content

Commit 58701de

Browse files
endankegithub-actions[bot]
authored andcommitted
Update cutout configuration in DynamicViewAnnotationExample.swift
GitOrigin-RevId: 07950bcc491409bb7e1f6551321693d38f3e4917
1 parent 96473b7 commit 58701de

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Sources/Examples/All Examples/Annotations/DynamicViewAnnotationExample.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ private final class Route {
241241
didSet { updateVisible() }
242242
}
243243
var layerId: String { "route-\(name)" }
244+
var cutoutLayerId: String { "route-\(name)-cutout" }
244245
private(set) var etaAnnotation: ViewAnnotation?
245246
private var etaView: ETAView?
246247
private var displayed = false
@@ -296,12 +297,16 @@ private final class Route {
296297
routeLayer.lineBorderWidth = .constant(2)
297298
routeLayer.lineBorderColor = .expression(colorExpression(normal: "#666666", selected: "#327AC2"))
298299
routeLayer.slot = .middle
299-
// make route lines visible through obstructing 3D buildings and other aboveground features
300-
routeLayer.lineCutoutWidth = .constant(30)
301-
routeLayer.lineCutoutFadeWidth = .constant(0.5)
302-
routeLayer.lineCutoutOpacity = .constant(0)
303300
try! mapView.mapboxMap.addLayer(routeLayer)
304301

302+
// make route lines visible through obstructing 3D buildings and other aboveground features
303+
var cutoutLayer = LineLayer(id: cutoutLayerId, source: layerId)
304+
cutoutLayer.lineWidth = .constant(30.0)
305+
cutoutLayer.slot = .middle
306+
cutoutLayer.lineCutoutFadeWidth = .constant(0.5)
307+
cutoutLayer.lineCutoutOpacity = .constant(0)
308+
try! mapView.mapboxMap.addLayer(cutoutLayer)
309+
305310
// Annotation
306311
let etaView = ETAView(text: time)
307312
self.etaView = etaView

0 commit comments

Comments
 (0)