forked from stamen/maperture
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-config.js
69 lines (61 loc) · 1.39 KB
/
make-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const makeConfig = localConfig => {
const defaultGazetteer = {
Scenarios: [
{ 'Zoomed out': { pitch: 0, zoom: 10 } },
{ 'Zoomed in/Tilted': { pitch: 45, zoom: 16 } },
],
Locations: [
{
'San Francisco, CA': {
zoom: 18,
center: { lng: -122.4193, lat: 37.7648 },
},
},
{
'Washington DC': { zoom: 12, center: { lng: -77.0435, lat: 38.9098 } },
},
],
};
const defaultStyles = [
{
id: 'mapbox-streets',
name: 'Mapbox Streets',
type: 'mapbox-gl',
url: 'mapbox://styles/mapbox/streets-v11',
},
{
id: 'mapbox-light',
name: 'Mapbox Light',
type: 'mapbox-gl',
url: 'mapbox://styles/mapbox/light-v10',
},
];
const defaultMapState = {
bearing: 0,
center: { lng: -73.92169, lat: 40.83962 },
pitch: 0,
showCollisions: false,
zoom: 13.25,
};
const defaultMaps = defaultStyles.map(
(style, i) => localConfig?.stylePresets?.[i] ?? style
);
const defaultViewMode = 'swipe';
const defaultBranchPatterns = [
{
pattern: '',
styles: [],
},
];
const config = {
maps: defaultMaps,
mapState: defaultMapState,
viewMode: defaultViewMode,
gazetteer: defaultGazetteer,
branchPatterns: defaultBranchPatterns,
stylePresetUrls: [],
...localConfig,
};
return config;
};
export { makeConfig };