@ohuoy/easymap 1.0.24 → 1.0.26
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/{src/components/control → lib/mapbox-gl-draw/src}/extendMode/direct_select_rect.js +1 -1
- package/{src/components/control → lib/mapbox-gl-draw/src}/extendMode/simple_select_rect.js +1 -1
- package/lib/mapbox-gl-draw/src/lib/common_selectors.js +4 -0
- package/lib/mapbox-gl-draw/src/lib/geojson-area.js +92 -0
- package/lib/mapbox-gl-draw/src/lib/mouse_event_point.js +1 -1
- package/lib/mapbox-gl-draw/src/lib/point-geometry.js +314 -0
- package/lib/mapbox-gl-draw/src/lib/sort_features.js +1 -1
- package/package.json +1 -1
- package/src/components/control/DrawBar.js +3 -3
- package/src/components/control/constants.js +0 -101
- package/src/components/control/lib/common_selectors.js +0 -68
- package/src/components/control/lib/constrain_feature_movement.js +0 -83
- package/src/components/control/lib/create_midpoint.js +0 -35
- package/src/components/control/lib/create_supplementary_points.js +0 -83
- package/src/components/control/lib/create_vertex.js +0 -29
- package/src/components/control/lib/double_click_zoom.js +0 -18
- package/src/components/control/lib/euclidean_distance.js +0 -5
- package/src/components/control/lib/features_at.js +0 -48
- package/src/components/control/lib/get_features_and_set_cursor.js +0 -22
- package/src/components/control/lib/id.js +0 -7
- package/src/components/control/lib/index.js +0 -43
- package/src/components/control/lib/is_click.js +0 -18
- package/src/components/control/lib/is_event_at_coordinates.js +0 -6
- package/src/components/control/lib/is_tap.js +0 -15
- package/src/components/control/lib/map_event_to_bounding_box.js +0 -14
- package/src/components/control/lib/mode_handler.js +0 -116
- package/src/components/control/lib/mouse_event_point.js +0 -19
- package/src/components/control/lib/move_features.js +0 -33
- package/src/components/control/lib/sort_features.js +0 -38
- package/src/components/control/lib/string_set.js +0 -55
- package/src/components/control/lib/string_sets_are_equal.js +0 -4
- package/src/components/control/lib/theme.js +0 -153
- package/src/components/control/lib/to_dense_array.js +0 -11
- /package/{src/components/control → lib/mapbox-gl-draw/src}/extendMode/rectmode.js +0 -0
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
function StringSet(items) {
|
|
2
|
-
this._items = {};
|
|
3
|
-
this._nums = {};
|
|
4
|
-
this._length = items ? items.length : 0;
|
|
5
|
-
if (!items) return;
|
|
6
|
-
for (let i = 0, l = items.length; i < l; i++) {
|
|
7
|
-
this.add(items[i]);
|
|
8
|
-
if (items[i] === undefined) continue;
|
|
9
|
-
if (typeof items[i] === 'string') this._items[items[i]] = i;
|
|
10
|
-
else this._nums[items[i]] = i;
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
StringSet.prototype.add = function(x) {
|
|
16
|
-
if (this.has(x)) return this;
|
|
17
|
-
this._length++;
|
|
18
|
-
if (typeof x === 'string') this._items[x] = this._length;
|
|
19
|
-
else this._nums[x] = this._length;
|
|
20
|
-
return this;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
StringSet.prototype.delete = function(x) {
|
|
24
|
-
if (this.has(x) === false) return this;
|
|
25
|
-
this._length--;
|
|
26
|
-
delete this._items[x];
|
|
27
|
-
delete this._nums[x];
|
|
28
|
-
return this;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
StringSet.prototype.has = function(x) {
|
|
32
|
-
if (typeof x !== 'string' && typeof x !== 'number') return false;
|
|
33
|
-
return this._items[x] !== undefined || this._nums[x] !== undefined;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
StringSet.prototype.values = function() {
|
|
37
|
-
const values = [];
|
|
38
|
-
Object.keys(this._items).forEach((k) => {
|
|
39
|
-
values.push({ k, v: this._items[k] });
|
|
40
|
-
});
|
|
41
|
-
Object.keys(this._nums).forEach((k) => {
|
|
42
|
-
values.push({ k: JSON.parse(k), v: this._nums[k] });
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return values.sort((a, b) => a.v - b.v).map(a => a.k);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
StringSet.prototype.clear = function() {
|
|
49
|
-
this._length = 0;
|
|
50
|
-
this._items = {};
|
|
51
|
-
this._nums = {};
|
|
52
|
-
return this;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export default StringSet;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/* eslint comma-dangle: ["error", "always-multiline"] */
|
|
2
|
-
|
|
3
|
-
const blue = '#3bb2d0';
|
|
4
|
-
const orange = '#fbb03b';
|
|
5
|
-
const white = '#fff';
|
|
6
|
-
|
|
7
|
-
export default [
|
|
8
|
-
// Polygons
|
|
9
|
-
// Solid fill
|
|
10
|
-
// Active state defines color
|
|
11
|
-
{
|
|
12
|
-
'id': 'gl-draw-polygon-fill',
|
|
13
|
-
'type': 'fill',
|
|
14
|
-
'filter': [
|
|
15
|
-
'all',
|
|
16
|
-
['==', '$type', 'Polygon'],
|
|
17
|
-
],
|
|
18
|
-
'paint': {
|
|
19
|
-
'fill-color': [
|
|
20
|
-
'case',
|
|
21
|
-
['==', ['get', 'active'], 'true'], orange,
|
|
22
|
-
blue,
|
|
23
|
-
],
|
|
24
|
-
'fill-opacity': 0.1,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
// Lines
|
|
28
|
-
// Polygon
|
|
29
|
-
// Matches Lines AND Polygons
|
|
30
|
-
// Active state defines color
|
|
31
|
-
{
|
|
32
|
-
'id': 'gl-draw-lines',
|
|
33
|
-
'type': 'line',
|
|
34
|
-
'filter': [
|
|
35
|
-
'any',
|
|
36
|
-
['==', '$type', 'LineString'],
|
|
37
|
-
['==', '$type', 'Polygon'],
|
|
38
|
-
],
|
|
39
|
-
'layout': {
|
|
40
|
-
'line-cap': 'round',
|
|
41
|
-
'line-join': 'round',
|
|
42
|
-
},
|
|
43
|
-
'paint': {
|
|
44
|
-
'line-color': [
|
|
45
|
-
'case',
|
|
46
|
-
['==', ['get', 'active'], 'true'], orange,
|
|
47
|
-
blue,
|
|
48
|
-
],
|
|
49
|
-
'line-dasharray': [
|
|
50
|
-
'case',
|
|
51
|
-
['==', ['get', 'active'], 'true'], [0.2, 2],
|
|
52
|
-
[2, 0],
|
|
53
|
-
],
|
|
54
|
-
'line-width': 2,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
// Points
|
|
58
|
-
// Circle with an outline
|
|
59
|
-
// Active state defines size and color
|
|
60
|
-
{
|
|
61
|
-
'id': 'gl-draw-point-outer',
|
|
62
|
-
'type': 'circle',
|
|
63
|
-
'filter': [
|
|
64
|
-
'all',
|
|
65
|
-
['==', '$type', 'Point'],
|
|
66
|
-
['==', 'meta', 'feature'],
|
|
67
|
-
],
|
|
68
|
-
'paint': {
|
|
69
|
-
'circle-radius': [
|
|
70
|
-
'case',
|
|
71
|
-
['==', ['get', 'active'], 'true'], 7,
|
|
72
|
-
5,
|
|
73
|
-
],
|
|
74
|
-
'circle-color': white,
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
'id': 'gl-draw-point-inner',
|
|
79
|
-
'type': 'circle',
|
|
80
|
-
'filter': [
|
|
81
|
-
'all',
|
|
82
|
-
['==', '$type', 'Point'],
|
|
83
|
-
['==', 'meta', 'feature'],
|
|
84
|
-
],
|
|
85
|
-
'paint': {
|
|
86
|
-
'circle-radius': [
|
|
87
|
-
'case',
|
|
88
|
-
['==', ['get', 'active'], 'true'], 5,
|
|
89
|
-
3,
|
|
90
|
-
],
|
|
91
|
-
'circle-color': [
|
|
92
|
-
'case',
|
|
93
|
-
['==', ['get', 'active'], 'true'], orange,
|
|
94
|
-
blue,
|
|
95
|
-
],
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
// Vertex
|
|
99
|
-
// Visible when editing polygons and lines
|
|
100
|
-
// Similar behaviour to Points
|
|
101
|
-
// Active state defines size
|
|
102
|
-
{
|
|
103
|
-
'id': 'gl-draw-vertex-outer',
|
|
104
|
-
'type': 'circle',
|
|
105
|
-
'filter': [
|
|
106
|
-
'all',
|
|
107
|
-
['==', '$type', 'Point'],
|
|
108
|
-
['==', 'meta', 'vertex'],
|
|
109
|
-
['!=', 'mode', 'simple_select'],
|
|
110
|
-
],
|
|
111
|
-
'paint': {
|
|
112
|
-
'circle-radius': [
|
|
113
|
-
'case',
|
|
114
|
-
['==', ['get', 'active'], 'true'], 7,
|
|
115
|
-
5,
|
|
116
|
-
],
|
|
117
|
-
'circle-color': white,
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
'id': 'gl-draw-vertex-inner',
|
|
122
|
-
'type': 'circle',
|
|
123
|
-
'filter': [
|
|
124
|
-
'all',
|
|
125
|
-
['==', '$type', 'Point'],
|
|
126
|
-
['==', 'meta', 'vertex'],
|
|
127
|
-
['!=', 'mode', 'simple_select'],
|
|
128
|
-
],
|
|
129
|
-
'paint': {
|
|
130
|
-
'circle-radius': [
|
|
131
|
-
'case',
|
|
132
|
-
['==', ['get', 'active'], 'true'], 5,
|
|
133
|
-
3,
|
|
134
|
-
],
|
|
135
|
-
'circle-color': orange,
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
// Midpoint
|
|
139
|
-
// Visible when editing polygons and lines
|
|
140
|
-
// Tapping or dragging them adds a new vertex to the feature
|
|
141
|
-
{
|
|
142
|
-
'id': 'gl-draw-midpoint',
|
|
143
|
-
'type': 'circle',
|
|
144
|
-
'filter': [
|
|
145
|
-
'all',
|
|
146
|
-
['==', 'meta', 'midpoint'],
|
|
147
|
-
],
|
|
148
|
-
'paint': {
|
|
149
|
-
'circle-radius': 3,
|
|
150
|
-
'circle-color': orange,
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
];
|
|
File without changes
|