Skip to content

Commit 5a04ca4

Browse files
committed
fix style warnings on null settings
1 parent 37f3868 commit 5a04ca4

3 files changed

Lines changed: 23 additions & 7 deletions

File tree

app/javascript/maplibre/layers/layers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export function initializeLayerSources(id = null) {
7474
if (id) { initLayers = initLayers.filter(l => l.id === id) }
7575

7676
initLayers.forEach((layer) => {
77-
console.log('Adding source for layer', layer)
77+
// console.log(`Adding source for ${layer.type} layer`, layer)
7878
layer.createSource()
7979
})
8080
}

app/javascript/maplibre/styles/styles.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const viewStyleNames = [
3333
export function setStyleDefaultFont (font) { labelFont = [font] }
3434

3535
export function initializeViewStyles (sourceName, heatmap=false) {
36-
console.log('Initializing view styles for source ' + sourceName)
36+
// console.log('Initializing view styles for source ' + sourceName)
3737
removeStyleLayers(sourceName)
3838
viewStyleNames.forEach(styleName => {
3939
map.addLayer(setSource(styles()[styleName], sourceName))
@@ -403,12 +403,12 @@ function textLayerStyles(mode) {
403403
],
404404
'text-size': labelSize,
405405
'text-font': labelFont,
406-
'text-letter-spacing': ['get', 'label-letter-spacing'],
406+
'text-letter-spacing': ['coalesce', ['get', 'label-letter-spacing'], 0],
407407
'text-anchor': 'top', // text under point
408408
// TODO: set this to 0 for polygons, needs 'geometry-type' implementation: https://github.com/maplibre/maplibre-style-spec/discussions/536
409409
'text-offset': labelOffset,
410410
'text-justify': ['get', 'label-justify'],
411-
'text-max-width': ['get', 'label-max-width'],
411+
'text-max-width': ['coalesce', ['get', 'label-max-width'], 10],
412412
'text-line-height': 1.6, // no dynamic value possible
413413
// TODO: sort keys on text are ascending, on symbols descending???
414414
'symbol-sort-key': ['-', 1000, sortKey]
@@ -491,8 +491,8 @@ export function styles () {
491491
minZoomFilter],
492492
paint: {
493493
'fill-extrusion-color': styleProp(['fill-extrusion-color', 'user_fill-extrusion-color', 'fill', 'user_fill'], featureColor),
494-
'fill-extrusion-height': ['to-number', styleProp(['fill-extrusion-height', 'user_fill-extrusion-height'])],
495-
'fill-extrusion-base': ['to-number', styleProp(['fill-extrusion-base', 'user_fill-extrusion-base'])],
494+
'fill-extrusion-height': ['to-number', styleProp(['fill-extrusion-height', 'user_fill-extrusion-height'], 0)],
495+
'fill-extrusion-base': ['to-number', styleProp(['fill-extrusion-base', 'user_fill-extrusion-base'], 0)],
496496
// opacity does not support data expressions, it's a constant per layer
497497
'fill-extrusion-opacity': 0.9
498498
}
@@ -551,7 +551,7 @@ export function styles () {
551551
layout: {
552552
'line-join': 'round',
553553
'line-cap': 'round',
554-
'line-sort-key': ['to-number', ['get', 'sort-key']]
554+
'line-sort-key': sortKey
555555
},
556556
paint: {
557557
'line-color': lineColor,

spec/fixtures/files/wikipedia.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"batchcomplete": "",
3+
"query": {
4+
"geosearch": [
5+
{
6+
"pageid": 12345,
7+
"ns": 0,
8+
"title": "Nürnberger Burg",
9+
"lat": 49.458,
10+
"lon": 11.076,
11+
"dist": 100,
12+
"primary": ""
13+
}
14+
]
15+
}
16+
}

0 commit comments

Comments
 (0)