Skip to content

Commit eb459b7

Browse files
authored
Less conservative check to enable stencil lines (#11397)
* Less conservative check to enable improved line transparency When line-width is a composite expression we should still enable it * Add render test
1 parent 52cc1b2 commit eb459b7

File tree

4 files changed

+160
-2
lines changed

4 files changed

+160
-2
lines changed

src/render/program/line_program.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ const lineDefinesValues = (layer: LineStyleLayer): LineDefinesType[] => {
155155

156156
const hasPattern = layer.paint.get('line-pattern').constantOr((1: any));
157157
const hasOpacity = layer.paint.get('line-opacity').constantOr(1.0) !== 1.0;
158-
const hasWidthOver1 = layer.paint.get('line-width').constantOr(1.0) > 1.0;
159-
if (!hasPattern && hasWidthOver1 && hasOpacity) {
158+
if (!hasPattern && hasOpacity) {
160159
values.push('RENDER_LINE_ALPHA_DISCARD');
161160
}
162161
return values;
91.1 KB
Loading
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
{
2+
"version": 8,
3+
"metadata": {
4+
"test": {
5+
"width": 512,
6+
"height": 512
7+
}
8+
},
9+
"sources": {
10+
"mapbox": {
11+
"type": "vector",
12+
"maxzoom": 18,
13+
"tiles": [
14+
"local://tiles/{z}-{x}-{y}.mvt"
15+
]
16+
}
17+
},
18+
"layers": [
19+
{
20+
"id": "data-driven-lines",
21+
"type": "line",
22+
"source": "mapbox",
23+
"source-layer": "road",
24+
"filter": [
25+
"has",
26+
"type"
27+
],
28+
"layout": {
29+
"line-join": "round"
30+
},
31+
"paint": {
32+
"line-color": [
33+
"interpolate",
34+
[
35+
"linear"
36+
],
37+
[
38+
"zoom"
39+
],
40+
1,
41+
[
42+
"match",
43+
[
44+
"get",
45+
"type"
46+
],
47+
[
48+
"light_rail",
49+
"monorail",
50+
"rail"
51+
],
52+
"hsl(255, 82%, 42%)",
53+
"subway",
54+
"hsl(360, 93%, 50%)",
55+
"hsla(0, 0%, 0%, 0)"
56+
],
57+
8,
58+
[
59+
"match",
60+
[
61+
"get",
62+
"type"
63+
],
64+
[
65+
"light_rail",
66+
"monorail",
67+
"rail"
68+
],
69+
"hsl(255, 82%, 42%)",
70+
"subway",
71+
"hsl(360, 93%, 50%)",
72+
"#000000"
73+
]
74+
],
75+
"line-opacity": 0.6,
76+
"line-width": [
77+
"interpolate",
78+
[
79+
"linear"
80+
],
81+
[
82+
"zoom"
83+
],
84+
0,
85+
[
86+
"*",
87+
[
88+
"match",
89+
[
90+
"get",
91+
"type"
92+
],
93+
"platform",
94+
0.5,
95+
[
96+
"rail",
97+
"monorail",
98+
"light_rail",
99+
"subway"
100+
],
101+
3,
102+
0
103+
],
104+
1.4
105+
],
106+
3,
107+
[
108+
"*",
109+
[
110+
"match",
111+
[
112+
"get",
113+
"type"
114+
],
115+
"platform",
116+
0.5,
117+
[
118+
"rail",
119+
"monorail",
120+
"light_rail",
121+
"subway"
122+
],
123+
3,
124+
0
125+
],
126+
1.4
127+
],
128+
22,
129+
[
130+
"*",
131+
[
132+
"match",
133+
[
134+
"get",
135+
"type"
136+
],
137+
"platform",
138+
0.5,
139+
[
140+
"rail",
141+
"monorail",
142+
"light_rail",
143+
"subway"
144+
],
145+
3,
146+
0
147+
],
148+
1.4
149+
]
150+
]
151+
}
152+
}
153+
],
154+
"center": [
155+
-74.001215,
156+
40.753458
157+
],
158+
"zoom": 16.5
159+
}
33.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)