@antv/l7-map 2.21.0 → 2.21.2

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.
Files changed (158) hide show
  1. package/es/camera.js +595 -674
  2. package/es/earthmap.js +313 -276
  3. package/es/geo/edge_insets.js +57 -72
  4. package/es/geo/lng_lat.js +50 -64
  5. package/es/geo/lng_lat_bounds.js +101 -137
  6. package/es/geo/mercator.js +23 -35
  7. package/es/geo/point.js +150 -221
  8. package/es/geo/simple.js +22 -34
  9. package/es/geo/transform.js +839 -905
  10. package/es/handler/blockable_map_event.js +46 -66
  11. package/es/handler/box_zoom.js +125 -143
  12. package/es/handler/click_zoom.js +37 -51
  13. package/es/handler/events/event.js +11 -9
  14. package/es/handler/events/map_mouse_event.js +39 -54
  15. package/es/handler/events/map_touch_event.js +54 -73
  16. package/es/handler/events/map_wheel_event.js +22 -38
  17. package/es/handler/events/render_event.js +6 -23
  18. package/es/handler/handler_inertia.js +98 -113
  19. package/es/handler/handler_manager.js +349 -437
  20. package/es/handler/handler_util.js +2 -2
  21. package/es/handler/keyboard.js +98 -110
  22. package/es/handler/map_event.js +81 -117
  23. package/es/handler/mouse/mouse_handler.js +81 -100
  24. package/es/handler/mouse/mousepan_handler.js +16 -39
  25. package/es/handler/mouse/mousepitch_hander.js +18 -40
  26. package/es/handler/mouse/mouserotate_hander.js +18 -40
  27. package/es/handler/mouse/util.js +7 -6
  28. package/es/handler/scroll_zoom.js +221 -231
  29. package/es/handler/shim/dblclick_zoom.js +36 -47
  30. package/es/handler/shim/drag_pan.js +41 -50
  31. package/es/handler/shim/drag_rotate.js +38 -48
  32. package/es/handler/shim/touch_zoom_rotate.js +68 -79
  33. package/es/handler/tap/single_tap_recognizer.js +60 -80
  34. package/es/handler/tap/tap_drag_zoom.js +72 -89
  35. package/es/handler/tap/tap_recognizer.js +37 -45
  36. package/es/handler/tap/tap_zoom.js +67 -95
  37. package/es/handler/touch/touch_pan.js +77 -96
  38. package/es/handler/touch/touch_pitch.js +61 -79
  39. package/es/handler/touch/touch_rotate.js +47 -67
  40. package/es/handler/touch/touch_zoom.js +29 -46
  41. package/es/handler/touch/two_touch.js +79 -104
  42. package/es/hash.js +75 -88
  43. package/es/map.js +318 -284
  44. package/es/util.js +18 -37
  45. package/es/utils/Aabb.js +60 -100
  46. package/es/utils/dom.js +32 -55
  47. package/es/utils/performance.js +25 -29
  48. package/es/utils/primitives.js +33 -43
  49. package/es/utils/task_queue.js +47 -76
  50. package/lib/camera.d.ts +86 -0
  51. package/lib/camera.js +597 -672
  52. package/lib/earthmap.d.ts +69 -0
  53. package/lib/earthmap.js +314 -276
  54. package/lib/geo/edge_insets.d.ts +54 -0
  55. package/lib/geo/edge_insets.js +58 -70
  56. package/lib/geo/lng_lat.d.ts +18 -0
  57. package/lib/geo/lng_lat.js +50 -62
  58. package/lib/geo/lng_lat_bounds.d.ts +25 -0
  59. package/lib/geo/lng_lat_bounds.js +102 -136
  60. package/lib/geo/mercator.d.ts +30 -0
  61. package/lib/geo/mercator.js +26 -37
  62. package/lib/geo/point.d.ts +40 -0
  63. package/lib/geo/point.js +151 -220
  64. package/lib/geo/simple.d.ts +30 -0
  65. package/lib/geo/simple.js +25 -36
  66. package/lib/geo/transform.d.ts +198 -0
  67. package/lib/geo/transform.js +844 -907
  68. package/lib/handler/IHandler.d.ts +34 -0
  69. package/lib/handler/blockable_map_event.d.ts +17 -0
  70. package/lib/handler/blockable_map_event.js +48 -65
  71. package/lib/handler/box_zoom.d.ts +59 -0
  72. package/lib/handler/box_zoom.js +126 -143
  73. package/lib/handler/click_zoom.d.ts +16 -0
  74. package/lib/handler/click_zoom.js +38 -50
  75. package/lib/handler/events/event.d.ts +4 -0
  76. package/lib/handler/events/event.js +12 -9
  77. package/lib/handler/events/index.d.ts +4 -0
  78. package/lib/handler/events/index.js +3 -3
  79. package/lib/handler/events/map_mouse_event.d.ts +34 -0
  80. package/lib/handler/events/map_mouse_event.js +41 -52
  81. package/lib/handler/events/map_touch_event.d.ts +57 -0
  82. package/lib/handler/events/map_touch_event.js +56 -71
  83. package/lib/handler/events/map_wheel_event.d.ts +33 -0
  84. package/lib/handler/events/map_wheel_event.js +23 -37
  85. package/lib/handler/events/render_event.d.ts +5 -0
  86. package/lib/handler/events/render_event.js +7 -22
  87. package/lib/handler/handler_inertia.d.ts +23 -0
  88. package/lib/handler/handler_inertia.js +102 -112
  89. package/lib/handler/handler_manager.d.ts +61 -0
  90. package/lib/handler/handler_manager.js +351 -437
  91. package/lib/handler/handler_util.d.ts +4 -0
  92. package/lib/handler/handler_util.js +2 -2
  93. package/lib/handler/keyboard.d.ts +36 -0
  94. package/lib/handler/keyboard.js +98 -110
  95. package/lib/handler/map_event.d.ts +29 -0
  96. package/lib/handler/map_event.js +83 -116
  97. package/lib/handler/mouse/index.d.ts +4 -0
  98. package/lib/handler/mouse/index.js +3 -3
  99. package/lib/handler/mouse/mouse_handler.d.ts +22 -0
  100. package/lib/handler/mouse/mouse_handler.js +83 -99
  101. package/lib/handler/mouse/mousepan_handler.d.ts +10 -0
  102. package/lib/handler/mouse/mousepan_handler.js +19 -38
  103. package/lib/handler/mouse/mousepitch_hander.d.ts +9 -0
  104. package/lib/handler/mouse/mousepitch_hander.js +21 -39
  105. package/lib/handler/mouse/mouserotate_hander.d.ts +9 -0
  106. package/lib/handler/mouse/mouserotate_hander.js +21 -39
  107. package/lib/handler/mouse/util.d.ts +6 -0
  108. package/lib/handler/mouse/util.js +7 -7
  109. package/lib/handler/scroll_zoom.d.ts +93 -0
  110. package/lib/handler/scroll_zoom.js +221 -231
  111. package/lib/handler/shim/dblclick_zoom.d.ts +40 -0
  112. package/lib/handler/shim/dblclick_zoom.js +37 -46
  113. package/lib/handler/shim/drag_pan.d.ts +61 -0
  114. package/lib/handler/shim/drag_pan.js +42 -49
  115. package/lib/handler/shim/drag_rotate.d.ts +46 -0
  116. package/lib/handler/shim/drag_rotate.js +39 -47
  117. package/lib/handler/shim/touch_zoom_rotate.d.ts +70 -0
  118. package/lib/handler/shim/touch_zoom_rotate.js +69 -78
  119. package/lib/handler/tap/single_tap_recognizer.d.ts +20 -0
  120. package/lib/handler/tap/single_tap_recognizer.js +63 -79
  121. package/lib/handler/tap/tap_drag_zoom.d.ts +22 -0
  122. package/lib/handler/tap/tap_drag_zoom.js +74 -88
  123. package/lib/handler/tap/tap_recognizer.d.ts +17 -0
  124. package/lib/handler/tap/tap_recognizer.js +41 -47
  125. package/lib/handler/tap/tap_zoom.d.ts +22 -0
  126. package/lib/handler/tap/tap_zoom.js +69 -94
  127. package/lib/handler/touch/index.d.ts +5 -0
  128. package/lib/handler/touch/index.js +4 -4
  129. package/lib/handler/touch/touch_pan.d.ts +30 -0
  130. package/lib/handler/touch/touch_pan.js +79 -95
  131. package/lib/handler/touch/touch_pitch.d.ts +13 -0
  132. package/lib/handler/touch/touch_pitch.js +64 -78
  133. package/lib/handler/touch/touch_rotate.d.ts +12 -0
  134. package/lib/handler/touch/touch_rotate.js +50 -66
  135. package/lib/handler/touch/touch_zoom.d.ts +12 -0
  136. package/lib/handler/touch/touch_zoom.js +32 -45
  137. package/lib/handler/touch/two_touch.d.ts +23 -0
  138. package/lib/handler/touch/two_touch.js +81 -103
  139. package/lib/hash.d.ts +14 -0
  140. package/lib/hash.js +75 -88
  141. package/lib/index.d.ts +4 -0
  142. package/lib/index.js +4 -4
  143. package/lib/interface.d.ts +34 -0
  144. package/lib/map.d.ts +70 -0
  145. package/lib/map.js +319 -284
  146. package/lib/util.d.ts +25 -0
  147. package/lib/util.js +20 -36
  148. package/lib/utils/Aabb.d.ts +12 -0
  149. package/lib/utils/Aabb.js +61 -99
  150. package/lib/utils/dom.d.ts +4 -0
  151. package/lib/utils/dom.js +34 -55
  152. package/lib/utils/performance.d.ts +17 -0
  153. package/lib/utils/performance.js +25 -29
  154. package/lib/utils/primitives.d.ts +6 -0
  155. package/lib/utils/primitives.js +34 -42
  156. package/lib/utils/task_queue.d.ts +13 -0
  157. package/lib/utils/task_queue.js +47 -76
  158. package/package.json +25 -32
package/es/geo/point.js CHANGED
@@ -1,224 +1,153 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- var Point = /*#__PURE__*/function () {
4
- function Point(x, y) {
5
- _classCallCheck(this, Point);
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ export default class Point {
3
+ static convert(a) {
4
+ if (a instanceof Point) {
5
+ return a;
6
+ }
7
+ if (Array.isArray(a)) {
8
+ return new Point(a[0], a[1]);
9
+ }
10
+ return a;
11
+ }
12
+ constructor(x, y) {
13
+ _defineProperty(this, "x", void 0);
14
+ _defineProperty(this, "y", void 0);
6
15
  this.x = x;
7
16
  this.y = y;
8
17
  }
9
- _createClass(Point, [{
10
- key: "clone",
11
- value: function clone() {
12
- return new Point(this.x, this.y);
13
- }
14
- }, {
15
- key: "_add",
16
- value: function _add(p) {
17
- this.x += p.x;
18
- this.y += p.y;
19
- return this;
20
- }
21
- }, {
22
- key: "add",
23
- value: function add(p) {
24
- return this.clone()._add(p);
25
- }
26
- }, {
27
- key: "_sub",
28
- value: function _sub(p) {
29
- this.x -= p.x;
30
- this.y -= p.y;
31
- return this;
32
- }
33
- }, {
34
- key: "sub",
35
- value: function sub(p) {
36
- return this.clone()._sub(p);
37
- }
38
- }, {
39
- key: "_multByPoint",
40
- value: function _multByPoint(p) {
41
- this.x *= p.x;
42
- this.y *= p.y;
43
- return this;
44
- }
45
- }, {
46
- key: "multByPoint",
47
- value: function multByPoint(p) {
48
- return this.clone()._multByPoint(p);
49
- }
50
- }, {
51
- key: "_divByPoint",
52
- value: function _divByPoint(p) {
53
- this.x /= p.x;
54
- this.y /= p.y;
55
- return this;
56
- }
57
- }, {
58
- key: "divByPoint",
59
- value: function divByPoint(p) {
60
- return this.clone()._divByPoint(p);
61
- }
62
- }, {
63
- key: "_mult",
64
- value: function _mult(k) {
65
- this.x *= k;
66
- this.y *= k;
67
- return this;
68
- }
69
- }, {
70
- key: "mult",
71
- value: function mult(k) {
72
- return this.clone()._mult(k);
73
- }
74
- }, {
75
- key: "_div",
76
- value: function _div(k) {
77
- this.x /= k;
78
- this.y /= k;
79
- return this;
80
- }
81
- }, {
82
- key: "div",
83
- value: function div(k) {
84
- return this.clone()._div(k);
85
- }
86
- }, {
87
- key: "_rotate",
88
- value: function _rotate(angle) {
89
- var cos = Math.cos(angle);
90
- var sin = Math.sin(angle);
91
- var x = cos * this.x - sin * this.y;
92
- var y = sin * this.x + cos * this.y;
93
- this.x = x;
94
- this.y = y;
95
- return this;
96
- }
97
- }, {
98
- key: "rotate",
99
- value: function rotate(angle) {
100
- return this.clone()._rotate(angle);
101
- }
102
- }, {
103
- key: "_rotateAround",
104
- value: function _rotateAround(angle, p) {
105
- var cos = Math.cos(angle);
106
- var sin = Math.sin(angle);
107
- var x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y);
108
- var y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
109
- this.x = x;
110
- this.y = y;
111
- return this;
112
- }
113
- }, {
114
- key: "roateAround",
115
- value: function roateAround(angle, p) {
116
- return this.clone()._rotateAround(angle, p);
117
- }
118
- }, {
119
- key: "_matMult",
120
- value: function _matMult(m) {
121
- var x = m[0] * this.x + m[1] * this.y;
122
- var y = m[2] * this.x + m[3] * this.y;
123
- this.x = x;
124
- this.y = y;
125
- return this;
126
- }
127
- }, {
128
- key: "matMult",
129
- value: function matMult(m) {
130
- return this.clone()._matMult(m);
131
- }
132
- }, {
133
- key: "_unit",
134
- value: function _unit() {
135
- this.div(this.mag());
136
- return this;
137
- }
138
- }, {
139
- key: "unit",
140
- value: function unit() {
141
- return this.clone()._unit();
142
- }
143
- }, {
144
- key: "_perp",
145
- value: function _perp() {
146
- var y = this.y;
147
- this.y = this.x;
148
- this.x = -y;
149
- return this;
150
- }
151
- }, {
152
- key: "perp",
153
- value: function perp() {
154
- return this.clone()._perp();
155
- }
156
- }, {
157
- key: "_round",
158
- value: function _round() {
159
- this.x = Math.round(this.x);
160
- this.y = Math.round(this.y);
161
- return this;
162
- }
163
- }, {
164
- key: "round",
165
- value: function round() {
166
- return this.clone()._round();
167
- }
168
- }, {
169
- key: "mag",
170
- value: function mag() {
171
- return Math.sqrt(this.x * this.x + this.y * this.y);
172
- }
173
- }, {
174
- key: "equals",
175
- value: function equals(other) {
176
- return this.x === other.x && this.y === other.y;
177
- }
178
- }, {
179
- key: "dist",
180
- value: function dist(p) {
181
- return Math.sqrt(this.distSqr(p));
182
- }
183
- }, {
184
- key: "distSqr",
185
- value: function distSqr(p) {
186
- var dx = p.x - this.x;
187
- var dy = p.y - this.y;
188
- return dx * dx + dy * dy;
189
- }
190
- }, {
191
- key: "angle",
192
- value: function angle() {
193
- return Math.atan2(this.y, this.x);
194
- }
195
- }, {
196
- key: "angleTo",
197
- value: function angleTo(b) {
198
- return Math.atan2(this.y - b.y, this.x - b.x);
199
- }
200
- }, {
201
- key: "angleWith",
202
- value: function angleWith(b) {
203
- return this.angleWithSep(b.x, b.y);
204
- }
205
- }, {
206
- key: "angleWithSep",
207
- value: function angleWithSep(x, y) {
208
- return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
209
- }
210
- }], [{
211
- key: "convert",
212
- value: function convert(a) {
213
- if (a instanceof Point) {
214
- return a;
215
- }
216
- if (Array.isArray(a)) {
217
- return new Point(a[0], a[1]);
218
- }
219
- return a;
220
- }
221
- }]);
222
- return Point;
223
- }();
224
- export { Point as default };
18
+ clone() {
19
+ return new Point(this.x, this.y);
20
+ }
21
+ _add(p) {
22
+ this.x += p.x;
23
+ this.y += p.y;
24
+ return this;
25
+ }
26
+ add(p) {
27
+ return this.clone()._add(p);
28
+ }
29
+ _sub(p) {
30
+ this.x -= p.x;
31
+ this.y -= p.y;
32
+ return this;
33
+ }
34
+ sub(p) {
35
+ return this.clone()._sub(p);
36
+ }
37
+ _multByPoint(p) {
38
+ this.x *= p.x;
39
+ this.y *= p.y;
40
+ return this;
41
+ }
42
+ multByPoint(p) {
43
+ return this.clone()._multByPoint(p);
44
+ }
45
+ _divByPoint(p) {
46
+ this.x /= p.x;
47
+ this.y /= p.y;
48
+ return this;
49
+ }
50
+ divByPoint(p) {
51
+ return this.clone()._divByPoint(p);
52
+ }
53
+ _mult(k) {
54
+ this.x *= k;
55
+ this.y *= k;
56
+ return this;
57
+ }
58
+ mult(k) {
59
+ return this.clone()._mult(k);
60
+ }
61
+ _div(k) {
62
+ this.x /= k;
63
+ this.y /= k;
64
+ return this;
65
+ }
66
+ div(k) {
67
+ return this.clone()._div(k);
68
+ }
69
+ _rotate(angle) {
70
+ const cos = Math.cos(angle);
71
+ const sin = Math.sin(angle);
72
+ const x = cos * this.x - sin * this.y;
73
+ const y = sin * this.x + cos * this.y;
74
+ this.x = x;
75
+ this.y = y;
76
+ return this;
77
+ }
78
+ rotate(angle) {
79
+ return this.clone()._rotate(angle);
80
+ }
81
+ _rotateAround(angle, p) {
82
+ const cos = Math.cos(angle);
83
+ const sin = Math.sin(angle);
84
+ const x = p.x + cos * (this.x - p.x) - sin * (this.y - p.y);
85
+ const y = p.y + sin * (this.x - p.x) + cos * (this.y - p.y);
86
+ this.x = x;
87
+ this.y = y;
88
+ return this;
89
+ }
90
+ roateAround(angle, p) {
91
+ return this.clone()._rotateAround(angle, p);
92
+ }
93
+ _matMult(m) {
94
+ const x = m[0] * this.x + m[1] * this.y;
95
+ const y = m[2] * this.x + m[3] * this.y;
96
+ this.x = x;
97
+ this.y = y;
98
+ return this;
99
+ }
100
+ matMult(m) {
101
+ return this.clone()._matMult(m);
102
+ }
103
+ _unit() {
104
+ this.div(this.mag());
105
+ return this;
106
+ }
107
+ unit() {
108
+ return this.clone()._unit();
109
+ }
110
+ _perp() {
111
+ const y = this.y;
112
+ this.y = this.x;
113
+ this.x = -y;
114
+ return this;
115
+ }
116
+ perp() {
117
+ return this.clone()._perp();
118
+ }
119
+ _round() {
120
+ this.x = Math.round(this.x);
121
+ this.y = Math.round(this.y);
122
+ return this;
123
+ }
124
+ round() {
125
+ return this.clone()._round();
126
+ }
127
+ mag() {
128
+ return Math.sqrt(this.x * this.x + this.y * this.y);
129
+ }
130
+ equals(other) {
131
+ return this.x === other.x && this.y === other.y;
132
+ }
133
+ dist(p) {
134
+ return Math.sqrt(this.distSqr(p));
135
+ }
136
+ distSqr(p) {
137
+ const dx = p.x - this.x;
138
+ const dy = p.y - this.y;
139
+ return dx * dx + dy * dy;
140
+ }
141
+ angle() {
142
+ return Math.atan2(this.y, this.x);
143
+ }
144
+ angleTo(b) {
145
+ return Math.atan2(this.y - b.y, this.x - b.x);
146
+ }
147
+ angleWith(b) {
148
+ return this.angleWithSep(b.x, b.y);
149
+ }
150
+ angleWithSep(x, y) {
151
+ return Math.atan2(this.x * y - this.y * x, this.x * x + this.y * y);
152
+ }
153
+ }
package/es/geo/simple.js CHANGED
@@ -1,11 +1,10 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
2
  import LngLat, { earthRadius } from "../geo/lng_lat";
4
3
 
5
4
  /*
6
5
  * The average circumference of the world in meters.
7
6
  */
8
- var earthCircumfrence = 2 * Math.PI * earthRadius; // meters
7
+ const earthCircumfrence = 2 * Math.PI * earthRadius; // meters
9
8
 
10
9
  /*
11
10
  * The circumference at a line of latitude in meters.
@@ -50,38 +49,27 @@ export function altitudeFromMercatorZ(z, y) {
50
49
  export function mercatorScale(lat) {
51
50
  return 1;
52
51
  }
53
- var SimpleCoordinate = /*#__PURE__*/function () {
54
- function SimpleCoordinate(x, y) {
55
- var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
56
- _classCallCheck(this, SimpleCoordinate);
52
+ export default class SimpleCoordinate {
53
+ static fromLngLat(lngLatLike, altitude = 0) {
54
+ const lngLat = LngLat.convert(lngLatLike);
55
+ return new SimpleCoordinate(mercatorXfromLng(lngLat.lng), mercatorYfromLat(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));
56
+ }
57
+ constructor(x, y, z = 0) {
58
+ _defineProperty(this, "x", void 0);
59
+ _defineProperty(this, "y", void 0);
60
+ _defineProperty(this, "z", void 0);
57
61
  this.x = +x;
58
62
  this.y = +y;
59
63
  this.z = +z;
60
64
  }
61
- _createClass(SimpleCoordinate, [{
62
- key: "toLngLat",
63
- value: function toLngLat() {
64
- return new LngLat(this.x, this.y);
65
- }
66
- }, {
67
- key: "toAltitude",
68
- value: function toAltitude() {
69
- return this.z;
70
- }
71
- }, {
72
- key: "meterInMercatorCoordinateUnits",
73
- value: function meterInMercatorCoordinateUnits() {
74
- // 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
75
- return 1;
76
- }
77
- }], [{
78
- key: "fromLngLat",
79
- value: function fromLngLat(lngLatLike) {
80
- var altitude = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
81
- var lngLat = LngLat.convert(lngLatLike);
82
- return new SimpleCoordinate(mercatorXfromLng(lngLat.lng), mercatorYfromLat(lngLat.lat), mercatorZfromAltitude(altitude, lngLat.lat));
83
- }
84
- }]);
85
- return SimpleCoordinate;
86
- }();
87
- export { SimpleCoordinate as default };
65
+ toLngLat() {
66
+ return new LngLat(this.x, this.y);
67
+ }
68
+ toAltitude() {
69
+ return this.z;
70
+ }
71
+ meterInMercatorCoordinateUnits() {
72
+ // 1 meter / circumference at equator in meters * Mercator projection scale factor at this latitude
73
+ return 1;
74
+ }
75
+ }