Add array support for icon-padding (#2845)

This commit is contained in:
Alexey Kon
2024-09-20 17:17:33 -07:00
committed by GitHub
parent 58dd529790
commit 9d553c2843
56 changed files with 902 additions and 104 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -0,0 +1,57 @@
{
"version": 8,
"metadata": {
"test": {
"collisionDebug": true,
"width": 240,
"height": 100
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": { },
"geometry": { "type": "Point", "coordinates": [-60, 0] }
}, {
"type": "Feature",
"properties": { "padding": 5 },
"geometry": { "type": "Point", "coordinates": [-30, 0] }
}, {
"type": "Feature",
"properties": { "padding": [-20, -5] },
"geometry": { "type": "Point", "coordinates": [-0, 0] }
}, {
"type": "Feature",
"properties": { "padding": [2, 2, -10] },
"geometry": { "type": "Point", "coordinates": [30, 0] }
}, {
"type": "Feature",
"properties": { "padding": [2, 10, -20, 2] },
"geometry": { "type": "Point", "coordinates": [60, 0] }
}
]
}
}
},
"sprite": "local://sprites/2x",
"layers": [{
"id": "bg",
"type": "background",
"paint": {
"background-color": "#ccc"
}
}, {
"id": "symbolA",
"type": "symbol",
"source": "geojson",
"layout": {
"icon-image": "icon",
"icon-padding": ["coalesce", ["get", "padding"], ["literal", [2]]]
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@@ -0,0 +1,58 @@
{
"version": 8,
"metadata": {
"test": {
"collisionDebug": true,
"width": 240,
"height": 100
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": { },
"geometry": { "type": "Point", "coordinates": [-60, 0] }
}, {
"type": "Feature",
"properties": { },
"geometry": { "type": "Point", "coordinates": [-40, 0] }
}, {
"type": "Feature",
"properties": { },
"geometry": { "type": "Point", "coordinates": [-20, 0] }
}
]
}
}
},
"sprite": "local://sprites/2x",
"layers": [{
"id": "bg",
"type": "background",
"paint": {
"background-color": "#ccc"
}
}, {
"id": "symbolA",
"type": "symbol",
"source": "geojson",
"layout": {
"icon-image": "icon",
"icon-padding": [10]
}
}, {
"id": "symbolB",
"type": "symbol",
"source": "geojson",
"layout": {
"icon-image": "icon",
"icon-padding": [2, 2, -20],
"icon-offset": [120, 0]
}
}
]
}