-
Notifications
You must be signed in to change notification settings - Fork 593
/
theme.js
153 lines (151 loc) · 3.05 KB
/
theme.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
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
148
149
150
151
152
153
/* eslint comma-dangle: ["error", "always-multiline"] */
const blue = '#3bb2d0';
const orange = '#fbb03b';
const white = '#fff';
export default [
// Polygons
// Solid fill
// Active state defines color
{
'id': 'gl-draw-polygon-fill',
'type': 'fill',
'filter': [
'all',
['==', '$type', 'Polygon'],
],
'paint': {
'fill-color': [
'case',
['==', ['get', 'active'], 'true'], orange,
blue,
],
'fill-opacity': 0.1,
},
},
// Lines
// Polygon
// Matches Lines AND Polygons
// Active state defines color
{
'id': 'gl-draw-lines',
'type': 'line',
'filter': [
'any',
['==', '$type', 'LineString'],
['==', '$type', 'Polygon'],
],
'layout': {
'line-cap': 'round',
'line-join': 'round',
},
'paint': {
'line-color': [
'case',
['==', ['get', 'active'], 'true'], orange,
blue,
],
'line-dasharray': [
'case',
['==', ['get', 'active'], 'true'], [0.2, 2],
[2, 0],
],
'line-width': 2,
},
},
// Points
// Circle with an outline
// Active state defines size and color
{
'id': 'gl-draw-point-outer',
'type': 'circle',
'filter': [
'all',
['==', '$type', 'Point'],
['==', 'meta', 'feature'],
],
'paint': {
'circle-radius': [
'case',
['==', ['get', 'active'], 'true'], 7,
5,
],
'circle-color': white,
},
},
{
'id': 'gl-draw-point-inner',
'type': 'circle',
'filter': [
'all',
['==', '$type', 'Point'],
['==', 'meta', 'feature'],
],
'paint': {
'circle-radius': [
'case',
['==', ['get', 'active'], 'true'], 5,
3,
],
'circle-color': [
'case',
['==', ['get', 'active'], 'true'], orange,
blue,
],
},
},
// Vertex
// Visible when editing polygons and lines
// Similar behaviour to Points
// Active state defines size
{
'id': 'gl-draw-vertex-outer',
'type': 'circle',
'filter': [
'all',
['==', '$type', 'Point'],
['==', 'meta', 'vertex'],
['!=', 'mode', 'simple_select'],
],
'paint': {
'circle-radius': [
'case',
['==', ['get', 'active'], 'true'], 7,
5,
],
'circle-color': white,
},
},
{
'id': 'gl-draw-vertex-inner',
'type': 'circle',
'filter': [
'all',
['==', '$type', 'Point'],
['==', 'meta', 'vertex'],
['!=', 'mode', 'simple_select'],
],
'paint': {
'circle-radius': [
'case',
['==', ['get', 'active'], 'true'], 5,
3,
],
'circle-color': orange,
},
},
// Midpoint
// Visible when editing polygons and lines
// Tapping or dragging them adds a new vertex to the feature
{
'id': 'gl-draw-midpoint',
'type': 'circle',
'filter': [
'all',
['==', 'meta', 'midpoint'],
],
'paint': {
'circle-radius': 3,
'circle-color': orange,
},
},
];