@antv/l7-map 2.18.2 → 2.19.0

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 (168) hide show
  1. package/es/camera.d.ts +85 -0
  2. package/es/camera.js +718 -0
  3. package/es/css/l7.css +98 -0
  4. package/es/earthmap.d.ts +66 -0
  5. package/es/earthmap.js +369 -0
  6. package/es/geo/edge_insets.d.ts +54 -0
  7. package/es/geo/edge_insets.js +108 -0
  8. package/es/geo/lng_lat.d.ts +18 -0
  9. package/es/geo/lng_lat.js +73 -0
  10. package/es/geo/lng_lat_bounds.d.ts +24 -0
  11. package/es/geo/lng_lat_bounds.js +154 -0
  12. package/es/geo/mercator.d.ts +29 -0
  13. package/es/geo/mercator.js +84 -0
  14. package/es/geo/point.d.ts +40 -0
  15. package/es/geo/point.js +224 -0
  16. package/es/geo/simple.d.ts +29 -0
  17. package/es/geo/simple.js +87 -0
  18. package/es/geo/transform.d.ts +198 -0
  19. package/es/geo/transform.js +961 -0
  20. package/es/handler/IHandler.d.ts +34 -0
  21. package/es/handler/IHandler.js +1 -0
  22. package/es/handler/blockable_map_event.d.ts +17 -0
  23. package/es/handler/blockable_map_event.js +78 -0
  24. package/es/handler/box_zoom.d.ts +59 -0
  25. package/es/handler/box_zoom.js +180 -0
  26. package/es/handler/click_zoom.d.ts +16 -0
  27. package/es/handler/click_zoom.js +54 -0
  28. package/es/handler/events/event.d.ts +4 -0
  29. package/es/handler/events/event.js +11 -0
  30. package/es/handler/events/index.d.ts +4 -0
  31. package/es/handler/events/index.js +4 -0
  32. package/es/handler/events/map_mouse_event.d.ts +34 -0
  33. package/es/handler/events/map_mouse_event.js +64 -0
  34. package/es/handler/events/map_touch_event.d.ts +57 -0
  35. package/es/handler/events/map_touch_event.js +95 -0
  36. package/es/handler/events/map_wheel_event.d.ts +33 -0
  37. package/es/handler/events/map_wheel_event.js +50 -0
  38. package/es/handler/events/render_event.d.ts +5 -0
  39. package/es/handler/events/render_event.js +26 -0
  40. package/es/handler/handler_inertia.d.ts +23 -0
  41. package/es/handler/handler_inertia.js +157 -0
  42. package/es/handler/handler_manager.d.ts +61 -0
  43. package/es/handler/handler_manager.js +577 -0
  44. package/es/handler/handler_util.d.ts +4 -0
  45. package/es/handler/handler_util.js +9 -0
  46. package/es/handler/keyboard.d.ts +36 -0
  47. package/es/handler/keyboard.js +143 -0
  48. package/es/handler/map_event.d.ts +29 -0
  49. package/es/handler/map_event.js +125 -0
  50. package/es/handler/mouse/index.d.ts +4 -0
  51. package/es/handler/mouse/index.js +4 -0
  52. package/es/handler/mouse/mouse_handler.d.ts +22 -0
  53. package/es/handler/mouse/mouse_handler.js +118 -0
  54. package/es/handler/mouse/mousepan_handler.d.ts +10 -0
  55. package/es/handler/mouse/mousepan_handler.js +44 -0
  56. package/es/handler/mouse/mousepitch_hander.d.ts +9 -0
  57. package/es/handler/mouse/mousepitch_hander.js +46 -0
  58. package/es/handler/mouse/mouserotate_hander.d.ts +9 -0
  59. package/es/handler/mouse/mouserotate_hander.js +46 -0
  60. package/es/handler/mouse/util.d.ts +6 -0
  61. package/es/handler/mouse/util.js +11 -0
  62. package/es/handler/scroll_zoom.d.ts +93 -0
  63. package/es/handler/scroll_zoom.js +325 -0
  64. package/es/handler/shim/dblclick_zoom.d.ts +40 -0
  65. package/es/handler/shim/dblclick_zoom.js +67 -0
  66. package/es/handler/shim/drag_pan.d.ts +61 -0
  67. package/es/handler/shim/drag_pan.js +84 -0
  68. package/es/handler/shim/drag_rotate.d.ts +46 -0
  69. package/es/handler/shim/drag_rotate.js +74 -0
  70. package/es/handler/shim/touch_zoom_rotate.d.ts +70 -0
  71. package/es/handler/shim/touch_zoom_rotate.js +115 -0
  72. package/es/handler/tap/single_tap_recognizer.d.ts +20 -0
  73. package/es/handler/tap/single_tap_recognizer.js +97 -0
  74. package/es/handler/tap/tap_drag_zoom.d.ts +22 -0
  75. package/es/handler/tap/tap_drag_zoom.js +106 -0
  76. package/es/handler/tap/tap_recognizer.d.ts +17 -0
  77. package/es/handler/tap/tap_recognizer.js +54 -0
  78. package/es/handler/tap/tap_zoom.d.ts +22 -0
  79. package/es/handler/tap/tap_zoom.js +109 -0
  80. package/es/handler/touch/index.d.ts +5 -0
  81. package/es/handler/touch/index.js +5 -0
  82. package/es/handler/touch/touch_pan.d.ts +30 -0
  83. package/es/handler/touch/touch_pan.js +110 -0
  84. package/es/handler/touch/touch_pitch.d.ts +13 -0
  85. package/es/handler/touch/touch_pitch.js +93 -0
  86. package/es/handler/touch/touch_rotate.d.ts +12 -0
  87. package/es/handler/touch/touch_rotate.js +77 -0
  88. package/es/handler/touch/touch_zoom.d.ts +12 -0
  89. package/es/handler/touch/touch_zoom.js +54 -0
  90. package/es/handler/touch/two_touch.d.ts +23 -0
  91. package/es/handler/touch/two_touch.js +125 -0
  92. package/es/hash.d.ts +14 -0
  93. package/es/hash.js +134 -0
  94. package/es/index.d.ts +4 -0
  95. package/es/index.js +4 -0
  96. package/es/interface.d.ts +34 -0
  97. package/es/interface.js +1 -0
  98. package/es/map.d.ts +70 -0
  99. package/es/map.js +387 -0
  100. package/es/util.d.ts +25 -0
  101. package/es/util.js +88 -0
  102. package/es/utils/Aabb.d.ts +12 -0
  103. package/es/utils/Aabb.js +112 -0
  104. package/es/utils/dom.d.ts +4 -0
  105. package/es/utils/dom.js +140 -0
  106. package/es/utils/performance.d.ts +17 -0
  107. package/es/utils/performance.js +62 -0
  108. package/es/utils/primitives.d.ts +6 -0
  109. package/es/utils/primitives.js +47 -0
  110. package/es/utils/task_queue.d.ts +13 -0
  111. package/es/utils/task_queue.js +89 -0
  112. package/lib/camera.js +724 -0
  113. package/lib/css/l7.css +98 -0
  114. package/lib/earthmap.js +376 -0
  115. package/lib/geo/edge_insets.js +114 -0
  116. package/lib/geo/lng_lat.js +81 -0
  117. package/lib/geo/lng_lat_bounds.js +161 -0
  118. package/lib/geo/mercator.js +100 -0
  119. package/lib/geo/point.js +231 -0
  120. package/lib/geo/simple.js +104 -0
  121. package/lib/geo/transform.js +971 -0
  122. package/lib/handler/IHandler.js +5 -0
  123. package/lib/handler/blockable_map_event.js +84 -0
  124. package/lib/handler/box_zoom.js +186 -0
  125. package/lib/handler/click_zoom.js +61 -0
  126. package/lib/handler/events/event.js +20 -0
  127. package/lib/handler/events/index.js +27 -0
  128. package/lib/handler/events/map_mouse_event.js +70 -0
  129. package/lib/handler/events/map_touch_event.js +100 -0
  130. package/lib/handler/events/map_wheel_event.js +57 -0
  131. package/lib/handler/events/render_event.js +33 -0
  132. package/lib/handler/handler_inertia.js +162 -0
  133. package/lib/handler/handler_manager.js +584 -0
  134. package/lib/handler/handler_util.js +15 -0
  135. package/lib/handler/keyboard.js +151 -0
  136. package/lib/handler/map_event.js +131 -0
  137. package/lib/handler/mouse/index.js +27 -0
  138. package/lib/handler/mouse/mouse_handler.js +124 -0
  139. package/lib/handler/mouse/mousepan_handler.js +49 -0
  140. package/lib/handler/mouse/mousepitch_hander.js +51 -0
  141. package/lib/handler/mouse/mouserotate_hander.js +51 -0
  142. package/lib/handler/mouse/util.js +22 -0
  143. package/lib/handler/scroll_zoom.js +333 -0
  144. package/lib/handler/shim/dblclick_zoom.js +74 -0
  145. package/lib/handler/shim/drag_pan.js +91 -0
  146. package/lib/handler/shim/drag_rotate.js +81 -0
  147. package/lib/handler/shim/touch_zoom_rotate.js +122 -0
  148. package/lib/handler/tap/single_tap_recognizer.js +106 -0
  149. package/lib/handler/tap/tap_drag_zoom.js +112 -0
  150. package/lib/handler/tap/tap_recognizer.js +63 -0
  151. package/lib/handler/tap/tap_zoom.js +115 -0
  152. package/lib/handler/touch/index.js +34 -0
  153. package/lib/handler/touch/touch_pan.js +117 -0
  154. package/lib/handler/touch/touch_pitch.js +98 -0
  155. package/lib/handler/touch/touch_rotate.js +82 -0
  156. package/lib/handler/touch/touch_zoom.js +59 -0
  157. package/lib/handler/touch/two_touch.js +131 -0
  158. package/lib/hash.js +143 -0
  159. package/lib/index.js +49 -0
  160. package/lib/interface.js +5 -0
  161. package/lib/map.js +394 -0
  162. package/lib/util.js +108 -0
  163. package/lib/utils/Aabb.js +119 -0
  164. package/lib/utils/dom.js +147 -0
  165. package/lib/utils/performance.js +70 -0
  166. package/lib/utils/primitives.js +54 -0
  167. package/lib/utils/task_queue.js +97 -0
  168. package/package.json +3 -3
@@ -0,0 +1,34 @@
1
+ import { EarthMap } from '../earthmap';
2
+ import Point from '../geo/point';
3
+ import { Map } from '../map';
4
+ export interface IHandlerResult {
5
+ panDelta?: Point;
6
+ zoomDelta?: number;
7
+ bearingDelta?: number;
8
+ pitchDelta?: number;
9
+ around?: Point | null;
10
+ pinchAround?: Point | null;
11
+ cameraAnimation?: (map: Map | EarthMap) => any;
12
+ originalEvent?: any;
13
+ needsRenderFrame?: boolean;
14
+ noInertia?: boolean;
15
+ }
16
+ export interface IHandler {
17
+ touchstart?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => IHandlerResult | void;
18
+ touchmove?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => IHandlerResult | void;
19
+ touchend?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => IHandlerResult | void;
20
+ touchcancel?: (e: TouchEvent, points: Point[], mapTouches: Touch[]) => IHandlerResult | void;
21
+ mousedown?: (e: MouseEvent, point: Point) => IHandlerResult | void;
22
+ mousemove?: (e: MouseEvent, point: Point) => IHandlerResult | void;
23
+ mouseup?: (e: MouseEvent, point: Point) => IHandlerResult | void;
24
+ dblclick?: (e: MouseEvent, point: Point) => IHandlerResult | void;
25
+ wheel?: (e: WheelEvent, point: Point) => IHandlerResult | void;
26
+ keydown?: (e: KeyboardEvent) => IHandlerResult | void;
27
+ keyup?: (e: KeyboardEvent) => IHandlerResult | void;
28
+ renderFrame?: () => IHandlerResult | void;
29
+ enable(options?: any): void;
30
+ disable(): void;
31
+ isEnabled(): boolean;
32
+ isActive(): boolean;
33
+ reset(): void;
34
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { EarthMap } from '../earthmap';
2
+ import { Map } from '../map';
3
+ export default class BlockableMapEventHandler {
4
+ private map;
5
+ private delayContextMenu;
6
+ private contextMenuEvent;
7
+ constructor(map: Map | EarthMap);
8
+ reset(): void;
9
+ mousemove(e: MouseEvent): void;
10
+ mousedown(): void;
11
+ mouseup(): void;
12
+ contextmenu(e: MouseEvent): void;
13
+ isEnabled(): boolean;
14
+ isActive(): boolean;
15
+ enable(): boolean;
16
+ disable(): boolean;
17
+ }
@@ -0,0 +1,78 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ // @ts-ignore
4
+
5
+ import { MapMouseEvent } from "./events";
6
+ var BlockableMapEventHandler = /*#__PURE__*/function () {
7
+ function BlockableMapEventHandler(map) {
8
+ _classCallCheck(this, BlockableMapEventHandler);
9
+ this.map = map;
10
+ }
11
+ _createClass(BlockableMapEventHandler, [{
12
+ key: "reset",
13
+ value: function reset() {
14
+ this.delayContextMenu = false;
15
+ // @ts-ignore
16
+ delete this.contextMenuEvent;
17
+ }
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
22
+ this.map.emit(e.type, new MapMouseEvent(e.type, this.map, e));
23
+ }
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
+
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;
64
+ }
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 };
@@ -0,0 +1,59 @@
1
+ import { EarthMap } from '../earthmap';
2
+ import Point from '../geo/point';
3
+ import { Map } from '../map';
4
+ /**
5
+ * The `BoxZoomHandler` allows the user to zoom the map to fit within a bounding box.
6
+ * The bounding box is defined by clicking and holding `shift` while dragging the cursor.
7
+ */
8
+ declare class BoxZoomHandler {
9
+ private map;
10
+ private el;
11
+ private container;
12
+ private enabled;
13
+ private active;
14
+ private startPos;
15
+ private lastPos;
16
+ private box;
17
+ private clickTolerance;
18
+ /**
19
+ * @private
20
+ */
21
+ constructor(map: Map | EarthMap, options: {
22
+ clickTolerance: number;
23
+ });
24
+ /**
25
+ * Returns a Boolean indicating whether the "box zoom" interaction is enabled.
26
+ *
27
+ * @returns {boolean} `true` if the "box zoom" interaction is enabled.
28
+ */
29
+ isEnabled(): boolean;
30
+ /**
31
+ * Returns a Boolean indicating whether the "box zoom" interaction is active, i.e. currently being used.
32
+ *
33
+ * @returns {boolean} `true` if the "box zoom" interaction is active.
34
+ */
35
+ isActive(): boolean;
36
+ /**
37
+ * Enables the "box zoom" interaction.
38
+ *
39
+ * @example
40
+ * map.boxZoom.enable();
41
+ */
42
+ enable(): void;
43
+ /**
44
+ * Disables the "box zoom" interaction.
45
+ *
46
+ * @example
47
+ * map.boxZoom.disable();
48
+ */
49
+ disable(): void;
50
+ mousedown(e: MouseEvent, point: Point): void;
51
+ mousemoveWindow(e: MouseEvent, point: Point): void;
52
+ mouseupWindow(e: MouseEvent, point: Point): {
53
+ cameraAnimation: (map: Map) => boolean | Map;
54
+ } | undefined;
55
+ keydown(e: KeyboardEvent): void;
56
+ reset(): void;
57
+ fireEvent(type: string, e: any): boolean;
58
+ }
59
+ export default BoxZoomHandler;
@@ -0,0 +1,180 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ // @ts-ignore
4
+
5
+ import DOM from "../utils/dom";
6
+ import { Event } from "./events/event";
7
+
8
+ /**
9
+ * The `BoxZoomHandler` allows the user to zoom the map to fit within a bounding box.
10
+ * The bounding box is defined by clicking and holding `shift` while dragging the cursor.
11
+ */
12
+ var BoxZoomHandler = /*#__PURE__*/function () {
13
+ /**
14
+ * @private
15
+ */
16
+ function BoxZoomHandler(map, options) {
17
+ _classCallCheck(this, BoxZoomHandler);
18
+ this.map = map;
19
+ this.el = map.getCanvasContainer();
20
+ this.container = map.getContainer();
21
+ this.clickTolerance = options.clickTolerance || 1;
22
+ }
23
+
24
+ /**
25
+ * Returns a Boolean indicating whether the "box zoom" interaction is enabled.
26
+ *
27
+ * @returns {boolean} `true` if the "box zoom" interaction is enabled.
28
+ */
29
+ _createClass(BoxZoomHandler, [{
30
+ key: "isEnabled",
31
+ value: function isEnabled() {
32
+ return !!this.enabled;
33
+ }
34
+
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
+ }
45
+
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;
59
+ }
60
+
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;
74
+ }
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;
87
+ }
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
+ }
114
+ }
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
+ }
143
+ }
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
+ }
154
+ }
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;
169
+ }
170
+ }, {
171
+ key: "fireEvent",
172
+ value: function fireEvent(type, e) {
173
+ return this.map.emit(type, new Event(type, {
174
+ originalEvent: e
175
+ }));
176
+ }
177
+ }]);
178
+ return BoxZoomHandler;
179
+ }();
180
+ export default BoxZoomHandler;
@@ -0,0 +1,16 @@
1
+ import { EarthMap } from '../earthmap';
2
+ import Point from '../geo/point';
3
+ import { Map } from '../map';
4
+ export default class ClickZoomHandler {
5
+ private enabled;
6
+ private active;
7
+ constructor();
8
+ reset(): void;
9
+ dblclick(e: MouseEvent, point: Point): {
10
+ cameraAnimation: (map: Map | EarthMap) => void;
11
+ };
12
+ enable(): void;
13
+ disable(): void;
14
+ isEnabled(): boolean;
15
+ isActive(): boolean;
16
+ }
@@ -0,0 +1,54 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ // @ts-ignore
4
+ var ClickZoomHandler = /*#__PURE__*/function () {
5
+ function ClickZoomHandler() {
6
+ _classCallCheck(this, ClickZoomHandler);
7
+ this.reset();
8
+ }
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 };
@@ -0,0 +1,4 @@
1
+ export declare class Event {
2
+ type: string;
3
+ constructor(type: string, data?: any);
4
+ }
@@ -0,0 +1,11 @@
1
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
2
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
+ // tslint:disable-next-line:no-submodule-imports
4
+ 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
+ });
@@ -0,0 +1,4 @@
1
+ import MapMouseEvent from './map_mouse_event';
2
+ import MapTouchEvent from './map_touch_event';
3
+ import MapWheelEvent from './map_wheel_event';
4
+ export { MapMouseEvent, MapTouchEvent, MapWheelEvent };
@@ -0,0 +1,4 @@
1
+ import MapMouseEvent from "./map_mouse_event";
2
+ import MapTouchEvent from "./map_touch_event";
3
+ import MapWheelEvent from "./map_wheel_event";
4
+ export { MapMouseEvent, MapTouchEvent, MapWheelEvent };
@@ -0,0 +1,34 @@
1
+ import { EarthMap } from '../../earthmap';
2
+ import LngLat from '../../geo/lng_lat';
3
+ import Point from '../../geo/point';
4
+ import { Map } from '../../map';
5
+ import { Event } from './event';
6
+ export default class MapMouseEvent extends Event {
7
+ /**
8
+ * `true` if `preventDefault` has been called.
9
+ * @private
10
+ */
11
+ type: 'mousedown' | 'mouseup' | 'click' | 'dblclick' | 'mousemove' | 'mouseover' | 'mouseenter' | 'mouseleave' | 'mouseout' | 'contextmenu';
12
+ /**
13
+ * The `Map` object that fired the event.
14
+ */
15
+ target: Map | EarthMap;
16
+ /**
17
+ * The DOM event which caused the map event.
18
+ */
19
+ originalEvent: MouseEvent;
20
+ /**
21
+ * The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.
22
+ */
23
+ point: Point;
24
+ /**
25
+ * The geographic location on the map of the mouse cursor.
26
+ */
27
+ lngLat: LngLat;
28
+ defaultPrevented: boolean;
29
+ /**
30
+ * @private
31
+ */
32
+ constructor(type: string, map: Map | EarthMap, originalEvent: MouseEvent, data?: any);
33
+ preventDefault(): void;
34
+ }
@@ -0,0 +1,64 @@
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; } }
8
+ // @ts-ignore
9
+ // tslint:disable-next-line:no-submodule-imports
10
+ import { lodashUtil } from '@antv/l7-utils';
11
+ import DOM from "../../utils/dom";
12
+ import { Event } from "./event";
13
+ var merge = lodashUtil.merge;
14
+ var MapMouseEvent = /*#__PURE__*/function (_Event) {
15
+ _inherits(MapMouseEvent, _Event);
16
+ var _super = _createSuper(MapMouseEvent);
17
+ /**
18
+ * `true` if `preventDefault` has been called.
19
+ * @private
20
+ */
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
51
+ }, data));
52
+ _this.defaultPrevented = false;
53
+ _this.target = map;
54
+ return _this;
55
+ }
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 };
@@ -0,0 +1,57 @@
1
+ import { EarthMap } from '../../earthmap';
2
+ import LngLat from '../../geo/lng_lat';
3
+ import Point from '../../geo/point';
4
+ import { Map } from '../../map';
5
+ import { Event } from './event';
6
+ export default class MapTouchEvent extends Event {
7
+ /**
8
+ * The event type.
9
+ */
10
+ type: 'touchstart' | 'touchend' | 'touchcancel';
11
+ /**
12
+ * The `Map` object that fired the event.
13
+ */
14
+ target: Map | EarthMap;
15
+ /**
16
+ * The DOM event which caused the map event.
17
+ */
18
+ originalEvent: TouchEvent;
19
+ /**
20
+ * The geographic location on the map of the center of the touch event points.
21
+ */
22
+ lngLat: LngLat;
23
+ /**
24
+ * The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left
25
+ * corner.
26
+ */
27
+ point: Point;
28
+ /**
29
+ * The array of pixel coordinates corresponding to a
30
+ * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
31
+ */
32
+ points: Point[];
33
+ /**
34
+ * The geographical locations on the map corresponding to a
35
+ * [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
36
+ */
37
+ lngLats: LngLat[];
38
+ /**
39
+ * `true` if `preventDefault` has been called.
40
+ * @private
41
+ */
42
+ defaultPrevented: boolean;
43
+ /**
44
+ * @private
45
+ */
46
+ constructor(type: string, map: Map | EarthMap, originalEvent: TouchEvent);
47
+ /**
48
+ * Prevents subsequent default processing of the event by the map.
49
+ *
50
+ * Calling this method will prevent the following default map behaviors:
51
+ *
52
+ * * On `touchstart` events, the behavior of {@link DragPanHandler}
53
+ * * On `touchstart` events, the behavior of {@link TouchZoomRotateHandler}
54
+ *
55
+ */
56
+ private preventDefault;
57
+ }