@antv/l7-map 2.21.11-beta.4 → 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,322 +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 _lng_lat = _interopRequireDefault(require("../geo/lng_lat"));
10
- var _util = require("../util");
11
- var _dom = _interopRequireDefault(require("../utils/dom"));
12
- // @ts-ignore
13
-
14
- // deltaY value for mouse scroll wheel identification
15
- const wheelZoomDelta = 4.000244140625;
16
-
17
- // These magic numbers control the rate of zoom. Trackpad events fire at a greater
18
- // frequency than mouse scroll wheel, so reduce the zoom rate per wheel tick
19
- const defaultZoomRate = 1 / 100;
20
- const wheelZoomRate = 1 / 450;
21
-
22
- // upper bound on how much we scale the map in any single render frame; this
23
- // is used to limit zoom rate in the case of very fast scrolling
24
- const maxScalePerFrame = 2;
25
-
26
- /**
27
- * The `ScrollZoomHandler` allows the user to zoom the map by scrolling.
28
- */
29
- class ScrollZoomHandler {
30
- /**
31
- * @private
32
- */
33
- constructor(map, handler) {
34
- (0, _defineProperty2.default)(this, "map", void 0);
35
- (0, _defineProperty2.default)(this, "el", void 0);
36
- (0, _defineProperty2.default)(this, "enabled", void 0);
37
- (0, _defineProperty2.default)(this, "active", void 0);
38
- (0, _defineProperty2.default)(this, "zooming", void 0);
39
- (0, _defineProperty2.default)(this, "aroundCenter", void 0);
40
- (0, _defineProperty2.default)(this, "around", void 0);
41
- (0, _defineProperty2.default)(this, "aroundPoint", void 0);
42
- (0, _defineProperty2.default)(this, "type", void 0);
43
- (0, _defineProperty2.default)(this, "lastValue", void 0);
44
- (0, _defineProperty2.default)(this, "timeout", void 0);
45
- // used for delayed-handling of a single wheel movement
46
- (0, _defineProperty2.default)(this, "finishTimeout", void 0);
47
- // used to delay final '{move,zoom}end' events
48
- (0, _defineProperty2.default)(this, "lastWheelEvent", void 0);
49
- (0, _defineProperty2.default)(this, "lastWheelEventTime", void 0);
50
- (0, _defineProperty2.default)(this, "startZoom", void 0);
51
- (0, _defineProperty2.default)(this, "targetZoom", void 0);
52
- (0, _defineProperty2.default)(this, "delta", void 0);
53
- (0, _defineProperty2.default)(this, "easing", void 0);
54
- (0, _defineProperty2.default)(this, "prevEase", void 0);
55
- (0, _defineProperty2.default)(this, "frameId", void 0);
56
- (0, _defineProperty2.default)(this, "handler", void 0);
57
- (0, _defineProperty2.default)(this, "defaultZoomRate", void 0);
58
- (0, _defineProperty2.default)(this, "wheelZoomRate", void 0);
59
- (0, _defineProperty2.default)(this, "onScrollFrame", () => {
60
- if (!this.frameId) {
61
- return;
62
- }
63
- this.frameId = null;
64
- if (!this.isActive()) {
65
- return;
66
- }
67
- const tr = this.map.transform;
68
-
69
- // if we've had scroll events since the last render frame, consume the
70
- // accumulated delta, and update the target zoom level accordingly
71
- if (this.delta !== 0) {
72
- // For trackpad events and single mouse wheel ticks, use the default zoom rate
73
- const zoomRate = this.type === 'wheel' && Math.abs(this.delta) > wheelZoomDelta ? this.wheelZoomRate : this.defaultZoomRate;
74
- // Scale by sigmoid of scroll wheel delta.
75
- let scale = maxScalePerFrame / (1 + Math.exp(-Math.abs(this.delta * zoomRate)));
76
- if (this.delta < 0 && scale !== 0) {
77
- scale = 1 / scale;
78
- }
79
- const fromScale = typeof this.targetZoom === 'number' ? tr.zoomScale(this.targetZoom) : tr.scale;
80
- this.targetZoom = Math.min(tr.maxZoom, Math.max(tr.minZoom, tr.scaleZoom(fromScale * scale)));
81
-
82
- // if this is a mouse wheel, refresh the starting zoom and easing
83
- // function we're using to smooth out the zooming between wheel
84
- // events
85
- if (this.type === 'wheel') {
86
- this.startZoom = tr.zoom;
87
- this.easing = this.smoothOutEasing(200);
88
- }
89
- this.delta = 0;
90
- }
91
- const targetZoom = typeof this.targetZoom === 'number' ? this.targetZoom : tr.zoom;
92
- const startZoom = this.startZoom;
93
- const easing = this.easing;
94
- let finished = false;
95
- let zoom;
96
- if (this.type === 'wheel' && startZoom && easing) {
97
- const t = Math.min(((0, _util.now)() - this.lastWheelEventTime) / 200, 1);
98
- const k = easing(t);
99
- zoom = (0, _util.interpolate)(startZoom, targetZoom, k);
100
- if (t < 1) {
101
- if (!this.frameId) {
102
- this.frameId = true;
103
- }
104
- } else {
105
- finished = true;
106
- }
107
- } else {
108
- zoom = targetZoom;
109
- finished = true;
110
- }
111
- this.active = true;
112
- if (finished) {
113
- this.active = false;
114
- // @ts-ignore
115
- this.finishTimeout = setTimeout(() => {
116
- this.zooming = false;
117
- this.handler.triggerRenderFrame();
118
- // @ts-ignore
119
- delete this.targetZoom;
120
- // @ts-ignore
121
- delete this.finishTimeout;
122
- }, 200);
123
- }
124
- return {
125
- noInertia: true,
126
- needsRenderFrame: !finished,
127
- zoomDelta: zoom - tr.zoom,
128
- around: this.aroundPoint,
129
- originalEvent: this.lastWheelEvent
130
- };
131
- });
132
- this.map = map;
133
- this.el = map.getCanvasContainer();
134
- this.handler = handler;
135
- this.delta = 0;
136
- this.defaultZoomRate = defaultZoomRate;
137
- this.wheelZoomRate = wheelZoomRate;
138
- }
139
-
140
- /**
141
- * Set the zoom rate of a trackpad
142
- * @param {number} [zoomRate=1/100] The rate used to scale trackpad movement to a zoom value.
143
- * @example
144
- * // Speed up trackpad zoom
145
- * map.scrollZoom.setZoomRate(1/25);
146
- */
147
- setZoomRate(zoomRate) {
148
- this.defaultZoomRate = zoomRate;
149
- }
150
-
151
- /**
152
- * Set the zoom rate of a mouse wheel
153
- * @param {number} [wheelZoomRate=1/450] The rate used to scale mouse wheel movement to a zoom value.
154
- * @example
155
- * // Slow down zoom of mouse wheel
156
- * map.scrollZoom.setWheelZoomRate(1/600);
157
- */
158
- setWheelZoomRate(zoomRate) {
159
- this.wheelZoomRate = zoomRate;
160
- }
161
-
162
- /**
163
- * Returns a Boolean indicating whether the "scroll to zoom" interaction is enabled.
164
- *
165
- * @returns {boolean} `true` if the "scroll to zoom" interaction is enabled.
166
- */
167
- isEnabled() {
168
- return !!this.enabled;
169
- }
170
-
171
- /*
172
- * Active state is turned on and off with every scroll wheel event and is set back to false before the map
173
- * render is called, so _active is not a good candidate for determining if a scroll zoom animation is in
174
- * progress.
175
- */
176
- isActive() {
177
- return !!this.active || this.finishTimeout !== undefined;
178
- }
179
- isZooming() {
180
- return !!this.zooming;
181
- }
182
-
183
- /**
184
- * Enables the "scroll to zoom" interaction.
185
- *
186
- * @param {Object} [options] Options object.
187
- * @param {string} [options.around] If "center" is passed, map will zoom around center of map
188
- *
189
- * @example
190
- * map.scrollZoom.enable();
191
- * @example
192
- * map.scrollZoom.enable({ around: 'center' })
193
- */
194
- enable(options) {
195
- if (this.isEnabled()) {
196
- return;
197
- }
198
- this.enabled = true;
199
- this.aroundCenter = options && options.around === 'center';
200
- }
201
-
202
- /**
203
- * Disables the "scroll to zoom" interaction.
204
- *
205
- * @example
206
- * map.scrollZoom.disable();
207
- */
208
- disable() {
209
- if (!this.isEnabled()) {
210
- return;
211
- }
212
- this.enabled = false;
213
- }
214
- wheel(e) {
215
- if (!this.isEnabled()) {
216
- return;
217
- }
218
- // Remove `any` cast when https://github.com/facebook/flow/issues/4879 is fixed.
219
- let value = e.deltaMode === window.WheelEvent.DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY;
220
- const nowTime = (0, _util.now)();
221
- const timeDelta = nowTime - (this.lastWheelEventTime || 0);
222
- this.lastWheelEventTime = nowTime;
223
- if (value !== 0 && value % wheelZoomDelta === 0) {
224
- // This one is definitely a mouse wheel event.
225
- this.type = 'wheel';
226
- } else if (value !== 0 && Math.abs(value) < 4) {
227
- // This one is definitely a trackpad event because it is so small.
228
- this.type = 'trackpad';
229
- } else if (timeDelta > 400) {
230
- // This is likely a new scroll action.
231
- this.type = null;
232
- this.lastValue = value;
233
-
234
- // Start a timeout in case this was a singular event, and dely it by up to 40ms.
235
- // @ts-ignore
236
- this.timeout = setTimeout(this.onTimeout, 40, e);
237
- } else if (!this.type) {
238
- // This is a repeating event, but we don't know the type of event just yet.
239
- // If the delta per time is small, we assume it's a fast trackpad; otherwise we switch into wheel mode.
240
- this.type = Math.abs(timeDelta * value) < 200 ? 'trackpad' : 'wheel';
241
-
242
- // Make sure our delayed event isn't fired again, because we accumulate
243
- // the previous event (which was less than 40ms ago) into this event.
244
- if (this.timeout) {
245
- clearTimeout(this.timeout);
246
- this.timeout = null;
247
- value += this.lastValue;
248
- }
249
- }
250
-
251
- // Slow down zoom if shift key is held for more precise zooming
252
- if (e.shiftKey && value) {
253
- value = value / 4;
254
- }
255
- // Only fire the callback if we actually know what type of scrolling device the user uses.
256
- if (this.type) {
257
- this.lastWheelEvent = e;
258
- this.delta -= value;
259
- if (!this.active) {
260
- this.start(e);
261
- }
262
- }
263
- e.preventDefault();
264
- }
265
- renderFrame() {
266
- return this.onScrollFrame();
267
- }
268
- reset() {
269
- this.active = false;
270
- }
271
- onTimeout(initialEvent) {
272
- this.type = 'wheel';
273
- this.delta -= this.lastValue;
274
- if (!this.active && this.start) {
275
- this.start(initialEvent);
276
- }
277
- }
278
- start(e) {
279
- if (!this.delta) {
280
- return;
281
- }
282
- if (this.frameId) {
283
- this.frameId = null;
284
- }
285
- this.active = true;
286
- if (!this.isZooming()) {
287
- this.zooming = true;
288
- }
289
- if (this.finishTimeout) {
290
- clearTimeout(this.finishTimeout);
291
- // @ts-ignore
292
- delete this.finishTimeout;
293
- }
294
- const pos = _dom.default.mousePos(this.el, e);
295
- this.around = _lng_lat.default.convert(this.aroundCenter ? this.map.getCenter() : this.map.unproject(pos));
296
- this.aroundPoint = this.map.transform.locationPoint(this.around);
297
- if (!this.frameId) {
298
- this.frameId = true;
299
- this.handler.triggerRenderFrame();
300
- }
301
- }
302
- smoothOutEasing(duration) {
303
- let easing = _util.ease;
304
- if (this.prevEase) {
305
- const preEase = this.prevEase;
306
- const t = ((0, _util.now)() - preEase.start) / preEase.duration;
307
- const speed = preEase.easing(t + 0.01) - preEase.easing(t);
308
-
309
- // Quick hack to make new bezier that is continuous with last
310
- const x = 0.27 / Math.sqrt(speed * speed + 0.0001) * 0.01;
311
- const y = Math.sqrt(0.27 * 0.27 - x * x);
312
- easing = (0, _util.bezier)(x, y, 0.25, 1);
313
- }
314
- this.prevEase = {
315
- start: (0, _util.now)(),
316
- duration,
317
- easing
318
- };
319
- return easing;
320
- }
321
- }
322
- var _default = exports.default = ScrollZoomHandler;
@@ -1,61 +0,0 @@
1
- import type { MousePanHandler } from '../mouse/';
2
- import type { TouchPanHandler } from '../touch/';
3
- export interface IDragPanOptions {
4
- linearity?: number;
5
- easing?: (t: number) => number;
6
- deceleration?: number;
7
- maxSpeed?: number;
8
- }
9
- /**
10
- * The `DragPanHandler` allows the user to pan the map by clicking and dragging
11
- * the cursor.
12
- */
13
- export default class DragPanHandler {
14
- inertiaOptions: IDragPanOptions;
15
- private el;
16
- private mousePan;
17
- private touchPan;
18
- /**
19
- * @private
20
- */
21
- constructor(el: HTMLElement, mousePan: MousePanHandler, touchPan: TouchPanHandler);
22
- /**
23
- * Enables the "drag to pan" interaction.
24
- *
25
- * @param {Object} [options] Options object
26
- * @param {number} [options.linearity=0] factor used to scale the drag velocity
27
- * @param {Function} [options.easing=bezier(0, 0, 0.3, 1)] easing function applled to `map.panTo` when applying the drag.
28
- * @param {number} [options.maxSpeed=1400] the maximum value of the drag velocity.
29
- * @param {number} [options.deceleration=2500] the rate at which the speed reduces after the pan ends.
30
- *
31
- * @example
32
- * map.dragPan.enable();
33
- * @example
34
- * map.dragPan.enable({
35
- * linearity: 0.3,
36
- * easing: bezier(0, 0, 0.3, 1),
37
- * maxSpeed: 1400,
38
- * deceleration: 2500,
39
- * });
40
- */
41
- enable(options?: IDragPanOptions): void;
42
- /**
43
- * Disables the "drag to pan" interaction.
44
- *
45
- * @example
46
- * map.dragPan.disable();
47
- */
48
- disable(): void;
49
- /**
50
- * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
51
- *
52
- * @returns {boolean} `true` if the "drag to pan" interaction is enabled.
53
- */
54
- isEnabled(): boolean;
55
- /**
56
- * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
57
- *
58
- * @returns {boolean} `true` if the "drag to pan" interaction is active.
59
- */
60
- isActive(): boolean;
61
- }
@@ -1,83 +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 `DragPanHandler` allows the user to pan the map by clicking and dragging
11
- * the cursor.
12
- */
13
- class DragPanHandler {
14
- /**
15
- * @private
16
- */
17
- constructor(el, mousePan, touchPan) {
18
- (0, _defineProperty2.default)(this, "inertiaOptions", void 0);
19
- (0, _defineProperty2.default)(this, "el", void 0);
20
- (0, _defineProperty2.default)(this, "mousePan", void 0);
21
- (0, _defineProperty2.default)(this, "touchPan", void 0);
22
- this.el = el;
23
- this.mousePan = mousePan;
24
- this.touchPan = touchPan;
25
- }
26
-
27
- /**
28
- * Enables the "drag to pan" interaction.
29
- *
30
- * @param {Object} [options] Options object
31
- * @param {number} [options.linearity=0] factor used to scale the drag velocity
32
- * @param {Function} [options.easing=bezier(0, 0, 0.3, 1)] easing function applled to `map.panTo` when applying the drag.
33
- * @param {number} [options.maxSpeed=1400] the maximum value of the drag velocity.
34
- * @param {number} [options.deceleration=2500] the rate at which the speed reduces after the pan ends.
35
- *
36
- * @example
37
- * map.dragPan.enable();
38
- * @example
39
- * map.dragPan.enable({
40
- * linearity: 0.3,
41
- * easing: bezier(0, 0, 0.3, 1),
42
- * maxSpeed: 1400,
43
- * deceleration: 2500,
44
- * });
45
- */
46
- enable(options) {
47
- this.inertiaOptions = options || {};
48
- this.mousePan.enable();
49
- this.touchPan.enable();
50
- this.el.classList.add('l7-touch-drag-pan');
51
- }
52
-
53
- /**
54
- * Disables the "drag to pan" interaction.
55
- *
56
- * @example
57
- * map.dragPan.disable();
58
- */
59
- disable() {
60
- this.mousePan.disable();
61
- this.touchPan.disable();
62
- this.el.classList.remove('l7-touch-drag-pan');
63
- }
64
-
65
- /**
66
- * Returns a Boolean indicating whether the "drag to pan" interaction is enabled.
67
- *
68
- * @returns {boolean} `true` if the "drag to pan" interaction is enabled.
69
- */
70
- isEnabled() {
71
- return this.mousePan.isEnabled() && this.touchPan.isEnabled();
72
- }
73
-
74
- /**
75
- * Returns a Boolean indicating whether the "drag to pan" interaction is active, i.e. currently being used.
76
- *
77
- * @returns {boolean} `true` if the "drag to pan" interaction is active.
78
- */
79
- isActive() {
80
- return this.mousePan.isActive() || this.touchPan.isActive();
81
- }
82
- }
83
- exports.default = DragPanHandler;
@@ -1,72 +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 `DragRotateHandler` allows the user to rotate the map by clicking and
11
- * dragging the cursor while holding the right mouse button or `ctrl` key.
12
- */
13
- class DragRotateHandler {
14
- /**
15
- * @param {Object} [options]
16
- * @param {number} [options.bearingSnap] The threshold, measured in degrees, that determines when the map's
17
- * bearing will snap to north.
18
- * @param {bool} [options.pitchWithRotate=true] Control the map pitch in addition to the bearing
19
- * @private
20
- */
21
- constructor(options, mouseRotate, mousePitch) {
22
- (0, _defineProperty2.default)(this, "mouseRotate", void 0);
23
- (0, _defineProperty2.default)(this, "mousePitch", void 0);
24
- (0, _defineProperty2.default)(this, "pitchWithRotate", void 0);
25
- this.pitchWithRotate = options.pitchWithRotate;
26
- this.mouseRotate = mouseRotate;
27
- this.mousePitch = mousePitch;
28
- }
29
-
30
- /**
31
- * Enables the "drag to rotate" interaction.
32
- *
33
- * @example
34
- * map.dragRotate.enable();
35
- */
36
- enable() {
37
- this.mouseRotate.enable();
38
- if (this.pitchWithRotate) {
39
- this.mousePitch.enable();
40
- }
41
- }
42
-
43
- /**
44
- * Disables the "drag to rotate" interaction.
45
- *
46
- * @example
47
- * map.dragRotate.disable();
48
- */
49
- disable() {
50
- this.mouseRotate.disable();
51
- this.mousePitch.disable();
52
- }
53
-
54
- /**
55
- * Returns a Boolean indicating whether the "drag to rotate" interaction is enabled.
56
- *
57
- * @returns {boolean} `true` if the "drag to rotate" interaction is enabled.
58
- */
59
- isEnabled() {
60
- return this.mouseRotate.isEnabled() && (!this.pitchWithRotate || this.mousePitch.isEnabled());
61
- }
62
-
63
- /**
64
- * Returns a Boolean indicating whether the "drag to rotate" interaction is active, i.e. currently being used.
65
- *
66
- * @returns {boolean} `true` if the "drag to rotate" interaction is active.
67
- */
68
- isActive() {
69
- return this.mouseRotate.isActive() || this.mousePitch.isActive();
70
- }
71
- }
72
- exports.default = DragRotateHandler;
@@ -1,70 +0,0 @@
1
- import type TapDragZoomHandler from '../tap/tap_drag_zoom';
2
- import type { TouchRotateHandler, TouchZoomHandler } from '../touch';
3
- /**
4
- * The `TouchZoomRotateHandler` allows the user to zoom and rotate the map by
5
- * pinching on a touchscreen.
6
- *
7
- * They can zoom with one finger by double tapping and dragging. On the second tap,
8
- * hold the finger down and drag up or down to zoom in or out.
9
- */
10
- export default class TouchZoomRotateHandler {
11
- private el;
12
- private touchZoom;
13
- private touchRotate;
14
- private tapDragZoom;
15
- private rotationDisabled;
16
- private enabled;
17
- /**
18
- * @private
19
- */
20
- constructor(el: HTMLElement, touchZoom: TouchZoomHandler, touchRotate: TouchRotateHandler, tapDragZoom: TapDragZoomHandler);
21
- /**
22
- * Enables the "pinch to rotate and zoom" interaction.
23
- *
24
- * @param {Object} [options] Options object.
25
- * @param {string} [options.around] If "center" is passed, map will zoom around the center
26
- *
27
- * @example
28
- * map.touchZoomRotate.enable();
29
- * @example
30
- * map.touchZoomRotate.enable({ around: 'center' });
31
- */
32
- enable(options: {
33
- around?: 'center';
34
- }): void;
35
- /**
36
- * Disables the "pinch to rotate and zoom" interaction.
37
- *
38
- * @example
39
- * map.touchZoomRotate.disable();
40
- */
41
- disable(): void;
42
- /**
43
- * Returns a Boolean indicating whether the "pinch to rotate and zoom" interaction is enabled.
44
- *
45
- * @returns {boolean} `true` if the "pinch to rotate and zoom" interaction is enabled.
46
- */
47
- isEnabled(): boolean;
48
- /**
49
- * Returns true if the handler is enabled and has detected the start of a zoom/rotate gesture.
50
- *
51
- * @returns {boolean} //eslint-disable-line
52
- */
53
- isActive(): boolean;
54
- /**
55
- * Disables the "pinch to rotate" interaction, leaving the "pinch to zoom"
56
- * interaction enabled.
57
- *
58
- * @example
59
- * map.touchZoomRotate.disableRotation();
60
- */
61
- disableRotation(): void;
62
- /**
63
- * Enables the "pinch to rotate" interaction.
64
- *
65
- * @example
66
- * map.touchZoomRotate.enable();
67
- * map.touchZoomRotate.enableRotation();
68
- */
69
- enableRotation(): void;
70
- }