@antv/l7-map 2.21.1 → 2.21.3

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 -5
  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 -42
  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 -6
  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 -41
  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
@@ -1,78 +1,58 @@
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
  // @ts-ignore
4
3
 
5
4
  import { MapMouseEvent } from "./events";
6
- var BlockableMapEventHandler = /*#__PURE__*/function () {
7
- function BlockableMapEventHandler(map) {
8
- _classCallCheck(this, BlockableMapEventHandler);
5
+ export default class BlockableMapEventHandler {
6
+ constructor(map) {
7
+ _defineProperty(this, "map", void 0);
8
+ _defineProperty(this, "delayContextMenu", void 0);
9
+ _defineProperty(this, "contextMenuEvent", void 0);
9
10
  this.map = map;
10
11
  }
11
- _createClass(BlockableMapEventHandler, [{
12
- key: "reset",
13
- value: function reset() {
14
- this.delayContextMenu = false;
12
+ reset() {
13
+ this.delayContextMenu = false;
14
+ // @ts-ignore
15
+ delete this.contextMenuEvent;
16
+ }
17
+ mousemove(e) {
18
+ // mousemove map events should not be fired when interaction handlers (pan, rotate, etc) are active
19
+ this.map.emit(e.type, new MapMouseEvent(e.type, this.map, e));
20
+ }
21
+ mousedown() {
22
+ this.delayContextMenu = true;
23
+ }
24
+ mouseup() {
25
+ this.delayContextMenu = false;
26
+ if (this.contextMenuEvent) {
27
+ this.map.emit('contextmenu', new MapMouseEvent('contextmenu', this.map, this.contextMenuEvent));
15
28
  // @ts-ignore
16
29
  delete this.contextMenuEvent;
17
30
  }
18
- }, {
19
- key: "mousemove",
20
- value: function mousemove(e) {
21
- // mousemove map events should not be fired when interaction handlers (pan, rotate, etc) are active
31
+ }
32
+ contextmenu(e) {
33
+ if (this.delayContextMenu) {
34
+ // Mac: contextmenu fired on mousedown; we save it until mouseup for consistency's sake
35
+ this.contextMenuEvent = e;
36
+ } else {
37
+ // Windows: contextmenu fired on mouseup, so fire event now
22
38
  this.map.emit(e.type, new MapMouseEvent(e.type, this.map, e));
23
39
  }
24
- }, {
25
- key: "mousedown",
26
- value: function mousedown() {
27
- this.delayContextMenu = true;
28
- }
29
- }, {
30
- key: "mouseup",
31
- value: function mouseup() {
32
- this.delayContextMenu = false;
33
- if (this.contextMenuEvent) {
34
- this.map.emit('contextmenu', new MapMouseEvent('contextmenu', this.map, this.contextMenuEvent));
35
- // @ts-ignore
36
- delete this.contextMenuEvent;
37
- }
38
- }
39
- }, {
40
- key: "contextmenu",
41
- value: function contextmenu(e) {
42
- if (this.delayContextMenu) {
43
- // Mac: contextmenu fired on mousedown; we save it until mouseup for consistency's sake
44
- this.contextMenuEvent = e;
45
- } else {
46
- // Windows: contextmenu fired on mouseup, so fire event now
47
- this.map.emit(e.type, new MapMouseEvent(e.type, this.map, e));
48
- }
49
40
 
50
- // prevent browser context menu when necessary
51
- if (this.map.listeners('contextmenu')) {
52
- e.preventDefault();
53
- }
54
- }
55
- }, {
56
- key: "isEnabled",
57
- value: function isEnabled() {
58
- return true;
59
- }
60
- }, {
61
- key: "isActive",
62
- value: function isActive() {
63
- return false;
41
+ // prevent browser context menu when necessary
42
+ if (this.map.listeners('contextmenu')) {
43
+ e.preventDefault();
64
44
  }
65
- }, {
66
- key: "enable",
67
- value: function enable() {
68
- return true;
69
- }
70
- }, {
71
- key: "disable",
72
- value: function disable() {
73
- return false;
74
- }
75
- }]);
76
- return BlockableMapEventHandler;
77
- }();
78
- export { BlockableMapEventHandler as default };
45
+ }
46
+ isEnabled() {
47
+ return true;
48
+ }
49
+ isActive() {
50
+ return false;
51
+ }
52
+ enable() {
53
+ return true;
54
+ }
55
+ disable() {
56
+ return false;
57
+ }
58
+ }
@@ -1,5 +1,4 @@
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
  // @ts-ignore
4
3
 
5
4
  import DOM from "../utils/dom";
@@ -9,12 +8,20 @@ import { Event } from "./events/event";
9
8
  * The `BoxZoomHandler` allows the user to zoom the map to fit within a bounding box.
10
9
  * The bounding box is defined by clicking and holding `shift` while dragging the cursor.
11
10
  */
12
- var BoxZoomHandler = /*#__PURE__*/function () {
11
+ class BoxZoomHandler {
13
12
  /**
14
13
  * @private
15
14
  */
16
- function BoxZoomHandler(map, options) {
17
- _classCallCheck(this, BoxZoomHandler);
15
+ constructor(map, options) {
16
+ _defineProperty(this, "map", void 0);
17
+ _defineProperty(this, "el", void 0);
18
+ _defineProperty(this, "container", void 0);
19
+ _defineProperty(this, "enabled", void 0);
20
+ _defineProperty(this, "active", void 0);
21
+ _defineProperty(this, "startPos", void 0);
22
+ _defineProperty(this, "lastPos", void 0);
23
+ _defineProperty(this, "box", void 0);
24
+ _defineProperty(this, "clickTolerance", void 0);
18
25
  this.map = map;
19
26
  this.el = map.getCanvasContainer();
20
27
  this.container = map.getContainer();
@@ -26,155 +33,130 @@ var BoxZoomHandler = /*#__PURE__*/function () {
26
33
  *
27
34
  * @returns {boolean} `true` if the "box zoom" interaction is enabled.
28
35
  */
29
- _createClass(BoxZoomHandler, [{
30
- key: "isEnabled",
31
- value: function isEnabled() {
32
- return !!this.enabled;
33
- }
36
+ isEnabled() {
37
+ return !!this.enabled;
38
+ }
34
39
 
35
- /**
36
- * Returns a Boolean indicating whether the "box zoom" interaction is active, i.e. currently being used.
37
- *
38
- * @returns {boolean} `true` if the "box zoom" interaction is active.
39
- */
40
- }, {
41
- key: "isActive",
42
- value: function isActive() {
43
- return !!this.active;
44
- }
40
+ /**
41
+ * Returns a Boolean indicating whether the "box zoom" interaction is active, i.e. currently being used.
42
+ *
43
+ * @returns {boolean} `true` if the "box zoom" interaction is active.
44
+ */
45
+ isActive() {
46
+ return !!this.active;
47
+ }
45
48
 
46
- /**
47
- * Enables the "box zoom" interaction.
48
- *
49
- * @example
50
- * map.boxZoom.enable();
51
- */
52
- }, {
53
- key: "enable",
54
- value: function enable() {
55
- if (this.isEnabled()) {
56
- return;
57
- }
58
- this.enabled = true;
49
+ /**
50
+ * Enables the "box zoom" interaction.
51
+ *
52
+ * @example
53
+ * map.boxZoom.enable();
54
+ */
55
+ enable() {
56
+ if (this.isEnabled()) {
57
+ return;
59
58
  }
59
+ this.enabled = true;
60
+ }
60
61
 
61
- /**
62
- * Disables the "box zoom" interaction.
63
- *
64
- * @example
65
- * map.boxZoom.disable();
66
- */
67
- }, {
68
- key: "disable",
69
- value: function disable() {
70
- if (!this.isEnabled()) {
71
- return;
72
- }
73
- this.enabled = false;
62
+ /**
63
+ * Disables the "box zoom" interaction.
64
+ *
65
+ * @example
66
+ * map.boxZoom.disable();
67
+ */
68
+ disable() {
69
+ if (!this.isEnabled()) {
70
+ return;
74
71
  }
75
- }, {
76
- key: "mousedown",
77
- value: function mousedown(e, point) {
78
- if (!this.isEnabled()) {
79
- return;
80
- }
81
- if (!(e.shiftKey && e.button === 0)) {
82
- return;
83
- }
84
- DOM.disableDrag();
85
- this.startPos = this.lastPos = point;
86
- this.active = true;
72
+ this.enabled = false;
73
+ }
74
+ mousedown(e, point) {
75
+ if (!this.isEnabled()) {
76
+ return;
87
77
  }
88
- }, {
89
- key: "mousemoveWindow",
90
- value: function mousemoveWindow(e, point) {
91
- if (!this.active) {
92
- return;
93
- }
94
- var pos = point;
95
- if (this.lastPos.equals(pos) || !this.box && pos.dist(this.startPos) < this.clickTolerance) {
96
- return;
97
- }
98
- var p0 = this.startPos;
99
- this.lastPos = pos;
100
- if (!this.box) {
101
- this.box = DOM.create('div', 'l7-boxzoom', this.container);
102
- this.container.classList.add('l7-crosshair');
103
- this.fireEvent('boxzoomstart', e);
104
- }
105
- var minX = Math.min(p0.x, pos.x);
106
- var maxX = Math.max(p0.x, pos.x);
107
- var minY = Math.min(p0.y, pos.y);
108
- var maxY = Math.max(p0.y, pos.y);
109
- DOM.setTransform(this.box, "translate(".concat(minX, "px,").concat(minY, "px)"));
110
- if (this.box) {
111
- this.box.style.width = "".concat(maxX - minX, "px");
112
- this.box.style.height = "".concat(maxY - minY, "px");
113
- }
78
+ if (!(e.shiftKey && e.button === 0)) {
79
+ return;
114
80
  }
115
- }, {
116
- key: "mouseupWindow",
117
- value: function mouseupWindow(e, point) {
118
- var _this = this;
119
- if (!this.active) {
120
- return;
121
- }
122
- if (e.button !== 0) {
123
- return;
124
- }
125
- var p0 = this.startPos;
126
- var p1 = point;
127
- this.reset();
128
- DOM.suppressClick();
129
- if (p0.x === p1.x && p0.y === p1.y) {
130
- this.fireEvent('boxzoomcancel', e);
131
- } else {
132
- this.map.emit('boxzoomend', new Event('boxzoomend', {
133
- originalEvent: e
134
- }));
135
- return {
136
- cameraAnimation: function cameraAnimation(map) {
137
- return map.fitScreenCoordinates(p0, p1, _this.map.getBearing(), {
138
- linear: true
139
- });
140
- }
141
- };
142
- }
81
+ DOM.disableDrag();
82
+ this.startPos = this.lastPos = point;
83
+ this.active = true;
84
+ }
85
+ mousemoveWindow(e, point) {
86
+ if (!this.active) {
87
+ return;
143
88
  }
144
- }, {
145
- key: "keydown",
146
- value: function keydown(e) {
147
- if (!this.active) {
148
- return;
149
- }
150
- if (e.keyCode === 27) {
151
- this.reset();
152
- this.fireEvent('boxzoomcancel', e);
153
- }
89
+ const pos = point;
90
+ if (this.lastPos.equals(pos) || !this.box && pos.dist(this.startPos) < this.clickTolerance) {
91
+ return;
154
92
  }
155
- }, {
156
- key: "reset",
157
- value: function reset() {
158
- this.active = false;
159
- this.container.classList.remove('l7-crosshair');
160
- if (this.box) {
161
- DOM.remove(this.box);
162
- this.box = null;
163
- }
164
- DOM.enableDrag();
165
- // @ts-ignore
166
- delete this.startPos;
167
- // @ts-ignore
168
- delete this.lastPos;
93
+ const p0 = this.startPos;
94
+ this.lastPos = pos;
95
+ if (!this.box) {
96
+ this.box = DOM.create('div', 'l7-boxzoom', this.container);
97
+ this.container.classList.add('l7-crosshair');
98
+ this.fireEvent('boxzoomstart', e);
169
99
  }
170
- }, {
171
- key: "fireEvent",
172
- value: function fireEvent(type, e) {
173
- return this.map.emit(type, new Event(type, {
100
+ const minX = Math.min(p0.x, pos.x);
101
+ const maxX = Math.max(p0.x, pos.x);
102
+ const minY = Math.min(p0.y, pos.y);
103
+ const maxY = Math.max(p0.y, pos.y);
104
+ DOM.setTransform(this.box, `translate(${minX}px,${minY}px)`);
105
+ if (this.box) {
106
+ this.box.style.width = `${maxX - minX}px`;
107
+ this.box.style.height = `${maxY - minY}px`;
108
+ }
109
+ }
110
+ mouseupWindow(e, point) {
111
+ if (!this.active) {
112
+ return;
113
+ }
114
+ if (e.button !== 0) {
115
+ return;
116
+ }
117
+ const p0 = this.startPos;
118
+ const p1 = point;
119
+ this.reset();
120
+ DOM.suppressClick();
121
+ if (p0.x === p1.x && p0.y === p1.y) {
122
+ this.fireEvent('boxzoomcancel', e);
123
+ } else {
124
+ this.map.emit('boxzoomend', new Event('boxzoomend', {
174
125
  originalEvent: e
175
126
  }));
127
+ return {
128
+ cameraAnimation: map => map.fitScreenCoordinates(p0, p1, this.map.getBearing(), {
129
+ linear: true
130
+ })
131
+ };
132
+ }
133
+ }
134
+ keydown(e) {
135
+ if (!this.active) {
136
+ return;
137
+ }
138
+ if (e.keyCode === 27) {
139
+ this.reset();
140
+ this.fireEvent('boxzoomcancel', e);
176
141
  }
177
- }]);
178
- return BoxZoomHandler;
179
- }();
142
+ }
143
+ reset() {
144
+ this.active = false;
145
+ this.container.classList.remove('l7-crosshair');
146
+ if (this.box) {
147
+ DOM.remove(this.box);
148
+ this.box = null;
149
+ }
150
+ DOM.enableDrag();
151
+ // @ts-ignore
152
+ delete this.startPos;
153
+ // @ts-ignore
154
+ delete this.lastPos;
155
+ }
156
+ fireEvent(type, e) {
157
+ return this.map.emit(type, new Event(type, {
158
+ originalEvent: e
159
+ }));
160
+ }
161
+ }
180
162
  export default BoxZoomHandler;
@@ -1,54 +1,40 @@
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
  // @ts-ignore
4
- var ClickZoomHandler = /*#__PURE__*/function () {
5
- function ClickZoomHandler() {
6
- _classCallCheck(this, ClickZoomHandler);
3
+
4
+ export default class ClickZoomHandler {
5
+ constructor() {
6
+ _defineProperty(this, "enabled", void 0);
7
+ _defineProperty(this, "active", void 0);
7
8
  this.reset();
8
9
  }
9
- _createClass(ClickZoomHandler, [{
10
- key: "reset",
11
- value: function reset() {
12
- this.active = false;
13
- }
14
- }, {
15
- key: "dblclick",
16
- value: function dblclick(e, point) {
17
- e.preventDefault();
18
- return {
19
- cameraAnimation: function cameraAnimation(map) {
20
- map.easeTo({
21
- duration: 300,
22
- zoom: map.getZoom() + (e.shiftKey ? -1 : 1),
23
- around: map.unproject(point)
24
- }, {
25
- originalEvent: e
26
- });
27
- }
28
- };
29
- }
30
- }, {
31
- key: "enable",
32
- value: function enable() {
33
- this.enabled = true;
34
- }
35
- }, {
36
- key: "disable",
37
- value: function disable() {
38
- this.enabled = false;
39
- this.reset();
40
- }
41
- }, {
42
- key: "isEnabled",
43
- value: function isEnabled() {
44
- return this.enabled;
45
- }
46
- }, {
47
- key: "isActive",
48
- value: function isActive() {
49
- return this.active;
50
- }
51
- }]);
52
- return ClickZoomHandler;
53
- }();
54
- export { ClickZoomHandler as default };
10
+ reset() {
11
+ this.active = false;
12
+ }
13
+ dblclick(e, point) {
14
+ e.preventDefault();
15
+ return {
16
+ cameraAnimation: map => {
17
+ map.easeTo({
18
+ duration: 300,
19
+ zoom: map.getZoom() + (e.shiftKey ? -1 : 1),
20
+ around: map.unproject(point)
21
+ }, {
22
+ originalEvent: e
23
+ });
24
+ }
25
+ };
26
+ }
27
+ enable() {
28
+ this.enabled = true;
29
+ }
30
+ disable() {
31
+ this.enabled = false;
32
+ this.reset();
33
+ }
34
+ isEnabled() {
35
+ return this.enabled;
36
+ }
37
+ isActive() {
38
+ return this.active;
39
+ }
40
+ }
@@ -1,11 +1,13 @@
1
- import _createClass from "@babel/runtime/helpers/esm/createClass";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
2
  // tslint:disable-next-line:no-submodule-imports
4
3
  import { lodashUtil } from '@antv/l7-utils';
5
- var merge = lodashUtil.merge;
6
- export var Event = /*#__PURE__*/_createClass(function Event(type) {
7
- var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8
- _classCallCheck(this, Event);
9
- merge(this, data);
10
- this.type = type;
11
- });
4
+ const {
5
+ merge
6
+ } = lodashUtil;
7
+ export class Event {
8
+ constructor(type, data = {}) {
9
+ _defineProperty(this, "type", void 0);
10
+ merge(this, data);
11
+ this.type = type;
12
+ }
13
+ }
@@ -1,64 +1,49 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
5
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
6
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
7
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
8
2
  // @ts-ignore
9
3
  // tslint:disable-next-line:no-submodule-imports
10
4
  import { lodashUtil } from '@antv/l7-utils';
11
5
  import DOM from "../../utils/dom";
12
6
  import { Event } from "./event";
13
- var merge = lodashUtil.merge;
14
- var MapMouseEvent = /*#__PURE__*/function (_Event) {
15
- _inherits(MapMouseEvent, _Event);
16
- var _super = _createSuper(MapMouseEvent);
7
+ const {
8
+ merge
9
+ } = lodashUtil;
10
+ export default class MapMouseEvent extends Event {
17
11
  /**
18
- * `true` if `preventDefault` has been called.
19
12
  * @private
20
13
  */
21
-
22
- /**
23
- * The `Map` object that fired the event.
24
- */
25
-
26
- /**
27
- * The DOM event which caused the map event.
28
- */
29
-
30
- /**
31
- * The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.
32
- */
33
-
34
- /**
35
- * The geographic location on the map of the mouse cursor.
36
- */
37
-
38
- /**
39
- * @private
40
- */
41
- function MapMouseEvent(type, map, originalEvent) {
42
- var _this;
43
- var data = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
44
- _classCallCheck(this, MapMouseEvent);
45
- var point = DOM.mousePos(map.getCanvasContainer(), originalEvent);
46
- var lngLat = map.unproject(point);
47
- _this = _super.call(this, type, merge({
48
- point: point,
49
- lngLat: lngLat,
50
- originalEvent: originalEvent
14
+ constructor(type, map, originalEvent, data = {}) {
15
+ const point = DOM.mousePos(map.getCanvasContainer(), originalEvent);
16
+ const lngLat = map.unproject(point);
17
+ super(type, merge({
18
+ point,
19
+ lngLat,
20
+ originalEvent
51
21
  }, data));
52
- _this.defaultPrevented = false;
53
- _this.target = map;
54
- return _this;
22
+ /**
23
+ * `true` if `preventDefault` has been called.
24
+ * @private
25
+ */
26
+ /**
27
+ * The `Map` object that fired the event.
28
+ */
29
+ _defineProperty(this, "target", void 0);
30
+ /**
31
+ * The DOM event which caused the map event.
32
+ */
33
+ _defineProperty(this, "originalEvent", void 0);
34
+ /**
35
+ * The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.
36
+ */
37
+ _defineProperty(this, "point", void 0);
38
+ /**
39
+ * The geographic location on the map of the mouse cursor.
40
+ */
41
+ _defineProperty(this, "lngLat", void 0);
42
+ _defineProperty(this, "defaultPrevented", void 0);
43
+ this.defaultPrevented = false;
44
+ this.target = map;
45
+ }
46
+ preventDefault() {
47
+ this.defaultPrevented = true;
55
48
  }
56
- _createClass(MapMouseEvent, [{
57
- key: "preventDefault",
58
- value: function preventDefault() {
59
- this.defaultPrevented = true;
60
- }
61
- }]);
62
- return MapMouseEvent;
63
- }(Event);
64
- export { MapMouseEvent as default };
49
+ }