Skip to content

Commit 1ae0a20

Browse files
committed
draw shadow under extruded polygons
1 parent 644dbbb commit 1ae0a20

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

app/javascript/maplibre/styles.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const viewStyleNames = [
2222
'symbols-layer',
2323
'text-layer-flat',
2424
'text-layer',
25+
'polygon-layer-extruded-shadow',
2526
'polygon-layer-extrusion'
2627
]
2728

@@ -281,6 +282,22 @@ export let labelFont
281282

282283
export function styles () {
283284
return {
285+
'polygon-layer-extruded-shadow': {
286+
id: 'gl-draw-polygon-layer-extruded-shadow',
287+
type: 'fill',
288+
filter: ['all',
289+
["==", ["geometry-type"], "Polygon"],
290+
['>', ['get', 'fill-extrusion-height'], 0],
291+
[
292+
">=",
293+
["zoom"],
294+
["coalesce", ["to-number", ["get", "minzoom"]], 0]
295+
]],
296+
paint: {
297+
'fill-color': 'gray',
298+
'fill-opacity': 0.1
299+
}
300+
},
284301
'polygon-layer': {
285302
id: 'polygon-layer',
286303
type: 'fill',
@@ -320,7 +337,7 @@ export function styles () {
320337
'fill-extrusion-base': ['to-number', ['coalesce',
321338
['get', 'fill-extrusion-base'],
322339
['get', 'user_fill-extrusion-base']]],
323-
// opacity does not support data expressions!?!
340+
// opacity does not support data expressions, it's a constant per layer
324341
'fill-extrusion-opacity': 0.9
325342
}
326343
},

0 commit comments

Comments
 (0)