@record-evolution/widget-mapbox 1.4.15 → 1.4.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/widget-mapbox.js +39 -42
- package/dist/widget-mapbox.js.map +1 -1
- package/package.json +1 -1
- package/src/definition-schema.json +3 -1
- package/src/widget-mapbox.ts +25 -26
package/package.json
CHANGED
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"properties": {
|
|
95
95
|
"circle-blur": {
|
|
96
96
|
"title": "Blur",
|
|
97
|
+
"description": "Blur of 1 means the whole circle is blurred starting from the center point. Blur 0 means no blur effect.",
|
|
97
98
|
"min": 0,
|
|
98
99
|
"max": 1,
|
|
99
100
|
"type": "number",
|
|
@@ -101,6 +102,7 @@
|
|
|
101
102
|
},
|
|
102
103
|
"circle-opacity": {
|
|
103
104
|
"title": "Opacity",
|
|
105
|
+
"description": "Opactity 1 means fully opaque, 0 means fully transparent.",
|
|
104
106
|
"min": 0,
|
|
105
107
|
"max": 1,
|
|
106
108
|
"type": "number",
|
|
@@ -109,7 +111,7 @@
|
|
|
109
111
|
}
|
|
110
112
|
},
|
|
111
113
|
"symbol": {
|
|
112
|
-
"title": "
|
|
114
|
+
"title": "Symbol Layer",
|
|
113
115
|
"type": "object",
|
|
114
116
|
"order": 2,
|
|
115
117
|
"properties": {
|
package/src/widget-mapbox.ts
CHANGED
|
@@ -62,9 +62,10 @@ export class WidgetMapbox extends LitElement {
|
|
|
62
62
|
if (f.geometry.coordinates?.length) bounds.extend(f.geometry.coordinates)
|
|
63
63
|
})
|
|
64
64
|
})
|
|
65
|
-
if (
|
|
66
|
-
|
|
65
|
+
if (bounds.isEmpty()) {
|
|
66
|
+
bounds.extend([8.6820917, 50.1106444]) // Frankfurt
|
|
67
67
|
}
|
|
68
|
+
this.map.fitBounds(bounds, { maxZoom: 14, padding: 16, duration: 100 })
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
transformInputData() {
|
|
@@ -82,7 +83,7 @@ export class WidgetMapbox extends LitElement {
|
|
|
82
83
|
}
|
|
83
84
|
})
|
|
84
85
|
// console.log('The input data', this.inputData.dataseries[0], this.inputData.dataseries[1])
|
|
85
|
-
// Pivot
|
|
86
|
+
// Pivot data if required
|
|
86
87
|
this.dataSets = []
|
|
87
88
|
this.inputData.dataseries.forEach((ds) => {
|
|
88
89
|
const color = this.colors.get(ds.label)
|
|
@@ -90,23 +91,20 @@ export class WidgetMapbox extends LitElement {
|
|
|
90
91
|
const derivedColors = tinycolor(color)
|
|
91
92
|
.monochromatic(distincts.length)
|
|
92
93
|
.map((c: any) => c.toHexString())
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
ds.color = ds.color ?? this.colors[ds.label]
|
|
108
|
-
this.dataSets.push(ds)
|
|
109
|
-
}
|
|
94
|
+
|
|
95
|
+
distincts.forEach((piv, i) => {
|
|
96
|
+
const prefix = piv ? `${piv} - ` : ''
|
|
97
|
+
const pds: any = {
|
|
98
|
+
label: prefix + ds.label ?? '',
|
|
99
|
+
order: ds.order,
|
|
100
|
+
type: ds.type,
|
|
101
|
+
latestValues: ds.latestValues,
|
|
102
|
+
color: derivedColors[i],
|
|
103
|
+
config: ds.config,
|
|
104
|
+
data: distincts.length === 1 ? ds.data : ds.data?.filter((d) => d.pivot === piv)
|
|
105
|
+
}
|
|
106
|
+
this.dataSets.push(pds)
|
|
107
|
+
})
|
|
110
108
|
})
|
|
111
109
|
|
|
112
110
|
this.inputData.dataseries = []
|
|
@@ -192,7 +190,8 @@ export class WidgetMapbox extends LitElement {
|
|
|
192
190
|
type: 'circle',
|
|
193
191
|
source: 'input:' + dataSet.label,
|
|
194
192
|
paint: {
|
|
195
|
-
|
|
193
|
+
'circle-blur': dataSet.config?.['circle']?.['circle-blur'] ?? 0,
|
|
194
|
+
'circle-opacity': dataSet.config?.['circle']?.['circle-opacity'] ?? 1,
|
|
196
195
|
'circle-radius': ['get', 'value'],
|
|
197
196
|
'circle-radius-transition': {
|
|
198
197
|
duration: 1000,
|
|
@@ -213,11 +212,11 @@ export class WidgetMapbox extends LitElement {
|
|
|
213
212
|
source: 'input:' + dataSet.label,
|
|
214
213
|
layout: {
|
|
215
214
|
'text-field': ['get', 'value'],
|
|
216
|
-
'text-size': dataSet.config['symbol']['text-size'],
|
|
215
|
+
'text-size': dataSet.config['symbol']?.['text-size'] ?? 14,
|
|
217
216
|
'text-anchor': 'center'
|
|
218
217
|
},
|
|
219
218
|
paint: {
|
|
220
|
-
'text-color': dataSet.config['symbol']['text-color']
|
|
219
|
+
'text-color': dataSet.config['symbol']?.['text-color'] ?? '#000'
|
|
221
220
|
}
|
|
222
221
|
// Place polygons under labels, roads and buildings.
|
|
223
222
|
// 'aeroway-polygon'
|
|
@@ -233,7 +232,7 @@ export class WidgetMapbox extends LitElement {
|
|
|
233
232
|
source: 'input:' + dataSet.label,
|
|
234
233
|
layout: {
|
|
235
234
|
'text-field': ['get', 'value'],
|
|
236
|
-
'text-size': dataSet.config?.['symbol']?.['text-size'],
|
|
235
|
+
'text-size': dataSet.config?.['symbol']?.['text-size'] ?? 14,
|
|
237
236
|
'text-anchor': 'center',
|
|
238
237
|
'icon-image': dataSet.config?.symbol?.['icon-image'],
|
|
239
238
|
'icon-size': dataSet.config?.symbol?.['icon-size']
|
|
@@ -340,8 +339,8 @@ export class WidgetMapbox extends LitElement {
|
|
|
340
339
|
type: 'symbol',
|
|
341
340
|
source: 'input:' + dataSet.label,
|
|
342
341
|
layout: {
|
|
343
|
-
'icon-image': dataSet.config.symbol['icon-image'],
|
|
344
|
-
'icon-size': dataSet.config.symbol['icon-size']
|
|
342
|
+
'icon-image': dataSet.config.symbol?.['icon-image'],
|
|
343
|
+
'icon-size': dataSet.config.symbol?.['icon-size']
|
|
345
344
|
},
|
|
346
345
|
paint: {
|
|
347
346
|
'icon-color': dataSet.color
|