@antv/l7-map 2.21.11-beta.5 → 2.21.11-beta.7

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 (358) hide show
  1. package/README.md +27 -6
  2. package/es/index.d.ts +3 -4
  3. package/es/index.js +2 -4
  4. package/es/map/camera.d.ts +690 -0
  5. package/es/map/camera.js +1138 -0
  6. package/{lib → es/map}/css/l7.css +41 -7
  7. package/es/map/events.d.ts +384 -0
  8. package/es/map/events.js +222 -0
  9. package/es/map/geo/edge_insets.d.ts +97 -0
  10. package/es/{geo → map/geo}/edge_insets.js +55 -33
  11. package/es/map/geo/lng_lat.d.ts +116 -0
  12. package/es/map/geo/lng_lat.js +159 -0
  13. package/es/map/geo/lng_lat_bounds.d.ts +217 -0
  14. package/es/map/geo/lng_lat_bounds.js +334 -0
  15. package/es/map/geo/mercator_coordinate.d.ts +113 -0
  16. package/es/map/geo/mercator_coordinate.js +142 -0
  17. package/es/map/geo/transform.d.ts +262 -0
  18. package/es/map/geo/transform.js +736 -0
  19. package/{lib → es/map}/handler/box_zoom.d.ts +30 -24
  20. package/es/map/handler/box_zoom.js +145 -0
  21. package/es/map/handler/click_zoom.d.ts +24 -0
  22. package/es/map/handler/click_zoom.js +47 -0
  23. package/es/map/handler/cooperative_gestures.d.ts +40 -0
  24. package/es/map/handler/cooperative_gestures.js +94 -0
  25. package/es/map/handler/drag_handler.d.ts +88 -0
  26. package/es/map/handler/drag_handler.js +89 -0
  27. package/es/map/handler/drag_move_state_manager.d.ts +30 -0
  28. package/es/map/handler/drag_move_state_manager.js +94 -0
  29. package/es/map/handler/handler_util.d.ts +3 -0
  30. package/es/{handler → map/handler}/handler_util.js +1 -2
  31. package/es/map/handler/keyboard.d.ts +88 -0
  32. package/es/map/handler/keyboard.js +197 -0
  33. package/es/map/handler/map_event.d.ts +46 -0
  34. package/es/map/handler/map_event.js +131 -0
  35. package/es/map/handler/mouse.d.ts +30 -0
  36. package/es/map/handler/mouse.js +85 -0
  37. package/es/map/handler/one_finger_touch_drag.d.ts +15 -0
  38. package/es/map/handler/one_finger_touch_drag.js +39 -0
  39. package/es/map/handler/scroll_zoom.d.ts +102 -0
  40. package/es/map/handler/scroll_zoom.js +312 -0
  41. package/es/{handler → map/handler}/shim/dblclick_zoom.d.ts +14 -10
  42. package/es/{handler → map/handler}/shim/dblclick_zoom.js +20 -16
  43. package/es/map/handler/shim/drag_pan.d.ts +79 -0
  44. package/es/map/handler/shim/drag_pan.js +77 -0
  45. package/es/{handler → map/handler}/shim/drag_rotate.d.ts +24 -16
  46. package/es/map/handler/shim/drag_rotate.js +66 -0
  47. package/es/map/handler/shim/two_fingers_touch.d.ts +74 -0
  48. package/es/map/handler/shim/two_fingers_touch.js +106 -0
  49. package/es/map/handler/tap_drag_zoom.d.ts +28 -0
  50. package/es/map/handler/tap_drag_zoom.js +92 -0
  51. package/es/map/handler/tap_recognizer.d.ts +35 -0
  52. package/es/map/handler/tap_recognizer.js +107 -0
  53. package/es/map/handler/tap_zoom.d.ts +28 -0
  54. package/es/map/handler/tap_zoom.js +87 -0
  55. package/es/map/handler/touch_pan.d.ts +40 -0
  56. package/es/map/handler/touch_pan.js +85 -0
  57. package/es/map/handler/transform-provider.d.ts +23 -0
  58. package/es/map/handler/transform-provider.js +35 -0
  59. package/es/map/handler/two_fingers_touch.d.ts +107 -0
  60. package/es/map/handler/two_fingers_touch.js +289 -0
  61. package/es/map/handler_inertia.d.ts +20 -0
  62. package/es/{handler → map}/handler_inertia.js +36 -50
  63. package/es/map/handler_manager.d.ts +154 -0
  64. package/es/map/handler_manager.js +466 -0
  65. package/es/map/map.d.ts +625 -0
  66. package/es/map/map.js +972 -0
  67. package/es/map/util/abort_error.d.ts +15 -0
  68. package/es/map/util/abort_error.js +21 -0
  69. package/es/map/util/browser.d.ts +10 -0
  70. package/es/map/util/browser.js +30 -0
  71. package/es/map/util/dom.d.ts +30 -0
  72. package/es/map/util/dom.js +105 -0
  73. package/es/map/util/evented.d.ts +75 -0
  74. package/es/map/util/evented.js +158 -0
  75. package/es/map/util/task_queue.d.ts +18 -0
  76. package/es/map/util/task_queue.js +54 -0
  77. package/es/map/util/util.d.ts +104 -0
  78. package/es/map/util/util.js +155 -0
  79. package/lib/index.d.ts +3 -4
  80. package/lib/index.js +12 -42
  81. package/lib/map/camera.d.ts +690 -0
  82. package/lib/map/camera.js +1145 -0
  83. package/{es → lib/map}/css/l7.css +41 -7
  84. package/lib/map/events.d.ts +384 -0
  85. package/lib/map/events.js +231 -0
  86. package/lib/map/geo/edge_insets.d.ts +97 -0
  87. package/lib/{geo → map/geo}/edge_insets.js +56 -35
  88. package/lib/map/geo/lng_lat.d.ts +116 -0
  89. package/lib/map/geo/lng_lat.js +166 -0
  90. package/lib/map/geo/lng_lat_bounds.d.ts +217 -0
  91. package/lib/map/geo/lng_lat_bounds.js +341 -0
  92. package/lib/map/geo/mercator_coordinate.d.ts +113 -0
  93. package/lib/map/geo/mercator_coordinate.js +157 -0
  94. package/lib/map/geo/transform.d.ts +262 -0
  95. package/lib/map/geo/transform.js +744 -0
  96. package/{es → lib/map}/handler/box_zoom.d.ts +30 -24
  97. package/lib/map/handler/box_zoom.js +153 -0
  98. package/lib/map/handler/click_zoom.d.ts +24 -0
  99. package/lib/map/handler/click_zoom.js +54 -0
  100. package/lib/map/handler/cooperative_gestures.d.ts +40 -0
  101. package/lib/map/handler/cooperative_gestures.js +101 -0
  102. package/lib/map/handler/drag_handler.d.ts +88 -0
  103. package/lib/map/handler/drag_handler.js +97 -0
  104. package/lib/map/handler/drag_move_state_manager.d.ts +30 -0
  105. package/lib/map/handler/drag_move_state_manager.js +103 -0
  106. package/lib/map/handler/handler_util.d.ts +3 -0
  107. package/lib/{handler → map/handler}/handler_util.js +1 -2
  108. package/lib/map/handler/keyboard.d.ts +88 -0
  109. package/lib/map/handler/keyboard.js +205 -0
  110. package/lib/map/handler/map_event.d.ts +46 -0
  111. package/lib/map/handler/map_event.js +140 -0
  112. package/lib/map/handler/mouse.d.ts +30 -0
  113. package/lib/map/handler/mouse.js +93 -0
  114. package/lib/map/handler/one_finger_touch_drag.d.ts +15 -0
  115. package/lib/map/handler/one_finger_touch_drag.js +47 -0
  116. package/lib/map/handler/scroll_zoom.d.ts +102 -0
  117. package/lib/map/handler/scroll_zoom.js +320 -0
  118. package/lib/{handler → map/handler}/shim/dblclick_zoom.d.ts +14 -10
  119. package/lib/{handler → map/handler}/shim/dblclick_zoom.js +21 -17
  120. package/lib/map/handler/shim/drag_pan.d.ts +79 -0
  121. package/lib/map/handler/shim/drag_pan.js +85 -0
  122. package/lib/{handler → map/handler}/shim/drag_rotate.d.ts +24 -16
  123. package/lib/map/handler/shim/drag_rotate.js +74 -0
  124. package/lib/map/handler/shim/two_fingers_touch.d.ts +74 -0
  125. package/lib/map/handler/shim/two_fingers_touch.js +114 -0
  126. package/lib/map/handler/tap_drag_zoom.d.ts +28 -0
  127. package/lib/map/handler/tap_drag_zoom.js +99 -0
  128. package/lib/map/handler/tap_recognizer.d.ts +35 -0
  129. package/lib/map/handler/tap_recognizer.js +116 -0
  130. package/lib/map/handler/tap_zoom.d.ts +28 -0
  131. package/lib/map/handler/tap_zoom.js +94 -0
  132. package/lib/map/handler/touch_pan.d.ts +40 -0
  133. package/lib/map/handler/touch_pan.js +92 -0
  134. package/lib/map/handler/transform-provider.d.ts +23 -0
  135. package/lib/map/handler/transform-provider.js +43 -0
  136. package/lib/map/handler/two_fingers_touch.d.ts +107 -0
  137. package/lib/map/handler/two_fingers_touch.js +296 -0
  138. package/lib/map/handler_inertia.d.ts +20 -0
  139. package/lib/{handler → map}/handler_inertia.js +38 -53
  140. package/lib/map/handler_manager.d.ts +154 -0
  141. package/lib/map/handler_manager.js +474 -0
  142. package/lib/map/map.d.ts +625 -0
  143. package/lib/map/map.js +979 -0
  144. package/lib/map/util/abort_error.d.ts +15 -0
  145. package/lib/map/util/abort_error.js +29 -0
  146. package/lib/map/util/browser.d.ts +10 -0
  147. package/lib/map/util/browser.js +36 -0
  148. package/lib/map/util/dom.d.ts +30 -0
  149. package/lib/map/util/dom.js +113 -0
  150. package/lib/map/util/evented.d.ts +75 -0
  151. package/lib/map/util/evented.js +167 -0
  152. package/lib/map/util/task_queue.d.ts +18 -0
  153. package/lib/map/util/task_queue.js +62 -0
  154. package/lib/map/util/util.d.ts +104 -0
  155. package/lib/map/util/util.js +171 -0
  156. package/package.json +6 -3
  157. package/es/camera.d.ts +0 -86
  158. package/es/camera.js +0 -639
  159. package/es/earthmap.d.ts +0 -69
  160. package/es/earthmap.js +0 -445
  161. package/es/geo/edge_insets.d.ts +0 -54
  162. package/es/geo/lng_lat.d.ts +0 -18
  163. package/es/geo/lng_lat.js +0 -59
  164. package/es/geo/lng_lat_bounds.d.ts +0 -25
  165. package/es/geo/lng_lat_bounds.js +0 -118
  166. package/es/geo/mercator.d.ts +0 -30
  167. package/es/geo/mercator.js +0 -72
  168. package/es/geo/point.d.ts +0 -40
  169. package/es/geo/point.js +0 -153
  170. package/es/geo/simple.d.ts +0 -30
  171. package/es/geo/simple.js +0 -75
  172. package/es/geo/transform.d.ts +0 -198
  173. package/es/geo/transform.js +0 -895
  174. package/es/handler/IHandler.d.ts +0 -34
  175. package/es/handler/IHandler.js +0 -1
  176. package/es/handler/blockable_map_event.d.ts +0 -17
  177. package/es/handler/blockable_map_event.js +0 -58
  178. package/es/handler/box_zoom.js +0 -162
  179. package/es/handler/click_zoom.d.ts +0 -16
  180. package/es/handler/click_zoom.js +0 -40
  181. package/es/handler/events/event.d.ts +0 -4
  182. package/es/handler/events/event.js +0 -12
  183. package/es/handler/events/index.d.ts +0 -4
  184. package/es/handler/events/index.js +0 -4
  185. package/es/handler/events/map_mouse_event.d.ts +0 -34
  186. package/es/handler/events/map_mouse_event.js +0 -45
  187. package/es/handler/events/map_touch_event.d.ts +0 -57
  188. package/es/handler/events/map_touch_event.js +0 -75
  189. package/es/handler/events/map_wheel_event.d.ts +0 -33
  190. package/es/handler/events/map_wheel_event.js +0 -33
  191. package/es/handler/events/render_event.d.ts +0 -6
  192. package/es/handler/events/render_event.js +0 -10
  193. package/es/handler/handler_inertia.d.ts +0 -23
  194. package/es/handler/handler_manager.d.ts +0 -61
  195. package/es/handler/handler_manager.js +0 -487
  196. package/es/handler/handler_util.d.ts +0 -4
  197. package/es/handler/keyboard.d.ts +0 -36
  198. package/es/handler/keyboard.js +0 -131
  199. package/es/handler/map_event.d.ts +0 -29
  200. package/es/handler/map_event.js +0 -89
  201. package/es/handler/mouse/index.d.ts +0 -4
  202. package/es/handler/mouse/index.js +0 -4
  203. package/es/handler/mouse/mouse_handler.d.ts +0 -22
  204. package/es/handler/mouse/mouse_handler.js +0 -99
  205. package/es/handler/mouse/mousepan_handler.d.ts +0 -10
  206. package/es/handler/mouse/mousepan_handler.js +0 -21
  207. package/es/handler/mouse/mousepitch_hander.d.ts +0 -9
  208. package/es/handler/mouse/mousepitch_hander.js +0 -24
  209. package/es/handler/mouse/mouserotate_hander.d.ts +0 -9
  210. package/es/handler/mouse/mouserotate_hander.js +0 -24
  211. package/es/handler/mouse/util.d.ts +0 -6
  212. package/es/handler/mouse/util.js +0 -12
  213. package/es/handler/scroll_zoom.d.ts +0 -93
  214. package/es/handler/scroll_zoom.js +0 -315
  215. package/es/handler/shim/drag_pan.d.ts +0 -61
  216. package/es/handler/shim/drag_pan.js +0 -75
  217. package/es/handler/shim/drag_rotate.js +0 -64
  218. package/es/handler/shim/touch_zoom_rotate.d.ts +0 -70
  219. package/es/handler/shim/touch_zoom_rotate.js +0 -104
  220. package/es/handler/tap/single_tap_recognizer.d.ts +0 -20
  221. package/es/handler/tap/single_tap_recognizer.js +0 -77
  222. package/es/handler/tap/tap_drag_zoom.d.ts +0 -22
  223. package/es/handler/tap/tap_drag_zoom.js +0 -89
  224. package/es/handler/tap/tap_recognizer.d.ts +0 -17
  225. package/es/handler/tap/tap_recognizer.js +0 -46
  226. package/es/handler/tap/tap_zoom.d.ts +0 -22
  227. package/es/handler/tap/tap_zoom.js +0 -81
  228. package/es/handler/touch/index.d.ts +0 -5
  229. package/es/handler/touch/index.js +0 -5
  230. package/es/handler/touch/touch_pan.d.ts +0 -30
  231. package/es/handler/touch/touch_pan.js +0 -91
  232. package/es/handler/touch/touch_pitch.d.ts +0 -13
  233. package/es/handler/touch/touch_pitch.js +0 -75
  234. package/es/handler/touch/touch_rotate.d.ts +0 -12
  235. package/es/handler/touch/touch_rotate.js +0 -57
  236. package/es/handler/touch/touch_zoom.d.ts +0 -12
  237. package/es/handler/touch/touch_zoom.js +0 -37
  238. package/es/handler/touch/two_touch.d.ts +0 -23
  239. package/es/handler/touch/two_touch.js +0 -98
  240. package/es/hash.d.ts +0 -14
  241. package/es/hash.js +0 -121
  242. package/es/interface.d.ts +0 -34
  243. package/es/interface.js +0 -1
  244. package/es/map.d.ts +0 -70
  245. package/es/map.js +0 -472
  246. package/es/util.d.ts +0 -25
  247. package/es/util.js +0 -70
  248. package/es/utils/Aabb.d.ts +0 -12
  249. package/es/utils/Aabb.js +0 -72
  250. package/es/utils/dom.d.ts +0 -4
  251. package/es/utils/dom.js +0 -117
  252. package/es/utils/performance.d.ts +0 -17
  253. package/es/utils/performance.js +0 -58
  254. package/es/utils/primitives.d.ts +0 -6
  255. package/es/utils/primitives.js +0 -37
  256. package/es/utils/task_queue.d.ts +0 -13
  257. package/es/utils/task_queue.js +0 -60
  258. package/lib/camera.d.ts +0 -86
  259. package/lib/camera.js +0 -648
  260. package/lib/earthmap.d.ts +0 -69
  261. package/lib/earthmap.js +0 -451
  262. package/lib/geo/edge_insets.d.ts +0 -54
  263. package/lib/geo/lng_lat.d.ts +0 -18
  264. package/lib/geo/lng_lat.js +0 -67
  265. package/lib/geo/lng_lat_bounds.d.ts +0 -25
  266. package/lib/geo/lng_lat_bounds.js +0 -126
  267. package/lib/geo/mercator.d.ts +0 -30
  268. package/lib/geo/mercator.js +0 -88
  269. package/lib/geo/point.d.ts +0 -40
  270. package/lib/geo/point.js +0 -161
  271. package/lib/geo/simple.d.ts +0 -30
  272. package/lib/geo/simple.js +0 -92
  273. package/lib/geo/transform.d.ts +0 -198
  274. package/lib/geo/transform.js +0 -906
  275. package/lib/handler/IHandler.d.ts +0 -34
  276. package/lib/handler/IHandler.js +0 -5
  277. package/lib/handler/blockable_map_event.d.ts +0 -17
  278. package/lib/handler/blockable_map_event.js +0 -66
  279. package/lib/handler/box_zoom.js +0 -168
  280. package/lib/handler/click_zoom.d.ts +0 -16
  281. package/lib/handler/click_zoom.js +0 -48
  282. package/lib/handler/events/event.d.ts +0 -4
  283. package/lib/handler/events/event.js +0 -20
  284. package/lib/handler/events/index.d.ts +0 -4
  285. package/lib/handler/events/index.js +0 -27
  286. package/lib/handler/events/map_mouse_event.d.ts +0 -34
  287. package/lib/handler/events/map_mouse_event.js +0 -53
  288. package/lib/handler/events/map_touch_event.d.ts +0 -57
  289. package/lib/handler/events/map_touch_event.js +0 -83
  290. package/lib/handler/events/map_wheel_event.d.ts +0 -33
  291. package/lib/handler/events/map_wheel_event.js +0 -41
  292. package/lib/handler/events/render_event.d.ts +0 -6
  293. package/lib/handler/events/render_event.js +0 -18
  294. package/lib/handler/handler_inertia.d.ts +0 -23
  295. package/lib/handler/handler_manager.d.ts +0 -61
  296. package/lib/handler/handler_manager.js +0 -495
  297. package/lib/handler/handler_util.d.ts +0 -4
  298. package/lib/handler/keyboard.d.ts +0 -36
  299. package/lib/handler/keyboard.js +0 -138
  300. package/lib/handler/map_event.d.ts +0 -29
  301. package/lib/handler/map_event.js +0 -97
  302. package/lib/handler/mouse/index.d.ts +0 -4
  303. package/lib/handler/mouse/index.js +0 -27
  304. package/lib/handler/mouse/mouse_handler.d.ts +0 -22
  305. package/lib/handler/mouse/mouse_handler.js +0 -107
  306. package/lib/handler/mouse/mousepan_handler.d.ts +0 -10
  307. package/lib/handler/mouse/mousepan_handler.js +0 -29
  308. package/lib/handler/mouse/mousepitch_hander.d.ts +0 -9
  309. package/lib/handler/mouse/mousepitch_hander.js +0 -32
  310. package/lib/handler/mouse/mouserotate_hander.d.ts +0 -9
  311. package/lib/handler/mouse/mouserotate_hander.js +0 -32
  312. package/lib/handler/mouse/util.d.ts +0 -6
  313. package/lib/handler/mouse/util.js +0 -19
  314. package/lib/handler/scroll_zoom.d.ts +0 -93
  315. package/lib/handler/scroll_zoom.js +0 -322
  316. package/lib/handler/shim/drag_pan.d.ts +0 -61
  317. package/lib/handler/shim/drag_pan.js +0 -83
  318. package/lib/handler/shim/drag_rotate.js +0 -72
  319. package/lib/handler/shim/touch_zoom_rotate.d.ts +0 -70
  320. package/lib/handler/shim/touch_zoom_rotate.js +0 -112
  321. package/lib/handler/tap/single_tap_recognizer.d.ts +0 -20
  322. package/lib/handler/tap/single_tap_recognizer.js +0 -86
  323. package/lib/handler/tap/tap_drag_zoom.d.ts +0 -22
  324. package/lib/handler/tap/tap_drag_zoom.js +0 -97
  325. package/lib/handler/tap/tap_recognizer.d.ts +0 -17
  326. package/lib/handler/tap/tap_recognizer.js +0 -56
  327. package/lib/handler/tap/tap_zoom.d.ts +0 -22
  328. package/lib/handler/tap/tap_zoom.js +0 -89
  329. package/lib/handler/touch/index.d.ts +0 -5
  330. package/lib/handler/touch/index.js +0 -34
  331. package/lib/handler/touch/touch_pan.d.ts +0 -30
  332. package/lib/handler/touch/touch_pan.js +0 -100
  333. package/lib/handler/touch/touch_pitch.d.ts +0 -13
  334. package/lib/handler/touch/touch_pitch.js +0 -83
  335. package/lib/handler/touch/touch_rotate.d.ts +0 -12
  336. package/lib/handler/touch/touch_rotate.js +0 -65
  337. package/lib/handler/touch/touch_zoom.d.ts +0 -12
  338. package/lib/handler/touch/touch_zoom.js +0 -45
  339. package/lib/handler/touch/two_touch.d.ts +0 -23
  340. package/lib/handler/touch/two_touch.js +0 -106
  341. package/lib/hash.d.ts +0 -14
  342. package/lib/hash.js +0 -129
  343. package/lib/interface.d.ts +0 -34
  344. package/lib/interface.js +0 -5
  345. package/lib/map.d.ts +0 -70
  346. package/lib/map.js +0 -478
  347. package/lib/util.d.ts +0 -25
  348. package/lib/util.js +0 -89
  349. package/lib/utils/Aabb.d.ts +0 -12
  350. package/lib/utils/Aabb.js +0 -80
  351. package/lib/utils/dom.d.ts +0 -4
  352. package/lib/utils/dom.js +0 -125
  353. package/lib/utils/performance.d.ts +0 -17
  354. package/lib/utils/performance.js +0 -64
  355. package/lib/utils/primitives.d.ts +0 -6
  356. package/lib/utils/primitives.js +0 -45
  357. package/lib/utils/task_queue.d.ts +0 -13
  358. package/lib/utils/task_queue.js +0 -67
@@ -1,23 +0,0 @@
1
- import type { EarthMap } from '../earthmap';
2
- import type { Map } from '../map';
3
- import type { IDragPanOptions } from './shim/drag_pan';
4
- export interface IInertiaOptions {
5
- linearity: number;
6
- easing: (t: number) => number;
7
- deceleration: number;
8
- maxSpeed: number;
9
- }
10
- export type InputEvent = MouseEvent | TouchEvent | KeyboardEvent | WheelEvent;
11
- export default class HandlerInertia {
12
- private map;
13
- private inertiaBuffer;
14
- constructor(map: Map | EarthMap);
15
- clear(): void;
16
- record(settings: any): void;
17
- drainInertiaBuffer(): void;
18
- onMoveEnd(panInertiaOptions?: IDragPanOptions): ({
19
- [key: string]: any;
20
- } & {
21
- noMoveStart: boolean;
22
- }) | undefined;
23
- }
@@ -1,61 +0,0 @@
1
- import type { EarthMap } from '../earthmap';
2
- import type { Map } from '../map';
3
- import type { IHandlerResult } from './IHandler';
4
- import RenderFrameEvent from './events/render_event';
5
- export type InputEvent = MouseEvent | TouchEvent | KeyboardEvent | WheelEvent;
6
- export interface IHandlerOptions {
7
- interactive: boolean;
8
- boxZoom: boolean;
9
- dragRotate: boolean;
10
- dragPan: boolean;
11
- keyboard: boolean;
12
- doubleClickZoom: boolean;
13
- touchZoomRotate: boolean;
14
- touchPitch: boolean;
15
- trackResize: boolean;
16
- renderWorldCopies: boolean;
17
- bearingSnap: number;
18
- clickTolerance: number;
19
- pitchWithRotate: boolean;
20
- pitchEnabled: boolean;
21
- rotateEnabled: boolean;
22
- }
23
- declare class HandlerManager {
24
- private map;
25
- private el;
26
- private handlers;
27
- private eventsInProgress;
28
- private frameId;
29
- private inertia;
30
- private bearingSnap;
31
- private handlersById;
32
- private updatingCamera;
33
- private changes;
34
- private previousActiveHandlers;
35
- private bearingChanged;
36
- private rotateEnabled;
37
- private pitchEnabled;
38
- private listeners;
39
- constructor(map: Map | EarthMap, options: IHandlerOptions);
40
- destroy(): void;
41
- stop(): void;
42
- isActive(): boolean;
43
- isZooming(): boolean;
44
- isRotating(): boolean;
45
- isMoving(): boolean;
46
- handleWindowEvent: (e: InputEvent) => void;
47
- handleEvent: (e: InputEvent | RenderFrameEvent, eventName?: string) => void;
48
- mergeIHandlerResult(mergedIHandlerResult: IHandlerResult, eventsInProgress: {
49
- [key: string]: any;
50
- }, HandlerResult: IHandlerResult, name: string, e?: InputEvent): void;
51
- triggerRenderFrame(): void;
52
- private addDefaultHandlers;
53
- private add;
54
- private blockedByActive;
55
- private getMapTouches;
56
- private applyChanges;
57
- private updateMapTransform;
58
- private fireEvents;
59
- private fireEvent;
60
- }
61
- export default HandlerManager;
@@ -1,487 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- // @ts-ignore
3
- // tslint:disable-next-line: no-submodule-imports
4
- import { lodashUtil } from '@antv/l7-utils';
5
- import Point from "../geo/point";
6
- import DOM from "../utils/dom";
7
- import BlockableMapEventHandler from "./blockable_map_event";
8
- import BoxZoomHandler from "./box_zoom";
9
- import ClickZoomHandler from "./click_zoom";
10
- import { Event } from "./events/event";
11
- import RenderFrameEvent from "./events/render_event";
12
- import HandlerInertia from "./handler_inertia";
13
- import KeyboardHandler from "./keyboard";
14
- import MapEventHandler from "./map_event";
15
- import { MousePanHandler, MousePitchHandler, MouseRotateHandler } from "./mouse";
16
- import ScrollZoomHandler from "./scroll_zoom";
17
- import DoubleClickZoomHandler from "./shim/dblclick_zoom";
18
- import DragPanHandler from "./shim/drag_pan";
19
- import DragRotateHandler from "./shim/drag_rotate";
20
- import TouchZoomRotateHandler from "./shim/touch_zoom_rotate";
21
- import TapDragZoomHandler from "./tap/tap_drag_zoom";
22
- import TapZoomHandler from "./tap/tap_zoom";
23
- import { TouchPanHandler, TouchPitchHandler, TouchRotateHandler, TouchZoomHandler } from "./touch";
24
- const {
25
- merge
26
- } = lodashUtil;
27
- const isMoving = p => p.zoom || p.drag || p.pitch || p.rotate;
28
- function hasChange(result) {
29
- return result.panDelta && result.panDelta.mag() || result.zoomDelta || result.bearingDelta || result.pitchDelta;
30
- }
31
- class HandlerManager {
32
- constructor(map, options) {
33
- _defineProperty(this, "map", void 0);
34
- _defineProperty(this, "el", void 0);
35
- _defineProperty(this, "handlers", void 0);
36
- _defineProperty(this, "eventsInProgress", void 0);
37
- _defineProperty(this, "frameId", void 0);
38
- _defineProperty(this, "inertia", void 0);
39
- _defineProperty(this, "bearingSnap", void 0);
40
- _defineProperty(this, "handlersById", void 0);
41
- _defineProperty(this, "updatingCamera", void 0);
42
- _defineProperty(this, "changes", void 0);
43
- _defineProperty(this, "previousActiveHandlers", void 0);
44
- _defineProperty(this, "bearingChanged", void 0);
45
- _defineProperty(this, "rotateEnabled", void 0);
46
- _defineProperty(this, "pitchEnabled", void 0);
47
- _defineProperty(this, "listeners", void 0);
48
- _defineProperty(this, "handleWindowEvent", e => {
49
- this.handleEvent(e, `${e.type}Window`);
50
- });
51
- _defineProperty(this, "handleEvent", (e, eventName) => {
52
- if (e.type === 'blur') {
53
- this.stop();
54
- return;
55
- }
56
- this.updatingCamera = true;
57
- const inputEvent = e.type === 'renderFrame' ? undefined : e;
58
-
59
- /*
60
- * We don't call e.preventDefault() for any events by default.
61
- * Handlers are responsible for calling it where necessary.
62
- */
63
-
64
- const mergedIHandlerResult = {
65
- needsRenderFrame: false
66
- };
67
- const eventsInProgress = {};
68
- const activeHandlers = {};
69
- // @ts-ignore
70
- const mapTouches = e.touches ?
71
- // @ts-ignore
72
- this.getMapTouches(e.touches) : undefined;
73
- const points = mapTouches ? DOM.touchPos(this.el, mapTouches) : DOM.mousePos(this.el, e);
74
- for (const {
75
- handlerName,
76
- handler,
77
- allowed
78
- } of this.handlers) {
79
- if (!handler.isEnabled()) {
80
- continue;
81
- }
82
- let data;
83
- if (this.blockedByActive(activeHandlers, allowed, handlerName)) {
84
- handler.reset();
85
- } else {
86
- const handerName = eventName || e.type;
87
- // @ts-ignore
88
- if (handler && handler[handerName]) {
89
- // @ts-ignore
90
- data = handler[handerName](e, points, mapTouches);
91
- this.mergeIHandlerResult(mergedIHandlerResult, eventsInProgress, data, handlerName, inputEvent);
92
- if (data && data.needsRenderFrame) {
93
- this.triggerRenderFrame();
94
- }
95
- }
96
- }
97
- // @ts-ignore
98
- if (data || handler.isActive()) {
99
- activeHandlers[handlerName] = handler;
100
- }
101
- }
102
- const deactivatedHandlers = {};
103
- for (const name in this.previousActiveHandlers) {
104
- if (!activeHandlers[name]) {
105
- deactivatedHandlers[name] = inputEvent;
106
- }
107
- }
108
- this.previousActiveHandlers = activeHandlers;
109
- if (Object.keys(deactivatedHandlers).length || hasChange(mergedIHandlerResult)) {
110
- this.changes.push([mergedIHandlerResult, eventsInProgress, deactivatedHandlers]);
111
- this.triggerRenderFrame();
112
- }
113
- if (Object.keys(activeHandlers).length || hasChange(mergedIHandlerResult)) {
114
- this.map.stop(true);
115
- }
116
- this.updatingCamera = false;
117
- const {
118
- cameraAnimation
119
- } = mergedIHandlerResult;
120
- if (cameraAnimation) {
121
- this.inertia.clear();
122
- this.fireEvents({}, {});
123
- this.changes = [];
124
- cameraAnimation(this.map);
125
- }
126
- });
127
- this.map = map;
128
- this.el = this.map.getCanvasContainer();
129
- this.handlers = [];
130
- this.handlersById = {};
131
- this.changes = [];
132
- this.inertia = new HandlerInertia(map);
133
- this.bearingSnap = options.bearingSnap;
134
- this.rotateEnabled = options.rotateEnabled;
135
- this.pitchEnabled = options.pitchEnabled;
136
- this.previousActiveHandlers = {};
137
-
138
- // Track whether map is currently moving, to compute start/move/end events
139
- this.eventsInProgress = {};
140
- this.addDefaultHandlers(options);
141
- const el = this.el;
142
- this.listeners = [];
143
- // l7 - mini
144
- this.listeners = [
145
- // Bind touchstart and touchmove with passive: false because, even though
146
- // they only fire a map events and therefore could theoretically be
147
- // passive, binding with passive: true causes iOS not to respect
148
- // e.preventDefault() in _other_ handlers, even if they are non-passive
149
- // (see https://bugs.webkit.org/show_bug.cgi?id=184251)
150
- [el, 'touchstart', {
151
- passive: false
152
- }], [el, 'touchmove', {
153
- passive: false
154
- }], [el, 'touchend', undefined], [el, 'touchcancel', undefined], [el, 'mousedown', undefined], [el, 'mousemove', undefined], [el, 'mouseup', undefined],
155
- // Bind window-level event listeners for move and up/end events. In the absence of
156
- // the pointer capture API, which is not supported by all necessary platforms,
157
- // window-level event listeners give us the best shot at capturing events that
158
- // fall outside the map canvas element. Use `{capture: true}` for the move event
159
- // to prevent map move events from being fired during a drag.
160
- // @ts-ignore
161
- [window.document, 'mousemove', {
162
- capture: true
163
- }],
164
- // @ts-ignore
165
- [window.document, 'mouseup', undefined], [el, 'mouseover', undefined], [el, 'mouseout', undefined], [el, 'dblclick', undefined], [el, 'click', undefined], [el, 'keydown', {
166
- capture: false
167
- }], [el, 'keyup', undefined], [el, 'wheel', {
168
- passive: false
169
- }], [el, 'contextmenu', undefined],
170
- // @ts-ignore
171
- [window, 'blur', undefined]];
172
- for (const [target, type, listenerOptions] of this.listeners) {
173
- // @ts-ignore
174
- DOM.addEventListener(target, type,
175
- // @ts-ignore
176
- target === window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);
177
- }
178
- }
179
- destroy() {
180
- for (const [target, type, listenerOptions] of this.listeners) {
181
- // @ts-ignore
182
- DOM.removeEventListener(target, type,
183
- // @ts-ignore
184
- target === window.document ? this.handleWindowEvent : this.handleEvent, listenerOptions);
185
- }
186
- }
187
- stop() {
188
- // do nothing if this method was triggered by a gesture update
189
- if (this.updatingCamera) {
190
- return;
191
- }
192
- for (const {
193
- handler
194
- } of this.handlers) {
195
- handler.reset();
196
- }
197
- this.inertia.clear();
198
- this.fireEvents({}, {});
199
- this.changes = [];
200
- }
201
- isActive() {
202
- for (const {
203
- handler
204
- } of this.handlers) {
205
- if (handler.isActive()) {
206
- return true;
207
- }
208
- }
209
- return false;
210
- }
211
- isZooming() {
212
- return !!this.eventsInProgress.zoom || this.map.scrollZoom.isZooming();
213
- }
214
- isRotating() {
215
- return !!this.eventsInProgress.rotate;
216
- }
217
- isMoving() {
218
- return Boolean(isMoving(this.eventsInProgress)) || this.isZooming();
219
- }
220
- mergeIHandlerResult(mergedIHandlerResult, eventsInProgress, HandlerResult, name, e) {
221
- if (!HandlerResult) {
222
- return;
223
- }
224
- merge(mergedIHandlerResult, HandlerResult);
225
- const eventData = {
226
- handlerName: name,
227
- originalEvent: HandlerResult.originalEvent || e
228
- };
229
-
230
- // track which handler changed which camera property
231
- if (HandlerResult.zoomDelta !== undefined) {
232
- eventsInProgress.zoom = eventData;
233
- }
234
- if (HandlerResult.panDelta !== undefined) {
235
- eventsInProgress.drag = eventData;
236
- }
237
- if (HandlerResult.pitchDelta !== undefined) {
238
- eventsInProgress.pitch = eventData;
239
- }
240
- if (HandlerResult.bearingDelta !== undefined) {
241
- eventsInProgress.rotate = eventData;
242
- }
243
- }
244
- triggerRenderFrame() {
245
- if (this.frameId === undefined) {
246
- this.frameId = this.map.requestRenderFrame(timeStamp => {
247
- // @ts-ignore
248
- delete this.frameId;
249
- this.handleEvent(new RenderFrameEvent('renderFrame', timeStamp));
250
- this.applyChanges();
251
- });
252
- }
253
- }
254
- addDefaultHandlers(options) {
255
- const map = this.map;
256
- const el = map.getCanvasContainer();
257
- this.add('mapEvent', new MapEventHandler(map, options));
258
- const boxZoom = map.boxZoom = new BoxZoomHandler(map, options);
259
- this.add('boxZoom', boxZoom);
260
- const tapZoom = new TapZoomHandler();
261
- const clickZoom = new ClickZoomHandler();
262
- map.doubleClickZoom = new DoubleClickZoomHandler(clickZoom, tapZoom);
263
- this.add('tapZoom', tapZoom);
264
- this.add('clickZoom', clickZoom);
265
- const tapDragZoom = new TapDragZoomHandler();
266
- this.add('tapDragZoom', tapDragZoom);
267
- const touchPitch = map.touchPitch = new TouchPitchHandler();
268
- this.add('touchPitch', touchPitch);
269
- const mouseRotate = new MouseRotateHandler(options);
270
- const mousePitch = new MousePitchHandler(options);
271
- map.dragRotate = new DragRotateHandler(options, mouseRotate, mousePitch);
272
- this.add('mouseRotate', mouseRotate, ['mousePitch']);
273
- this.add('mousePitch', mousePitch, ['mouseRotate']);
274
- const mousePan = new MousePanHandler(options);
275
- const touchPan = new TouchPanHandler(options);
276
- map.dragPan = new DragPanHandler(el, mousePan, touchPan);
277
- this.add('mousePan', mousePan);
278
- this.add('touchPan', touchPan, ['touchZoom', 'touchRotate']);
279
- const touchRotate = new TouchRotateHandler();
280
- const touchZoom = new TouchZoomHandler();
281
- map.touchZoomRotate = new TouchZoomRotateHandler(el, touchZoom, touchRotate, tapDragZoom);
282
- this.add('touchRotate', touchRotate, ['touchPan', 'touchZoom']);
283
- this.add('touchZoom', touchZoom, ['touchPan', 'touchRotate']);
284
- const scrollZoom = map.scrollZoom = new ScrollZoomHandler(map, this);
285
- this.add('scrollZoom', scrollZoom, ['mousePan']);
286
- const keyboard = map.keyboard = new KeyboardHandler();
287
- this.add('keyboard', keyboard);
288
- this.add('blockableMapEvent', new BlockableMapEventHandler(map));
289
- for (const name of ['boxZoom', 'doubleClickZoom', 'tapDragZoom', 'touchPitch', 'dragRotate', 'dragPan', 'touchZoomRotate', 'scrollZoom', 'keyboard']) {
290
- // @ts-ignore
291
- if (options.interactive && options[name]) {
292
- // @ts-ignore
293
- map[name].enable(options[name]);
294
- }
295
- }
296
- }
297
- add(handlerName, handler, allowed) {
298
- this.handlers.push({
299
- handlerName,
300
- handler,
301
- allowed
302
- });
303
- this.handlersById[handlerName] = handler;
304
- }
305
- blockedByActive(activeHandlers, allowed, myName) {
306
- for (const name in activeHandlers) {
307
- if (name === myName) {
308
- continue;
309
- }
310
- if (!allowed || allowed.indexOf(name) < 0) {
311
- return true;
312
- }
313
- }
314
- return false;
315
- }
316
- getMapTouches(touches) {
317
- const mapTouches = [];
318
- for (const t of touches) {
319
- const target = t.target;
320
- if (this.el.contains(target)) {
321
- mapTouches.push(t);
322
- }
323
- }
324
- return mapTouches;
325
- }
326
- applyChanges() {
327
- const combined = {};
328
- const combinedEventsInProgress = {};
329
- const combinedDeactivatedHandlers = {};
330
- for (const [change, eventsInProgress, deactivatedHandlers] of this.changes) {
331
- if (change.panDelta) {
332
- combined.panDelta = (combined.panDelta || new Point(0, 0))._add(change.panDelta);
333
- }
334
- if (change.zoomDelta) {
335
- combined.zoomDelta = (combined.zoomDelta || 0) + change.zoomDelta;
336
- }
337
- if (change.bearingDelta) {
338
- combined.bearingDelta = (combined.bearingDelta || 0) + change.bearingDelta;
339
- }
340
- if (change.pitchDelta) {
341
- combined.pitchDelta = (combined.pitchDelta || 0) + change.pitchDelta;
342
- }
343
- if (change.around !== undefined) {
344
- combined.around = change.around;
345
- }
346
- if (change.pinchAround !== undefined) {
347
- combined.pinchAround = change.pinchAround;
348
- }
349
- if (change.noInertia) {
350
- combined.noInertia = change.noInertia;
351
- }
352
- merge(combinedEventsInProgress, eventsInProgress);
353
- merge(combinedDeactivatedHandlers, deactivatedHandlers);
354
- }
355
- this.updateMapTransform(combined, combinedEventsInProgress, combinedDeactivatedHandlers);
356
- this.changes = [];
357
- }
358
- updateMapTransform(combinedResult, combinedEventsInProgress, deactivatedHandlers) {
359
- const map = this.map;
360
- const tr = map.transform;
361
- if (!hasChange(combinedResult)) {
362
- return this.fireEvents(combinedEventsInProgress, deactivatedHandlers);
363
- }
364
- const {
365
- panDelta,
366
- zoomDelta,
367
- bearingDelta,
368
- pitchDelta,
369
- pinchAround
370
- } = combinedResult;
371
- let {
372
- around
373
- } = combinedResult;
374
- if (pinchAround !== undefined) {
375
- around = pinchAround;
376
- }
377
-
378
- // stop any ongoing camera animations (easeTo, flyTo)
379
- map.stop(true);
380
- around = around || map.transform.centerPoint;
381
- const loc = tr.pointLocation(panDelta ? around.sub(panDelta) : around);
382
- if (bearingDelta && this.rotateEnabled) {
383
- tr.bearing += bearingDelta;
384
- }
385
- if (pitchDelta && this.pitchEnabled) {
386
- tr.pitch += pitchDelta;
387
- }
388
- if (zoomDelta) {
389
- tr.zoom += zoomDelta;
390
- }
391
- tr.setLocationAtPoint(loc, around);
392
- this.map.update();
393
- if (!combinedResult.noInertia) {
394
- this.inertia.record(combinedResult);
395
- }
396
- this.fireEvents(combinedEventsInProgress, deactivatedHandlers);
397
- }
398
- fireEvents(newEventsInProgress, deactivatedHandlers) {
399
- const wasMoving = isMoving(this.eventsInProgress);
400
- const nowMoving = isMoving(newEventsInProgress);
401
- const startEvents = {};
402
- for (const eventName in newEventsInProgress) {
403
- if (newEventsInProgress[eventName]) {
404
- const {
405
- originalEvent
406
- } = newEventsInProgress[eventName];
407
- if (!this.eventsInProgress[eventName]) {
408
- startEvents[`${eventName}start`] = originalEvent;
409
- }
410
- this.eventsInProgress[eventName] = newEventsInProgress[eventName];
411
- }
412
- }
413
-
414
- // fire start events only after this.eventsInProgress has been updated
415
- if (!wasMoving && nowMoving) {
416
- this.fireEvent('movestart', nowMoving.originalEvent);
417
- }
418
- for (const name in startEvents) {
419
- if (startEvents[name]) {
420
- this.fireEvent(name, startEvents[name]);
421
- }
422
- }
423
- if (newEventsInProgress.rotate) {
424
- this.bearingChanged = true;
425
- }
426
- if (nowMoving) {
427
- this.fireEvent('move', nowMoving.originalEvent);
428
- }
429
- for (const eventName in newEventsInProgress) {
430
- if (newEventsInProgress[eventName]) {
431
- const {
432
- originalEvent
433
- } = newEventsInProgress[eventName];
434
- this.fireEvent(eventName, originalEvent);
435
- }
436
- }
437
- const endEvents = {};
438
- let originalEndEvent;
439
- for (const eventName in this.eventsInProgress) {
440
- if (this.eventsInProgress[eventName]) {
441
- const {
442
- handlerName,
443
- originalEvent
444
- } = this.eventsInProgress[eventName];
445
- if (!this.handlersById[handlerName].isActive()) {
446
- delete this.eventsInProgress[eventName];
447
- originalEndEvent = deactivatedHandlers[handlerName] || originalEvent;
448
- endEvents[`${eventName}end`] = originalEndEvent;
449
- }
450
- }
451
- }
452
- for (const name in endEvents) {
453
- if (endEvents[name]) {
454
- this.fireEvent(name, endEvents[name]);
455
- }
456
- }
457
- const stillMoving = isMoving(this.eventsInProgress);
458
- if ((wasMoving || nowMoving) && !stillMoving) {
459
- this.updatingCamera = true;
460
- const inertialEase = this.inertia.onMoveEnd(this.map.dragPan.inertiaOptions);
461
- const shouldSnapToNorth = bearing => bearing !== 0 && -this.bearingSnap < bearing && bearing < this.bearingSnap;
462
- if (inertialEase) {
463
- if (shouldSnapToNorth(inertialEase.bearing || this.map.getBearing())) {
464
- inertialEase.bearing = 0;
465
- }
466
- this.map.easeTo(inertialEase, {
467
- originalEvent: originalEndEvent
468
- });
469
- } else {
470
- this.map.emit('moveend', new Event('moveend', {
471
- originalEvent: originalEndEvent
472
- }));
473
- if (shouldSnapToNorth(this.map.getBearing())) {
474
- this.map.resetNorth();
475
- }
476
- }
477
- this.bearingChanged = false;
478
- this.updatingCamera = false;
479
- }
480
- }
481
- fireEvent(type, e) {
482
- this.map.emit(type, new Event(type, e ? {
483
- originalEvent: e
484
- } : {}));
485
- }
486
- }
487
- export default HandlerManager;
@@ -1,4 +0,0 @@
1
- import type Point from '../geo/point';
2
- export declare function indexTouches(touches: Touch[], points: Point[]): {
3
- [key: string]: any;
4
- };
@@ -1,36 +0,0 @@
1
- import type { EarthMap } from '../earthmap';
2
- import type { Map } from '../map';
3
- /**
4
- * The `KeyboardHandler` allows the user to zoom, rotate, and pan the map using
5
- * the following keyboard shortcuts:
6
- *
7
- * - `=` / `+`: Increase the zoom level by 1.
8
- * - `Shift-=` / `Shift-+`: Increase the zoom level by 2.
9
- * - `-`: Decrease the zoom level by 1.
10
- * - `Shift--`: Decrease the zoom level by 2.
11
- * - Arrow keys: Pan by 100 pixels.
12
- * - `Shift+⇢`: Increase the rotation by 15 degrees.
13
- * - `Shift+⇠`: Decrease the rotation by 15 degrees.
14
- * - `Shift+⇡`: Increase the pitch by 10 degrees.
15
- * - `Shift+⇣`: Decrease the pitch by 10 degrees.
16
- */
17
- declare class KeyboardHandler {
18
- private enabled;
19
- private active;
20
- private panStep;
21
- private bearingStep;
22
- private pitchStep;
23
- /**
24
- * @private
25
- */
26
- constructor();
27
- reset(): void;
28
- keydown(e: KeyboardEvent): {
29
- cameraAnimation: (map: Map | EarthMap) => void;
30
- } | undefined;
31
- enable(): void;
32
- disable(): void;
33
- isEnabled(): boolean;
34
- isActive(): boolean;
35
- }
36
- export default KeyboardHandler;