-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathstyles.ts
147 lines (145 loc) · 3.56 KB
/
styles.ts
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import type { DrawStyle } from '@/plugins/draw/types.ts';
export const DefaultDrawStyles: DrawStyle[] = [
// ACTIVE (being drawn)
// line stroke
{
id : 'gl-draw-line',
type : 'line',
filter: [ 'all', [ '==', '$type', 'LineString' ], [ '!=', 'mode', 'static' ] ],
layout: {
'line-cap' : 'round',
'line-join': 'round'
},
paint : {
'line-color' : '#e74b3c',
'line-dasharray': [ 0.2, 2 ],
'line-width' : 2
}
},
// polygon fill
{
id : 'gl-draw-polygon-fill',
type : 'fill',
filter: [ 'all', [ '==', '$type', 'Polygon' ], [ '!=', 'mode', 'static' ] ],
paint : {
'fill-color' : '#3c99e7',
'fill-outline-color': '#3c99e7',
'fill-opacity' : 0.1
}
},
// polygon fill below min area size
{
id : 'gl-draw-polygon-fill-below-min-area-size',
type : 'fill',
filter: [ 'all', [ '==', '$type', 'Polygon' ], [ '==', 'tooSmall', true ] ],
paint : {
'fill-pattern': 'maplibre-draw-min-area-pattern'
}
},
// polygon label below min area size
{
id : 'gl-draw-polygon-fill-below-min-area-size-label',
type : 'symbol',
filter: [ 'all', [ '==', '$type', 'Polygon' ], [ '==', 'tooSmall', true ], [ 'has', 'minSizeLabel' ] ],
layout: {
'text-field' : [ 'get', 'minSizeLabel' ],
'text-font' : [ 'Open Sans Bold' ],
'text-size' : 24,
'text-justify' : 'center',
'text-anchor' : 'center'
},
paint : {
'text-color' : '#e74b3c',
'text-halo-color': '#fff',
'text-halo-width': 3
}
},
// polygon mid points
{
id : 'gl-draw-polygon-midpoint',
type : 'circle',
filter: [ 'all',
[ '==', '$type', 'Point' ],
[ '==', 'meta', 'midpoint' ] ],
paint : {
'circle-radius': 4,
'circle-color' : '#e74b3c'
}
},
// polygon outline stroke
// This doesn't style the first edge of the polygon, which uses the line stroke styling instead
{
id : 'gl-draw-polygon-stroke-active',
type : 'line',
filter: [ 'all', [ '==', '$type', 'Polygon' ], [ '!=', 'mode', 'static' ] ],
layout: {
'line-cap' : 'round',
'line-join': 'round'
},
paint : {
'line-color' : '#e74b3c',
'line-dasharray': [ 0.2, 2 ],
'line-width' : 2
}
},
// vertex point halos
{
id : 'gl-draw-polygon-and-line-vertex-halo-active',
type : 'circle',
filter: [ 'all', [ '==', 'meta', 'vertex' ], [ '==', '$type', 'Point' ], [ '!=', 'mode', 'static' ] ],
paint : {
'circle-radius': 8,
'circle-color' : '#FFF'
}
},
// vertex points
{
id : 'gl-draw-polygon-and-line-vertex-active',
type : 'circle',
filter: [ 'all', [ '==', 'meta', 'vertex' ], [ '==', '$type', 'Point' ], [ '!=', 'mode', 'static' ] ],
paint : {
'circle-radius': 5,
'circle-color' : '#e74b3c'
}
},
// INACTIVE (static, already drawn)
// line stroke
{
id : 'gl-draw-line-static',
type : 'line',
filter: [ 'all', [ '==', '$type', 'LineString' ], [ '==', 'mode', 'static' ] ],
layout: {
'line-cap' : 'round',
'line-join': 'round'
},
paint : {
'line-color': '#000',
'line-width': 3
}
},
// polygon fill
{
id : 'gl-draw-polygon-fill-static',
type : 'fill',
filter: [ 'all', [ '==', '$type', 'Polygon' ], [ '==', 'mode', 'static' ] ],
paint : {
'fill-color' : '#000',
'fill-outline-color': '#000',
'fill-opacity' : 0.1
}
},
// polygon outline
{
id : 'gl-draw-polygon-stroke-static',
type : 'line',
filter: [ 'all', [ '==', '$type', 'Polygon' ], [ '==', 'mode', 'static' ] ],
layout: {
'line-cap' : 'round',
'line-join': 'round'
},
paint : {
'line-color': '#000',
'line-width': 3
}
}
];