@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
package/lib/camera.js DELETED
@@ -1,648 +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 _l7Utils = require("@antv/l7-utils");
10
- var _eventemitter = require("eventemitter3");
11
- var _lng_lat = _interopRequireDefault(require("./geo/lng_lat"));
12
- var _lng_lat_bounds = _interopRequireDefault(require("./geo/lng_lat_bounds"));
13
- var _point = _interopRequireDefault(require("./geo/point"));
14
- var _transform = _interopRequireDefault(require("./geo/transform"));
15
- var _event = require("./handler/events/event");
16
- var _util = require("./util");
17
- // @ts-ignore
18
-
19
- const {
20
- merge
21
- } = _l7Utils.lodashUtil;
22
- class Camera extends _eventemitter.EventEmitter {
23
- constructor(options) {
24
- super();
25
- (0, _defineProperty2.default)(this, "transform", void 0);
26
- // public requestRenderFrame: (_: any) => number;
27
- // public cancelRenderFrame: (_: number) => void;
28
- (0, _defineProperty2.default)(this, "options", void 0);
29
- (0, _defineProperty2.default)(this, "moving", void 0);
30
- (0, _defineProperty2.default)(this, "zooming", void 0);
31
- (0, _defineProperty2.default)(this, "rotating", void 0);
32
- (0, _defineProperty2.default)(this, "pitching", void 0);
33
- (0, _defineProperty2.default)(this, "padding", void 0);
34
- (0, _defineProperty2.default)(this, "bearingSnap", void 0);
35
- (0, _defineProperty2.default)(this, "easeEndTimeoutID", void 0);
36
- (0, _defineProperty2.default)(this, "easeStart", void 0);
37
- (0, _defineProperty2.default)(this, "easeOptions", void 0);
38
- (0, _defineProperty2.default)(this, "easeId", void 0);
39
- (0, _defineProperty2.default)(this, "onEaseFrame", void 0);
40
- (0, _defineProperty2.default)(this, "onEaseEnd", void 0);
41
- (0, _defineProperty2.default)(this, "easeFrameId", void 0);
42
- (0, _defineProperty2.default)(this, "pitchEnabled", void 0);
43
- (0, _defineProperty2.default)(this, "rotateEnabled", void 0);
44
- (0, _defineProperty2.default)(this, "renderFrameCallback", () => {
45
- const t = Math.min(((0, _util.now)() - this.easeStart) / this.easeOptions.duration, 1);
46
- this.onEaseFrame(this.easeOptions.easing(t));
47
- if (t < 1) {
48
- // this.easeFrameId = window.requestAnimationFrame(this.renderFrameCallback);
49
- this.easeFrameId = this.requestRenderFrame(this.renderFrameCallback);
50
- } else {
51
- this.stop();
52
- }
53
- });
54
- this.options = options;
55
- const {
56
- minZoom,
57
- maxZoom,
58
- minPitch,
59
- maxPitch,
60
- renderWorldCopies
61
- } = options;
62
- this.moving = false;
63
- this.zooming = false;
64
- this.bearingSnap = options.bearingSnap;
65
- this.pitchEnabled = options.pitchEnabled;
66
- this.rotateEnabled = options.rotateEnabled;
67
- this.transform = new _transform.default(minZoom, maxZoom, minPitch, maxPitch, renderWorldCopies);
68
- }
69
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
70
- requestRenderFrame(cb) {
71
- return 0;
72
- }
73
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
74
- cancelRenderFrame(_) {
75
- return;
76
- }
77
- getCenter() {
78
- const {
79
- lng,
80
- lat
81
- } = this.transform.center;
82
- return new _lng_lat.default(lng, lat);
83
- }
84
- getZoom() {
85
- return this.transform.zoom;
86
- }
87
- getPitch() {
88
- return this.transform.pitch;
89
- }
90
- setCenter(center, eventData) {
91
- return this.jumpTo({
92
- center
93
- }, eventData);
94
- }
95
- setPitch(pitch, eventData) {
96
- this.jumpTo({
97
- pitch
98
- }, eventData);
99
- return this;
100
- }
101
- getBearing() {
102
- return this.transform.bearing;
103
- }
104
- panTo(lnglat, options, eventData) {
105
- return this.easeTo(merge({
106
- center: lnglat
107
- }, options), eventData);
108
- }
109
- panBy(offset, options, eventData) {
110
- offset = _point.default.convert(offset).mult(-1);
111
- return this.panTo(this.transform.center, (0, _util.extend)({
112
- offset
113
- }, options || {}), eventData);
114
- }
115
- zoomOut(options, eventData) {
116
- this.zoomTo(this.getZoom() - 1, options, eventData);
117
- return this;
118
- }
119
- setBearing(bearing, eventData) {
120
- this.jumpTo({
121
- bearing
122
- }, eventData);
123
- return this;
124
- }
125
- setZoom(zoom, eventData) {
126
- this.jumpTo({
127
- zoom
128
- }, eventData);
129
- return this;
130
- }
131
- zoomIn(options, eventData) {
132
- this.zoomTo(this.getZoom() + 1, options, eventData);
133
- return this;
134
- }
135
- zoomTo(zoom, options, eventData) {
136
- return this.easeTo(merge({
137
- zoom
138
- }, options), eventData);
139
- }
140
- getPadding() {
141
- return this.transform.padding;
142
- }
143
- setPadding(padding, eventData) {
144
- this.jumpTo({
145
- padding
146
- }, eventData);
147
- return this;
148
- }
149
- rotateTo(bearing, options, eventData) {
150
- return this.easeTo(merge({
151
- bearing
152
- }, options), eventData);
153
- }
154
- resetNorth(options, eventData) {
155
- this.rotateTo(0, merge({
156
- duration: 1000
157
- }, options), eventData);
158
- return this;
159
- }
160
- resetNorthPitch(options, eventData) {
161
- this.easeTo(merge({
162
- bearing: 0,
163
- pitch: 0,
164
- duration: 1000
165
- }, options), eventData);
166
- return this;
167
- }
168
- fitBounds(bounds, options, eventData) {
169
- return this.fitInternal(
170
- // @ts-ignore
171
- this.cameraForBounds(bounds, options), options, eventData);
172
- }
173
- cameraForBounds(bounds, options) {
174
- bounds = _lng_lat_bounds.default.convert(bounds);
175
- return this.cameraForBoxAndBearing(bounds.getNorthWest(), bounds.getSouthEast(), 0,
176
- // @ts-ignore
177
- options);
178
- }
179
- snapToNorth(options, eventData) {
180
- if (Math.abs(this.getBearing()) < this.bearingSnap) {
181
- return this.resetNorth(options, eventData);
182
- }
183
- return this;
184
- }
185
- jumpTo(options = {}, eventData) {
186
- this.stop();
187
- const tr = this.transform;
188
- let zoomChanged = false;
189
- let bearingChanged = false;
190
- let pitchChanged = false;
191
- if (options.zoom !== undefined && tr.zoom !== +options.zoom) {
192
- zoomChanged = true;
193
- tr.zoom = +options.zoom;
194
- }
195
- if (options.center !== undefined) {
196
- tr.center = _lng_lat.default.convert(options.center);
197
- }
198
- if (options.bearing !== undefined && tr.bearing !== +options.bearing) {
199
- bearingChanged = true;
200
- tr.bearing = +options.bearing;
201
- }
202
- if (options.pitch !== undefined && tr.pitch !== +options.pitch) {
203
- pitchChanged = true;
204
- tr.pitch = +options.pitch;
205
- }
206
- if (options.padding !== undefined && !tr.isPaddingEqual(options.padding)) {
207
- tr.padding = options.padding;
208
- }
209
- this.emit('movestart', new _event.Event('movestart', eventData));
210
- this.emit('move', new _event.Event('move', eventData));
211
- if (zoomChanged) {
212
- this.emit('zoomstart', new _event.Event('zoomstart', eventData));
213
- this.emit('zoom', new _event.Event('zoom', eventData));
214
- this.emit('zoomend', new _event.Event('zoomend', eventData));
215
- }
216
- if (bearingChanged) {
217
- this.emit('rotatestart', new _event.Event('rotatestart', eventData));
218
- this.emit('rotate', new _event.Event('rotate', eventData));
219
- this.emit('rotateend', new _event.Event('rotateend', eventData));
220
- }
221
- if (pitchChanged) {
222
- this.emit('pitchstart', new _event.Event('pitchstart', eventData));
223
- this.emit('pitch', new _event.Event('pitch', eventData));
224
- this.emit('pitchend', new _event.Event('pitchend', eventData));
225
- }
226
- return this.emit('moveend', new _event.Event('moveend', eventData));
227
- }
228
- easeTo(options = {}, eventData) {
229
- options = merge({
230
- offset: [0, 0],
231
- duration: 500,
232
- easing: _util.ease
233
- }, options);
234
- if (options.animate === false || !options.essential && (0, _util.prefersReducedMotion)()) {
235
- options.duration = 0;
236
- }
237
- const tr = this.transform;
238
- const startZoom = this.getZoom();
239
- const startBearing = this.getBearing();
240
- const startPitch = this.getPitch();
241
- const startPadding = this.getPadding();
242
- const zoom = options.zoom ? +options.zoom : startZoom;
243
- const bearing = options.bearing ? this.normalizeBearing(options.bearing, startBearing) : startBearing;
244
- const pitch = options.pitch ? +options.pitch : startPitch;
245
- const padding = options.padding ? options.padding : tr.padding;
246
- const offsetAsPoint = _point.default.convert(options.offset);
247
- let pointAtOffset = tr.centerPoint.add(offsetAsPoint);
248
- const locationAtOffset = tr.pointLocation(pointAtOffset);
249
- const center = _lng_lat.default.convert(options.center || locationAtOffset);
250
- this.normalizeCenter(center);
251
- const from = tr.project(locationAtOffset);
252
- const delta = tr.project(center).sub(from);
253
- const finalScale = tr.zoomScale(zoom - startZoom);
254
- let around;
255
- let aroundPoint;
256
- if (options.around) {
257
- around = _lng_lat.default.convert(options.around);
258
- aroundPoint = tr.locationPoint(around);
259
- }
260
- const currently = {
261
- moving: this.moving,
262
- zooming: this.zooming,
263
- rotating: this.rotating,
264
- pitching: this.pitching
265
- };
266
- this.zooming = this.zooming || zoom !== startZoom;
267
- this.rotating = this.rotating || startBearing !== bearing;
268
- this.pitching = this.pitching || pitch !== startPitch;
269
- this.padding = !tr.isPaddingEqual(padding);
270
- this.easeId = options.easeId;
271
- this.prepareEase(eventData, options.noMoveStart, currently);
272
- clearTimeout(this.easeEndTimeoutID);
273
- this.ease(k => {
274
- if (this.zooming) {
275
- tr.zoom = (0, _util.interpolate)(startZoom, zoom, k);
276
- }
277
- if (this.rotating && this.rotateEnabled) {
278
- tr.bearing = (0, _util.interpolate)(startBearing, bearing, k);
279
- }
280
- if (this.pitching && this.pitchEnabled) {
281
- tr.pitch = (0, _util.interpolate)(startPitch, pitch, k);
282
- }
283
- if (this.padding) {
284
- tr.interpolatePadding(startPadding, padding, k);
285
- // When padding is being applied, Transform#centerPoint is changing continously,
286
- // thus we need to recalculate offsetPoint every fra,e
287
- pointAtOffset = tr.centerPoint.add(offsetAsPoint);
288
- }
289
- if (around) {
290
- tr.setLocationAtPoint(around, aroundPoint);
291
- } else {
292
- const scale = tr.zoomScale(tr.zoom - startZoom);
293
- const base = zoom > startZoom ? Math.min(2, finalScale) : Math.max(0.5, finalScale);
294
- const speedup = Math.pow(base, 1 - k);
295
- const newCenter = tr.unproject(from.add(delta.mult(k * speedup)).mult(scale));
296
- tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);
297
- }
298
- this.fireMoveEvents(eventData);
299
- }, interruptingEaseId => {
300
- this.afterEase(eventData, interruptingEaseId);
301
- },
302
- // @ts-ignore
303
- options);
304
- return this;
305
- }
306
- flyTo(options = {}, eventData) {
307
- // Fall through to jumpTo if user has set prefers-reduced-motion
308
- if (!options.essential && (0, _util.prefersReducedMotion)()) {
309
- const coercedOptions = (0, _util.pick)(options, ['center', 'zoom', 'bearing', 'pitch', 'around']);
310
- return this.jumpTo(coercedOptions, eventData);
311
- }
312
- this.stop();
313
- options = merge({
314
- offset: [0, 0],
315
- speed: 1.2,
316
- curve: 1.42,
317
- easing: _util.ease
318
- }, options);
319
- const tr = this.transform;
320
- const startZoom = this.getZoom();
321
- const startBearing = this.getBearing();
322
- const startPitch = this.getPitch();
323
- const startPadding = this.getPadding();
324
- const zoom = options.zoom ? (0, _util.clamp)(+options.zoom, tr.minZoom, tr.maxZoom) : startZoom;
325
- const bearing = options.bearing ? this.normalizeBearing(options.bearing, startBearing) : startBearing;
326
- const pitch = options.pitch ? +options.pitch : startPitch;
327
- const padding = 'padding' in options ? options.padding : tr.padding;
328
- const scale = tr.zoomScale(zoom - startZoom);
329
- const offsetAsPoint = _point.default.convert(options.offset);
330
- let pointAtOffset = tr.centerPoint.add(offsetAsPoint);
331
- const locationAtOffset = tr.pointLocation(pointAtOffset);
332
- const center = _lng_lat.default.convert(options.center || locationAtOffset);
333
- this.normalizeCenter(center);
334
- const from = tr.project(locationAtOffset);
335
- const delta = tr.project(center).sub(from);
336
- let rho = options.curve;
337
-
338
- // w₀: Initial visible span, measured in pixels at the initial scale.
339
- const w0 = Math.max(tr.width, tr.height);
340
- // w₁: Final visible span, measured in pixels with respect to the initial scale.
341
- const w1 = w0 / scale;
342
- // Length of the flight path as projected onto the ground plane, measured in pixels from
343
- // the world image origin at the initial scale.
344
- const u1 = delta.mag();
345
- if ('minZoom' in options) {
346
- const minZoom = (0, _util.clamp)(Math.min(options.minZoom, startZoom, zoom), tr.minZoom, tr.maxZoom);
347
- // w<sub>m</sub>: Maximum visible span, measured in pixels with respect to the initial
348
- // scale.
349
- const wMax = w0 / tr.zoomScale(minZoom - startZoom);
350
- rho = Math.sqrt(wMax / u1 * 2);
351
- }
352
-
353
- // ρ²
354
- const rho2 = rho * rho;
355
-
356
- /**
357
- * rᵢ: Returns the zoom-out factor at one end of the animation.
358
- *
359
- * @param i 0 for the ascent or 1 for the descent.
360
- * @private
361
- */
362
- function r(i) {
363
- const b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1);
364
- return Math.log(Math.sqrt(b * b + 1) - b);
365
- }
366
- function sinh(n) {
367
- return (Math.exp(n) - Math.exp(-n)) / 2;
368
- }
369
- function cosh(n) {
370
- return (Math.exp(n) + Math.exp(-n)) / 2;
371
- }
372
- function tanh(n) {
373
- return sinh(n) / cosh(n);
374
- }
375
-
376
- // r₀: Zoom-out factor during ascent.
377
- const r0 = r(0);
378
-
379
- // w(s): Returns the visible span on the ground, measured in pixels with respect to the
380
- // initial scale. Assumes an angular field of view of 2 arctan ½ ≈ 53°.
381
- let w = s => {
382
- return cosh(r0) / cosh(r0 + rho * s);
383
- };
384
-
385
- // u(s): Returns the distance along the flight path as projected onto the ground plane,
386
- // measured in pixels from the world image origin at the initial scale.
387
- let u = s => {
388
- return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1;
389
- };
390
-
391
- // S: Total length of the flight path, measured in ρ-screenfuls.
392
- let S = (r(1) - r0) / rho;
393
-
394
- // When u₀ = u₁, the optimal path doesn’t require both ascent and descent.
395
- if (Math.abs(u1) < 0.000001 || !isFinite(S)) {
396
- // Perform a more or less instantaneous transition if the path is too short.
397
- if (Math.abs(w0 - w1) < 0.000001) {
398
- return this.easeTo(options, eventData);
399
- }
400
- const k = w1 < w0 ? -1 : 1;
401
- S = Math.abs(Math.log(w1 / w0)) / rho;
402
- u = () => {
403
- return 0;
404
- };
405
- w = s => {
406
- return Math.exp(k * rho * s);
407
- };
408
- }
409
- if ('duration' in options) {
410
- options.duration = +options.duration;
411
- } else {
412
- const V = 'screenSpeed' in options ? +options.screenSpeed / rho : +options.speed;
413
- options.duration = 1000 * S / V;
414
- }
415
- if (options.maxDuration && options.duration > options.maxDuration) {
416
- options.duration = 0;
417
- }
418
- this.zooming = true;
419
- this.rotating = startBearing !== bearing;
420
- this.pitching = pitch !== startPitch;
421
- this.padding = !tr.isPaddingEqual(padding);
422
- this.prepareEase(eventData, false);
423
- this.ease(k => {
424
- // s: The distance traveled along the flight path, measured in ρ-screenfuls.
425
- const s = k * S;
426
- // @ts-ignore
427
- const easeScale = 1 / w(s);
428
- tr.zoom = k === 1 ? zoom : startZoom + tr.scaleZoom(easeScale);
429
- if (this.rotating) {
430
- tr.bearing = (0, _util.interpolate)(startBearing, bearing, k);
431
- }
432
- if (this.pitching) {
433
- tr.pitch = (0, _util.interpolate)(startPitch, pitch, k);
434
- }
435
- if (this.padding) {
436
- tr.interpolatePadding(startPadding, padding, k);
437
- // When padding is being applied, Transform#centerPoint is changing continously,
438
- // thus we need to recalculate offsetPoint every frame
439
- pointAtOffset = tr.centerPoint.add(offsetAsPoint);
440
- }
441
- const newCenter = k === 1 ? center : tr.unproject(from.add(delta.mult(u(s))).mult(easeScale));
442
- tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);
443
- this.fireMoveEvents(eventData);
444
- }, () => this.afterEase(eventData), options);
445
- return this;
446
- }
447
- fitScreenCoordinates(p0, p1, bearing, options, eventData) {
448
- return this.fitInternal(
449
- // @ts-ignore
450
- this.cameraForBoxAndBearing(this.transform.pointLocation(_point.default.convert(p0)), this.transform.pointLocation(_point.default.convert(p1)), bearing,
451
- // @ts-ignore
452
- options), options, eventData);
453
- }
454
- stop(allowGestures, easeId) {
455
- if (this.easeFrameId) {
456
- this.cancelRenderFrame(this.easeFrameId);
457
- // @ts-ignore
458
- delete this.easeFrameId;
459
- // @ts-ignore
460
- delete this.onEaseFrame;
461
- }
462
- if (this.onEaseEnd) {
463
- // The _onEaseEnd function might emit events which trigger new
464
- // animation, which sets a new _onEaseEnd. Ensure we don't delete
465
- // it unintentionally.
466
- const onEaseEnd = this.onEaseEnd;
467
- // @ts-ignore
468
- delete this.onEaseEnd;
469
- onEaseEnd.call(this, easeId);
470
- }
471
- // if (!allowGestures) {
472
- // const handlers = (this: any).handlers;
473
- // if (handlers) handlers.stop();
474
- // }
475
- return this;
476
- }
477
- normalizeBearing(bearing, currentBearing) {
478
- bearing = (0, _util.wrap)(bearing, -180, 180);
479
- const diff = Math.abs(bearing - currentBearing);
480
- if (Math.abs(bearing - 360 - currentBearing) < diff) {
481
- bearing -= 360;
482
- }
483
- if (Math.abs(bearing + 360 - currentBearing) < diff) {
484
- bearing += 360;
485
- }
486
- return bearing;
487
- }
488
- normalizeCenter(center) {
489
- const tr = this.transform;
490
- if (!tr.renderWorldCopies || tr.lngRange) {
491
- return;
492
- }
493
- const delta = center.lng - tr.center.lng;
494
- center.lng += delta > 180 ? -360 : delta < -180 ? 360 : 0;
495
- }
496
- fireMoveEvents(eventData) {
497
- this.emit('move', new _event.Event('move', eventData));
498
- if (this.zooming) {
499
- this.emit('zoom', new _event.Event('zoom', eventData));
500
- }
501
- if (this.rotating) {
502
- this.emit('rotate', new _event.Event('rotate', eventData));
503
- }
504
- if (this.pitching) {
505
- this.emit('rotate', new _event.Event('pitch', eventData));
506
- }
507
- }
508
- prepareEase(eventData, noMoveStart = false, currently = {}) {
509
- this.moving = true;
510
- if (!noMoveStart && !currently.moving) {
511
- this.emit('movestart', new _event.Event('movestart', eventData));
512
- }
513
- if (this.zooming && !currently.zooming) {
514
- this.emit('zoomstart', new _event.Event('zoomstart', eventData));
515
- }
516
- if (this.rotating && !currently.rotating) {
517
- this.emit('rotatestart', new _event.Event('rotatestart', eventData));
518
- }
519
- if (this.pitching && !currently.pitching) {
520
- this.emit('pitchstart', new _event.Event('pitchstart', eventData));
521
- }
522
- }
523
- afterEase(eventData, easeId) {
524
- // if this easing is being stopped to start another easing with
525
- // the same id then don't fire any events to avoid extra start/stop events
526
- if (this.easeId && easeId && this.easeId === easeId) {
527
- return;
528
- }
529
- // @ts-ignore
530
- delete this.easeId;
531
- const wasZooming = this.zooming;
532
- const wasRotating = this.rotating;
533
- const wasPitching = this.pitching;
534
- this.moving = false;
535
- this.zooming = false;
536
- this.rotating = false;
537
- this.pitching = false;
538
- this.padding = false;
539
- if (wasZooming) {
540
- this.emit('zoomend', new _event.Event('zoomend', eventData));
541
- }
542
- if (wasRotating) {
543
- this.emit('rotateend', new _event.Event('rotateend', eventData));
544
- }
545
- if (wasPitching) {
546
- this.emit('pitchend', new _event.Event('pitchend', eventData));
547
- }
548
- this.emit('moveend', new _event.Event('moveend', eventData));
549
- }
550
- ease(frame, finish, options) {
551
- if (options.animate === false || options.duration === 0) {
552
- frame(1);
553
- finish();
554
- } else {
555
- this.easeStart = (0, _util.now)();
556
- this.easeOptions = options;
557
- this.onEaseFrame = frame;
558
- this.onEaseEnd = finish;
559
- this.easeFrameId = this.requestRenderFrame(this.renderFrameCallback);
560
- }
561
- }
562
- cameraForBoxAndBearing(p0, p1, bearing, options) {
563
- const defaultPadding = {
564
- top: 0,
565
- bottom: 0,
566
- right: 0,
567
- left: 0
568
- };
569
- options = merge({
570
- padding: defaultPadding,
571
- offset: [0, 0],
572
- maxZoom: this.transform.maxZoom
573
- }, options);
574
- if (typeof options.padding === 'number') {
575
- const p = options.padding;
576
- options.padding = {
577
- top: p,
578
- bottom: p,
579
- right: p,
580
- left: p
581
- };
582
- }
583
- options.padding = merge(defaultPadding, options.padding);
584
- const tr = this.transform;
585
- const edgePadding = tr.padding;
586
-
587
- // We want to calculate the upper right and lower left of the box defined by p0 and p1
588
- // in a coordinate system rotate to match the destination bearing.
589
- const p0world = tr.project(_lng_lat.default.convert(p0));
590
- const p1world = tr.project(_lng_lat.default.convert(p1));
591
- const p0rotated = p0world.rotate(-bearing * Math.PI / 180);
592
- const p1rotated = p1world.rotate(-bearing * Math.PI / 180);
593
- const upperRight = new _point.default(Math.max(p0rotated.x, p1rotated.x), Math.max(p0rotated.y, p1rotated.y));
594
- const lowerLeft = new _point.default(Math.min(p0rotated.x, p1rotated.x), Math.min(p0rotated.y, p1rotated.y));
595
-
596
- // Calculate zoom: consider the original bbox and padding.
597
- const size = upperRight.sub(lowerLeft);
598
- const scaleX = (tr.width - (
599
- // @ts-ignore
600
- edgePadding.left +
601
- // @ts-ignore
602
- edgePadding.right +
603
- // @ts-ignore
604
- options.padding.left +
605
- // @ts-ignore
606
- options.padding.right)) / size.x;
607
- const scaleY = (tr.height - (
608
- // @ts-ignore
609
- edgePadding.top +
610
- // @ts-ignore
611
- edgePadding.bottom +
612
- // @ts-ignore
613
- options.padding.top +
614
- // @ts-ignore
615
- options.padding.bottom)) / size.y;
616
- if (scaleY < 0 || scaleX < 0) {
617
- return;
618
- }
619
- const zoom = Math.min(tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY)), options.maxZoom);
620
-
621
- // Calculate center: apply the zoom, the configured offset, as well as offset that exists as a result of padding.
622
- const offset = _point.default.convert(options.offset);
623
- // @ts-ignore
624
- const paddingOffsetX = (options.padding.left - options.padding.right) / 2;
625
- // @ts-ignore
626
- const paddingOffsetY = (options.padding.top - options.padding.bottom) / 2;
627
- const offsetAtInitialZoom = new _point.default(offset.x + paddingOffsetX, offset.y + paddingOffsetY);
628
- const offsetAtFinalZoom = offsetAtInitialZoom.mult(tr.scale / tr.zoomScale(zoom));
629
- const center = tr.unproject(p0world.add(p1world).div(2).sub(offsetAtFinalZoom));
630
- return {
631
- center,
632
- zoom,
633
- bearing
634
- };
635
- }
636
- fitInternal(calculatedOptions, options, eventData) {
637
- // cameraForBounds warns + returns undefined if unable to fit:
638
- if (!calculatedOptions) {
639
- return this;
640
- }
641
- options = merge(calculatedOptions, options);
642
- // Explictly remove the padding field because, calculatedOptions already accounts for padding by setting zoom and center accordingly.
643
- delete options.padding;
644
- // @ts-ignore
645
- return options.linear ? this.easeTo(options, eventData) : this.flyTo(options, eventData);
646
- }
647
- }
648
- exports.default = Camera;