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

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,112 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- /**
10
- * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by
11
- * pinching on a touchscreen.
12
- *
13
- * They can zoom with one finger by double tapping and dragging. On the second tap,
14
- * hold the finger down and drag up or down to zoom in or out.
15
- */
16
- class TouchZoomRotateHandler {
17
- /**
18
- * @private
19
- */
20
- constructor(el, touchZoom, touchRotate, tapDragZoom) {
21
- (0, _defineProperty2.default)(this, "el", void 0);
22
- (0, _defineProperty2.default)(this, "touchZoom", void 0);
23
- (0, _defineProperty2.default)(this, "touchRotate", void 0);
24
- (0, _defineProperty2.default)(this, "tapDragZoom", void 0);
25
- (0, _defineProperty2.default)(this, "rotationDisabled", void 0);
26
- (0, _defineProperty2.default)(this, "enabled", void 0);
27
- this.el = el;
28
- this.touchZoom = touchZoom;
29
- this.touchRotate = touchRotate;
30
- this.tapDragZoom = tapDragZoom;
31
- this.rotationDisabled = false;
32
- this.enabled = true;
33
- }
34
-
35
- /**
36
- * Enables the "pinch to rotate and zoom" interaction.
37
- *
38
- * @param {Object} [options] Options object.
39
- * @param {string} [options.around] If "center" is passed, map will zoom around the center
40
- *
41
- * @example
42
- * map.touchZoomRotate.enable();
43
- * @example
44
- * map.touchZoomRotate.enable({ around: 'center' });
45
- */
46
- enable(options) {
47
- this.touchZoom.enable(options);
48
- if (!this.rotationDisabled) {
49
- this.touchRotate.enable(options);
50
- }
51
- this.tapDragZoom.enable();
52
- this.el.classList.add('l7-touch-zoom-rotate');
53
- }
54
-
55
- /**
56
- * Disables the "pinch to rotate and zoom" interaction.
57
- *
58
- * @example
59
- * map.touchZoomRotate.disable();
60
- */
61
- disable() {
62
- this.touchZoom.disable();
63
- this.touchRotate.disable();
64
- this.tapDragZoom.disable();
65
- this.el.classList.remove('l7-touch-zoom-rotate');
66
- }
67
-
68
- /**
69
- * Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
70
- *
71
- * @returns {boolean} `true` if the "pinch to rotate and zoom" interaction is enabled.
72
- */
73
- isEnabled() {
74
- return this.touchZoom.isEnabled() && (this.rotationDisabled || this.touchRotate.isEnabled()) && this.tapDragZoom.isEnabled();
75
- }
76
-
77
- /**
78
- * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.
79
- *
80
- * @returns {boolean} //eslint-disable-line
81
- */
82
- isActive() {
83
- return this.touchZoom.isActive() || this.touchRotate.isActive() || this.tapDragZoom.isActive();
84
- }
85
-
86
- /**
87
- * Disables the "pinch to rotate" interaction, leaving the "pinch to zoom"
88
- * interaction enabled.
89
- *
90
- * @example
91
- * map.touchZoomRotate.disableRotation();
92
- */
93
- disableRotation() {
94
- this.rotationDisabled = true;
95
- this.touchRotate.disable();
96
- }
97
-
98
- /**
99
- * Enables the "pinch to rotate" interaction.
100
- *
101
- * @example
102
- * map.touchZoomRotate.enable();
103
- * map.touchZoomRotate.enableRotation();
104
- */
105
- enableRotation() {
106
- this.rotationDisabled = false;
107
- if (this.touchZoom.isEnabled()) {
108
- this.touchRotate.enable();
109
- }
110
- }
111
- }
112
- exports.default = TouchZoomRotateHandler;
@@ -1,20 +0,0 @@
1
- import Point from '../../geo/point';
2
- export declare const MAX_TAP_INTERVAL = 500;
3
- export declare const MAX_TOUCH_TIME = 500;
4
- export declare const MAX_DIST = 30;
5
- export default class SingleTapRecognizer {
6
- numTouches: number;
7
- centroid: Point;
8
- startTime: number;
9
- aborted: boolean;
10
- touches: {
11
- [key: string]: Point;
12
- };
13
- constructor(options: {
14
- numTouches: number;
15
- });
16
- reset(): void;
17
- touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
18
- touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
19
- touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): Point | undefined;
20
- }
@@ -1,86 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.MAX_TOUCH_TIME = exports.MAX_TAP_INTERVAL = exports.MAX_DIST = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _point = _interopRequireDefault(require("../../geo/point"));
10
- var _handler_util = require("../handler_util");
11
- // @ts-ignore
12
-
13
- function getCentroid(points) {
14
- const sum = new _point.default(0, 0);
15
- for (const point of points) {
16
- sum._add(point);
17
- }
18
- // @ts-ignore
19
- return sum.div(points.length);
20
- }
21
- const MAX_TAP_INTERVAL = exports.MAX_TAP_INTERVAL = 500;
22
- const MAX_TOUCH_TIME = exports.MAX_TOUCH_TIME = 500;
23
- const MAX_DIST = exports.MAX_DIST = 30;
24
- class SingleTapRecognizer {
25
- constructor(options) {
26
- (0, _defineProperty2.default)(this, "numTouches", void 0);
27
- (0, _defineProperty2.default)(this, "centroid", void 0);
28
- (0, _defineProperty2.default)(this, "startTime", void 0);
29
- (0, _defineProperty2.default)(this, "aborted", void 0);
30
- (0, _defineProperty2.default)(this, "touches", void 0);
31
- this.reset();
32
- this.numTouches = options.numTouches;
33
- }
34
- reset() {
35
- // @ts-ignore
36
- delete this.centroid;
37
- // @ts-ignore
38
- delete this.startTime;
39
- // @ts-ignore
40
- delete this.touches;
41
- this.aborted = false;
42
- }
43
- touchstart(e, points, mapTouches) {
44
- if (this.centroid || mapTouches.length > this.numTouches) {
45
- this.aborted = true;
46
- }
47
- if (this.aborted) {
48
- return;
49
- }
50
- if (this.startTime === undefined) {
51
- this.startTime = e.timeStamp;
52
- }
53
- if (mapTouches.length === this.numTouches) {
54
- this.centroid = getCentroid(points);
55
- this.touches = (0, _handler_util.indexTouches)(mapTouches, points);
56
- }
57
- }
58
- touchmove(e, points, mapTouches) {
59
- if (this.aborted || !this.centroid) {
60
- return;
61
- }
62
- const newTouches = (0, _handler_util.indexTouches)(mapTouches, points);
63
- for (const id in this.touches) {
64
- if (this.touches[id]) {
65
- const prevPos = this.touches[id];
66
- const pos = newTouches[id];
67
- if (!pos || pos.dist(prevPos) > MAX_DIST) {
68
- this.aborted = true;
69
- }
70
- }
71
- }
72
- }
73
- touchend(e, points, mapTouches) {
74
- if (!this.centroid || e.timeStamp - this.startTime > MAX_TOUCH_TIME) {
75
- this.aborted = true;
76
- }
77
- if (mapTouches.length === 0) {
78
- const centroid = !this.aborted && this.centroid;
79
- this.reset();
80
- if (centroid) {
81
- return centroid;
82
- }
83
- }
84
- }
85
- }
86
- exports.default = SingleTapRecognizer;
@@ -1,22 +0,0 @@
1
- import type Point from '../../geo/point';
2
- import TapRecognizer from './tap_recognizer';
3
- export default class TapDragZoomHandler {
4
- enabled: boolean;
5
- active: boolean;
6
- swipePoint: Point;
7
- swipeTouch: number;
8
- tapTime: number;
9
- tap: TapRecognizer;
10
- constructor();
11
- reset(): void;
12
- touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
13
- touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): {
14
- zoomDelta: number;
15
- } | undefined;
16
- touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
17
- touchcancel(): void;
18
- enable(): void;
19
- disable(): void;
20
- isEnabled(): boolean;
21
- isActive(): boolean;
22
- }
@@ -1,97 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _single_tap_recognizer = require("./single_tap_recognizer");
10
- var _tap_recognizer = _interopRequireDefault(require("./tap_recognizer"));
11
- // @ts-ignore
12
-
13
- class TapDragZoomHandler {
14
- constructor() {
15
- (0, _defineProperty2.default)(this, "enabled", void 0);
16
- (0, _defineProperty2.default)(this, "active", void 0);
17
- (0, _defineProperty2.default)(this, "swipePoint", void 0);
18
- (0, _defineProperty2.default)(this, "swipeTouch", void 0);
19
- (0, _defineProperty2.default)(this, "tapTime", void 0);
20
- (0, _defineProperty2.default)(this, "tap", void 0);
21
- this.tap = new _tap_recognizer.default({
22
- numTouches: 1,
23
- numTaps: 1
24
- });
25
- this.reset();
26
- }
27
- reset() {
28
- this.active = false;
29
- // @ts-ignore
30
- delete this.swipePoint;
31
- // @ts-ignore
32
- delete this.swipeTouch;
33
- // @ts-ignore
34
- delete this.tapTime;
35
- this.tap.reset();
36
- }
37
- touchstart(e, points, mapTouches) {
38
- if (this.swipePoint) {
39
- return;
40
- }
41
- if (this.tapTime && e.timeStamp - this.tapTime > _single_tap_recognizer.MAX_TAP_INTERVAL) {
42
- this.reset();
43
- }
44
- if (!this.tapTime) {
45
- this.tap.touchstart(e, points, mapTouches);
46
- } else if (mapTouches.length > 0) {
47
- this.swipePoint = points[0];
48
- this.swipeTouch = mapTouches[0].identifier;
49
- }
50
- }
51
- touchmove(e, points, mapTouches) {
52
- if (!this.tapTime) {
53
- this.tap.touchmove(e, points, mapTouches);
54
- } else if (this.swipePoint) {
55
- if (mapTouches[0].identifier !== this.swipeTouch) {
56
- return;
57
- }
58
- const newSwipePoint = points[0];
59
- const dist = newSwipePoint.y - this.swipePoint.y;
60
- this.swipePoint = newSwipePoint;
61
- e.preventDefault();
62
- this.active = true;
63
- return {
64
- zoomDelta: dist / 128
65
- };
66
- }
67
- }
68
- touchend(e, points, mapTouches) {
69
- if (!this.tapTime) {
70
- const point = this.tap.touchend(e, points, mapTouches);
71
- if (point) {
72
- this.tapTime = e.timeStamp;
73
- }
74
- } else if (this.swipePoint) {
75
- if (mapTouches.length === 0) {
76
- this.reset();
77
- }
78
- }
79
- }
80
- touchcancel() {
81
- this.reset();
82
- }
83
- enable() {
84
- this.enabled = true;
85
- }
86
- disable() {
87
- this.enabled = false;
88
- this.reset();
89
- }
90
- isEnabled() {
91
- return this.enabled;
92
- }
93
- isActive() {
94
- return this.active;
95
- }
96
- }
97
- exports.default = TapDragZoomHandler;
@@ -1,17 +0,0 @@
1
- import type Point from '../../geo/point';
2
- import SingleTapRecognizer from './single_tap_recognizer';
3
- export default class TapRecognizer {
4
- singleTap: SingleTapRecognizer;
5
- numTaps: number;
6
- lastTime: number;
7
- lastTap: Point;
8
- count: number;
9
- constructor(options: {
10
- numTaps: number;
11
- numTouches: number;
12
- });
13
- reset(): void;
14
- touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
15
- touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
16
- touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): Point | undefined;
17
- }
@@ -1,56 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _single_tap_recognizer = _interopRequireWildcard(require("./single_tap_recognizer"));
10
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
11
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
- // @ts-ignore
13
-
14
- class TapRecognizer {
15
- constructor(options) {
16
- (0, _defineProperty2.default)(this, "singleTap", void 0);
17
- (0, _defineProperty2.default)(this, "numTaps", void 0);
18
- (0, _defineProperty2.default)(this, "lastTime", void 0);
19
- (0, _defineProperty2.default)(this, "lastTap", void 0);
20
- (0, _defineProperty2.default)(this, "count", void 0);
21
- this.singleTap = new _single_tap_recognizer.default(options);
22
- this.numTaps = options.numTaps;
23
- this.reset();
24
- }
25
- reset() {
26
- this.lastTime = Infinity;
27
- // @ts-ignore
28
- delete this.lastTap;
29
- this.count = 0;
30
- this.singleTap.reset();
31
- }
32
- touchstart(e, points, mapTouches) {
33
- this.singleTap.touchstart(e, points, mapTouches);
34
- }
35
- touchmove(e, points, mapTouches) {
36
- this.singleTap.touchmove(e, points, mapTouches);
37
- }
38
- touchend(e, points, mapTouches) {
39
- const tap = this.singleTap.touchend(e, points, mapTouches);
40
- if (tap) {
41
- const soonEnough = e.timeStamp - this.lastTime < _single_tap_recognizer.MAX_TAP_INTERVAL;
42
- const closeEnough = !this.lastTap || this.lastTap.dist(tap) < _single_tap_recognizer.MAX_DIST;
43
- if (!soonEnough || !closeEnough) {
44
- this.reset();
45
- }
46
- this.count++;
47
- this.lastTime = e.timeStamp;
48
- this.lastTap = tap;
49
- if (this.count === this.numTaps) {
50
- this.reset();
51
- return tap;
52
- }
53
- }
54
- }
55
- }
56
- exports.default = TapRecognizer;
@@ -1,22 +0,0 @@
1
- import type { EarthMap } from '../../earthmap';
2
- import type Point from '../../geo/point';
3
- import type { Map } from '../../map';
4
- import TapRecognizer from './tap_recognizer';
5
- export default class TapZoomHandler {
6
- enabled: boolean;
7
- active: boolean;
8
- zoomIn: TapRecognizer;
9
- zoomOut: TapRecognizer;
10
- constructor();
11
- reset(): void;
12
- touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
13
- touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
14
- touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): {
15
- cameraAnimation: (map: Map | EarthMap) => Map | EarthMap;
16
- } | undefined;
17
- touchcancel(): void;
18
- enable(): void;
19
- disable(): void;
20
- isEnabled(): boolean;
21
- isActive(): boolean;
22
- }
@@ -1,89 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- var _tap_recognizer = _interopRequireDefault(require("./tap_recognizer"));
10
- // @ts-ignore
11
-
12
- class TapZoomHandler {
13
- constructor() {
14
- (0, _defineProperty2.default)(this, "enabled", void 0);
15
- (0, _defineProperty2.default)(this, "active", void 0);
16
- (0, _defineProperty2.default)(this, "zoomIn", void 0);
17
- (0, _defineProperty2.default)(this, "zoomOut", void 0);
18
- this.zoomIn = new _tap_recognizer.default({
19
- numTouches: 1,
20
- numTaps: 2
21
- });
22
- this.zoomOut = new _tap_recognizer.default({
23
- numTouches: 2,
24
- numTaps: 1
25
- });
26
- this.reset();
27
- }
28
- reset() {
29
- this.active = false;
30
- this.zoomIn.reset();
31
- this.zoomOut.reset();
32
- }
33
- touchstart(e, points, mapTouches) {
34
- this.zoomIn.touchstart(e, points, mapTouches);
35
- this.zoomOut.touchstart(e, points, mapTouches);
36
- }
37
- touchmove(e, points, mapTouches) {
38
- this.zoomIn.touchmove(e, points, mapTouches);
39
- this.zoomOut.touchmove(e, points, mapTouches);
40
- }
41
- touchend(e, points, mapTouches) {
42
- const zoomInPoint = this.zoomIn.touchend(e, points, mapTouches);
43
- const zoomOutPoint = this.zoomOut.touchend(e, points, mapTouches);
44
- if (zoomInPoint) {
45
- this.active = true;
46
- e.preventDefault();
47
- setTimeout(() => this.reset(), 0);
48
- return {
49
- cameraAnimation: map => map.easeTo({
50
- duration: 300,
51
- zoom: map.getZoom() + 1,
52
- around: map.unproject(zoomInPoint)
53
- }, {
54
- originalEvent: e
55
- })
56
- };
57
- } else if (zoomOutPoint) {
58
- this.active = true;
59
- e.preventDefault();
60
- setTimeout(() => this.reset(), 0);
61
- return {
62
- cameraAnimation: map => map.easeTo({
63
- duration: 300,
64
- zoom: map.getZoom() - 1,
65
- around: map.unproject(zoomOutPoint)
66
- }, {
67
- originalEvent: e
68
- })
69
- };
70
- }
71
- }
72
- touchcancel() {
73
- this.reset();
74
- }
75
- enable() {
76
- this.enabled = true;
77
- }
78
- disable() {
79
- this.enabled = false;
80
- this.reset();
81
- }
82
- isEnabled() {
83
- return this.enabled;
84
- }
85
- isActive() {
86
- return this.active;
87
- }
88
- }
89
- exports.default = TapZoomHandler;
@@ -1,5 +0,0 @@
1
- import TouchPanHandler from './touch_pan';
2
- import TouchPitchHandler from './touch_pitch';
3
- import TouchRotateHandler from './touch_rotate';
4
- import TouchZoomHandler from './touch_zoom';
5
- export { TouchPanHandler, TouchPitchHandler, TouchRotateHandler, TouchZoomHandler };
@@ -1,34 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "TouchPanHandler", {
8
- enumerable: true,
9
- get: function () {
10
- return _touch_pan.default;
11
- }
12
- });
13
- Object.defineProperty(exports, "TouchPitchHandler", {
14
- enumerable: true,
15
- get: function () {
16
- return _touch_pitch.default;
17
- }
18
- });
19
- Object.defineProperty(exports, "TouchRotateHandler", {
20
- enumerable: true,
21
- get: function () {
22
- return _touch_rotate.default;
23
- }
24
- });
25
- Object.defineProperty(exports, "TouchZoomHandler", {
26
- enumerable: true,
27
- get: function () {
28
- return _touch_zoom.default;
29
- }
30
- });
31
- var _touch_pan = _interopRequireDefault(require("./touch_pan"));
32
- var _touch_pitch = _interopRequireDefault(require("./touch_pitch"));
33
- var _touch_rotate = _interopRequireDefault(require("./touch_rotate"));
34
- var _touch_zoom = _interopRequireDefault(require("./touch_zoom"));
@@ -1,30 +0,0 @@
1
- import Point from '../../geo/point';
2
- export default class TouchPanHandler {
3
- enabled: boolean;
4
- active: boolean;
5
- touches: {
6
- [key: string]: Point;
7
- };
8
- minTouches: number;
9
- clickTolerance: number;
10
- sum: Point;
11
- constructor(options: {
12
- clickTolerance: number;
13
- });
14
- reset(): void;
15
- touchstart(e: TouchEvent, points: Point[], mapTouches: Touch[]): {
16
- around: Point;
17
- panDelta: Point;
18
- } | undefined;
19
- touchmove(e: TouchEvent, points: Point[], mapTouches: Touch[]): {
20
- around: Point;
21
- panDelta: Point;
22
- } | undefined;
23
- touchend(e: TouchEvent, points: Point[], mapTouches: Touch[]): void;
24
- touchcancel(): void;
25
- enable(): void;
26
- disable(): void;
27
- isEnabled(): boolean;
28
- isActive(): boolean;
29
- private calculateTransform;
30
- }