From 6d9c384070e65fc818a728acf0fa0a4eae858d83 Mon Sep 17 00:00:00 2001 From: Clay Smalley Date: Mon, 1 Aug 2022 18:40:29 -0400 Subject: [PATCH] Hide light rail below z14 --- src/layer/rail.js | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/src/layer/rail.js b/src/layer/rail.js index 0e64199eb..c4aa0e149 100644 --- a/src/layer/rail.js +++ b/src/layer/rail.js @@ -94,6 +94,14 @@ var lineWidth = [ [...serviceSelector, 1.25, 2.5], ]; +var opacity = [ + "step", + ["zoom"], + ["match", ["get", "subclass"], ["rail", "preserved", "narrow_gauge"], 1, 0], + 14, + 1, +]; + // Bridge casing layers export const bridgeCasing = { ...defRail, @@ -111,19 +119,7 @@ export const bridgeCasing = { }, paint: { "line-color": Color.backgroundFill, - "line-opacity": [ - "step", - ["zoom"], - [ - "match", - ["get", "subclass"], - ["rail", "preserved", "narrow_gauge"], - 1, - 0, - ], - 14, - 1, - ], + "line-opacity": opacity, "line-width": zoomInterpolate([...serviceSelector, 4, 6]), }, }; @@ -170,6 +166,7 @@ class Railway { }; layer.paint = { "line-color": lineColor, + "line-opacity": opacity, "line-width": zoomInterpolate(lineWidth), }; if (this.constraints != null) { @@ -192,6 +189,7 @@ class Railway { }; layer.paint = { "line-color": lineColor, + "line-opacity": opacity, "line-width": zoomInterpolate( multiplyMatchExpression(lineWidth, this.dashWidthFactor) ),