@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
package/es/earthmap.js DELETED
@@ -1,445 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { DOM, lodashUtil } from '@antv/l7-utils';
3
- import Camera from "./camera";
4
- function loadStyles(css, doc) {
5
- var isMiniAli = typeof my !== 'undefined' && !!my && typeof my.showToast === 'function' && my.isFRM !== true;
6
- var isWeChatMiniProgram = typeof wx !== 'undefined' && wx !== null && (typeof wx.request !== 'undefined' || typeof wx.miniProgram !== 'undefined');
7
- if (isMiniAli || isWeChatMiniProgram) {
8
- return;
9
- }
10
- if (!doc) doc = document;
11
- if (!doc) {
12
- return;
13
- }
14
- var head = doc.head || doc.getElementsByTagName('head')[0];
15
- if (!head) {
16
- head = doc.createElement('head');
17
- var body = doc.body || doc.getElementsByTagName('body')[0];
18
- if (body) {
19
- body.parentNode.insertBefore(head, body);
20
- } else {
21
- doc.documentElement.appendChild(head);
22
- }
23
- }
24
- var style = doc.createElement('style');
25
- style.type = 'text/css';
26
- if (style.styleSheet) {
27
- style.styleSheet.cssText = css;
28
- } else {
29
- style.appendChild(doc.createTextNode(css));
30
- }
31
- head.appendChild(style);
32
- return style;
33
- }
34
- loadStyles(`.l7-map {
35
- font:
36
- 12px/20px 'Helvetica Neue',
37
- Arial,
38
- Helvetica,
39
- sans-serif;
40
- overflow: hidden;
41
- position: relative;
42
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
43
- }
44
-
45
- .l7-canvas {
46
- position: absolute;
47
- left: 0;
48
- top: 0;
49
- }
50
-
51
- .l7-map:-webkit-full-screen {
52
- width: 100%;
53
- height: 100%;
54
- }
55
-
56
- .l7-canary {
57
- background-color: salmon;
58
- }
59
-
60
- .l7-canvas-container.l7-interactive,
61
- .l7-ctrl-group button.l7-ctrl-compass {
62
- cursor: grab;
63
- -moz-user-select: none;
64
- -webkit-user-select: none;
65
- -ms-user-select: none;
66
- user-select: none;
67
- }
68
-
69
- .l7-canvas-container.l7-interactive.l7-track-pointer {
70
- cursor: pointer;
71
- }
72
-
73
- .l7-canvas-container.l7-interactive:active,
74
- .l7-ctrl-group button.l7-ctrl-compass:active {
75
- cursor: grabbing;
76
- }
77
-
78
- .l7-canvas-container.l7-touch-zoom-rotate,
79
- .l7-canvas-container.l7-touch-zoom-rotate .l7-canvas {
80
- touch-action: pan-x pan-y;
81
- }
82
-
83
- .l7-canvas-container.l7-touch-drag-pan,
84
- .l7-canvas-container.l7-touch-drag-pan .l7-canvas {
85
- touch-action: pinch-zoom;
86
- }
87
-
88
- .l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan,
89
- .l7-canvas-container.l7-touch-zoom-rotate.l7-touch-drag-pan .l7-canvas {
90
- touch-action: none;
91
- }
92
-
93
- .l7-ctrl-top-left,
94
- .l7-ctrl-top-right,
95
- .l7-ctrl-bottom-left,
96
- .l7-ctrl-bottom-right {
97
- position: absolute;
98
- pointer-events: none;
99
- z-index: 2;
100
- }
101
- .l7-ctrl-top-left {
102
- top: 0;
103
- left: 0;
104
- }
105
- .l7-ctrl-top-right {
106
- top: 0;
107
- right: 0;
108
- }
109
- .l7-ctrl-bottom-left {
110
- bottom: 0;
111
- left: 0;
112
- }
113
- .l7-ctrl-bottom-right {
114
- right: 0;
115
- bottom: 0;
116
- }
117
-
118
- .l7-ctrl {
119
- clear: both;
120
- pointer-events: auto;
121
-
122
- /* workaround for a Safari bug https://github.com/mapbox/mapbox-gl-js/issues/8185 */
123
- -webkit-transform: translate(0, 0);
124
- transform: translate(0, 0);
125
- }
126
- .l7-ctrl-top-left .l7-ctrl {
127
- margin: 10px 0 0 10px;
128
- float: left;
129
- }
130
- .l7-ctrl-top-right .l7-ctrl {
131
- margin: 10px 10px 0 0;
132
- float: right;
133
- }
134
- .l7-ctrl-bottom-left .l7-ctrl {
135
- margin: 0 0 10px 10px;
136
- float: left;
137
- }
138
- .l7-ctrl-bottom-right .l7-ctrl {
139
- margin: 0 10px 10px 0;
140
- float: right;
141
- }
142
-
143
- .l7-crosshair,
144
- .l7-crosshair .l7-interactive,
145
- .l7-crosshair .l7-interactive:active {
146
- cursor: crosshair;
147
- }
148
-
149
- .l7-boxzoom {
150
- position: absolute;
151
- top: 0;
152
- left: 0;
153
- width: 0;
154
- height: 0;
155
- background: #fff;
156
- border: 2px dotted #202020;
157
- opacity: 0.5;
158
- z-index: 10;
159
- }
160
- `);
161
- import LngLat from "./geo/lng_lat";
162
- import LngLatBounds from "./geo/lng_lat_bounds";
163
- // @ts-ignore
164
-
165
- import Point from "./geo/point";
166
- import HandlerManager from "./handler/handler_manager";
167
- import { renderframe } from "./util";
168
- import { PerformanceUtils } from "./utils/performance";
169
- import TaskQueue from "./utils/task_queue";
170
- const defaultMinZoom = -2;
171
- const defaultMaxZoom = 22;
172
- const {
173
- merge
174
- } = lodashUtil;
175
- // the default values, but also the valid range
176
- const defaultMinPitch = 0;
177
- const defaultMaxPitch = 60;
178
- const DefaultOptions = {
179
- hash: false,
180
- zoom: -1,
181
- center: [112, 32],
182
- pitch: 0,
183
- bearing: 0,
184
- interactive: true,
185
- minZoom: defaultMinZoom,
186
- maxZoom: defaultMaxZoom,
187
- minPitch: defaultMinPitch,
188
- maxPitch: defaultMaxPitch,
189
- scrollZoom: true,
190
- boxZoom: true,
191
- dragRotate: true,
192
- dragPan: true,
193
- keyboard: true,
194
- doubleClickZoom: true,
195
- touchZoomRotate: true,
196
- touchPitch: true,
197
- bearingSnap: 7,
198
- clickTolerance: 3,
199
- pitchWithRotate: true,
200
- trackResize: true,
201
- renderWorldCopies: true,
202
- pitchEnabled: true,
203
- rotateEnabled: true
204
- };
205
- export class EarthMap extends Camera {
206
- constructor(options) {
207
- super(merge({}, DefaultOptions, options));
208
- _defineProperty(this, "doubleClickZoom", void 0);
209
- _defineProperty(this, "dragRotate", void 0);
210
- _defineProperty(this, "dragPan", void 0);
211
- _defineProperty(this, "touchZoomRotate", void 0);
212
- _defineProperty(this, "scrollZoom", void 0);
213
- _defineProperty(this, "keyboard", void 0);
214
- _defineProperty(this, "touchPitch", void 0);
215
- _defineProperty(this, "boxZoom", void 0);
216
- _defineProperty(this, "handlers", void 0);
217
- _defineProperty(this, "container", void 0);
218
- _defineProperty(this, "canvas", void 0);
219
- _defineProperty(this, "canvasContainer", void 0);
220
- _defineProperty(this, "renderTaskQueue", new TaskQueue());
221
- _defineProperty(this, "frame", void 0);
222
- _defineProperty(this, "trackResize", true);
223
- _defineProperty(this, "onWindowOnline", () => {
224
- this.update();
225
- });
226
- _defineProperty(this, "onWindowResize", event => {
227
- if (this.trackResize) {
228
- this.resize({
229
- originalEvent: event
230
- }).update();
231
- }
232
- });
233
- this.initContainer();
234
- this.resize();
235
- this.handlers = new HandlerManager(this, this.options);
236
- if (typeof window !== 'undefined') {
237
- window.addEventListener('online', this.onWindowOnline, false);
238
- window.addEventListener('resize', this.onWindowResize, false);
239
- window.addEventListener('orientationchange', this.onWindowResize, false);
240
- }
241
- }
242
- resize(eventData) {
243
- const dimensions = this.containerDimensions();
244
- const width = dimensions[0];
245
- const height = dimensions[1];
246
-
247
- // this.resizeCanvas(width, height);
248
- this.transform.resize(width, height);
249
- const fireMoving = !this.moving;
250
- if (fireMoving) {
251
- this.stop();
252
- this.emit('movestart', new Event('movestart', eventData));
253
- this.emit('move', new Event('move', eventData));
254
- }
255
- this.emit('resize', new Event('resize', eventData));
256
- if (fireMoving) {
257
- this.emit('moveend', new Event('moveend', eventData));
258
- }
259
- return this;
260
- }
261
- getContainer() {
262
- return this.container;
263
- }
264
- getCanvas() {
265
- return this.canvas;
266
- }
267
- getCanvasContainer() {
268
- return this.canvasContainer;
269
- }
270
- project(lngLat) {
271
- return this.transform.locationPoint(LngLat.convert(lngLat));
272
- }
273
- unproject(point) {
274
- return this.transform.pointLocation(Point.convert(point));
275
- }
276
- getBounds() {
277
- return this.transform.getBounds();
278
- }
279
- getMaxBounds() {
280
- return this.transform.getMaxBounds();
281
- }
282
- setMaxBounds(bounds) {
283
- this.transform.setMaxBounds(LngLatBounds.convert(bounds));
284
- }
285
-
286
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
287
- setStyle(style) {
288
- return;
289
- }
290
- setMinZoom(minZoom) {
291
- minZoom = minZoom === null || minZoom === undefined ? defaultMinZoom : minZoom;
292
- if (minZoom >= defaultMinZoom && minZoom <= this.transform.maxZoom) {
293
- this.transform.minZoom = minZoom;
294
- if (this.getZoom() < minZoom) {
295
- this.setZoom(minZoom);
296
- }
297
- return this;
298
- } else {
299
- throw new Error(`minZoom must be between ${defaultMinZoom} and the current maxZoom, inclusive`);
300
- }
301
- }
302
- getMinZoom() {
303
- return this.transform.minZoom;
304
- }
305
- setMaxZoom(maxZoom) {
306
- maxZoom = maxZoom === null || maxZoom === undefined ? defaultMaxZoom : maxZoom;
307
- if (maxZoom >= this.transform.minZoom) {
308
- this.transform.maxZoom = maxZoom;
309
- if (this.getZoom() > maxZoom) {
310
- this.setZoom(maxZoom);
311
- }
312
- return this;
313
- } else {
314
- throw new Error('maxZoom must be greater than the current minZoom');
315
- }
316
- }
317
- getMaxZoom() {
318
- return this.transform.maxZoom;
319
- }
320
- setMinPitch(minPitch) {
321
- minPitch = minPitch === null || minPitch === undefined ? defaultMinPitch : minPitch;
322
- if (minPitch < defaultMinPitch) {
323
- throw new Error(`minPitch must be greater than or equal to ${defaultMinPitch}`);
324
- }
325
- if (minPitch >= defaultMinPitch && minPitch <= this.transform.maxPitch) {
326
- this.transform.minPitch = minPitch;
327
- if (this.getPitch() < minPitch) {
328
- this.setPitch(minPitch);
329
- }
330
- return this;
331
- } else {
332
- throw new Error(`minPitch must be between ${defaultMinPitch} and the current maxPitch, inclusive`);
333
- }
334
- }
335
- getMinPitch() {
336
- return this.transform.minPitch;
337
- }
338
- setMaxPitch(maxPitch) {
339
- maxPitch = maxPitch === null || maxPitch === undefined ? defaultMaxPitch : maxPitch;
340
- if (maxPitch > defaultMaxPitch) {
341
- throw new Error(`maxPitch must be less than or equal to ${defaultMaxPitch}`);
342
- }
343
- if (maxPitch >= this.transform.minPitch) {
344
- this.transform.maxPitch = maxPitch;
345
- if (this.getPitch() > maxPitch) {
346
- this.setPitch(maxPitch);
347
- }
348
- return this;
349
- } else {
350
- throw new Error('maxPitch must be greater than the current minPitch');
351
- }
352
- }
353
- getMaxPitch() {
354
- return this.transform.maxPitch;
355
- }
356
- getRenderWorldCopies() {
357
- return this.transform.renderWorldCopies;
358
- }
359
- setRenderWorldCopies(renderWorldCopies) {
360
- this.transform.renderWorldCopies = !!renderWorldCopies;
361
- }
362
- remove() {
363
- if (this.frame) {
364
- this.frame.cancel();
365
- this.frame = null;
366
- }
367
- this.renderTaskQueue.clear();
368
- //销毁事件
369
- this.handlers.destroy();
370
- if (typeof window !== 'undefined') {
371
- window.removeEventListener('online', this.onWindowOnline, false);
372
- window.removeEventListener('resize', this.onWindowResize, false);
373
- window.removeEventListener('orientationchange', this.onWindowResize, false);
374
- }
375
- }
376
- requestRenderFrame(cb) {
377
- this.update();
378
- return this.renderTaskQueue.add(cb);
379
- }
380
- cancelRenderFrame(id) {
381
- return this.renderTaskQueue.remove(id);
382
- }
383
- triggerRepaint() {
384
- if (!this.frame) {
385
- this.frame = renderframe(paintStartTimeStamp => {
386
- PerformanceUtils.frame(paintStartTimeStamp);
387
- this.frame = null;
388
- this.update(paintStartTimeStamp);
389
- });
390
- }
391
- }
392
- update(time) {
393
- if (!this.frame) {
394
- this.frame = renderframe(paintStartTimeStamp => {
395
- PerformanceUtils.frame(paintStartTimeStamp);
396
- this.frame = null;
397
- this.renderTaskQueue.run(time);
398
- });
399
- }
400
- }
401
- initContainer() {
402
- if (typeof this.options.container === 'string') {
403
- this.container = window.document.getElementById(this.options.container);
404
- if (!this.container) {
405
- throw new Error(`Container '${this.options.container}' not found.`);
406
- }
407
- } else if (this.options.container instanceof HTMLElement) {
408
- this.container = this.options.container;
409
- } else {
410
- throw new Error("Invalid type: 'container' must be a String or HTMLElement.");
411
- }
412
- const container = this.container;
413
- container.classList.add('l7-map');
414
- const canvasContainer = this.canvasContainer = DOM.create('div', 'l7-canvas-container', container);
415
- if (this.options.interactive) {
416
- canvasContainer.classList.add('l7-interactive');
417
- }
418
-
419
- // this.canvas = DOM.create(
420
- // 'canvas',
421
- // 'l7-canvas',
422
- // canvasContainer,
423
- // ) as HTMLCanvasElement;
424
- // this.canvas.setAttribute('tabindex', '-');
425
- // this.canvas.setAttribute('aria-label', 'Map');
426
- }
427
- containerDimensions() {
428
- let width = 0;
429
- let height = 0;
430
- if (this.container) {
431
- width = this.container.clientWidth || 400;
432
- height = this.container.clientHeight || 300;
433
- }
434
- return [width, height];
435
- }
436
- resizeCanvas(width, height) {
437
- const pixelRatio = DOM.DPR || 1;
438
- this.canvas.width = pixelRatio * width;
439
- this.canvas.height = pixelRatio * height;
440
-
441
- // Maintain the same canvas size, potentially downscaling it for HiDPI displays
442
- this.canvas.style.width = `${width}px`;
443
- this.canvas.style.height = `${height}px`;
444
- }
445
- }
@@ -1,54 +0,0 @@
1
- import Point from './point';
2
- /**
3
- * An `EdgeInset` object represents screen space padding applied to the edges of the viewport.
4
- * This shifts the apprent center or the vanishing point of the map. This is useful for adding floating UI elements
5
- * on top of the map and having the vanishing point shift as UI elements resize.
6
- *
7
- * @param {number} [top=0]
8
- * @param {number} [bottom=0]
9
- * @param {number} [left=0]
10
- * @param {number} [right=0]
11
- */
12
- export default class EdgeInsets {
13
- top: number;
14
- bottom: number;
15
- left: number;
16
- right: number;
17
- constructor(top?: number, bottom?: number, left?: number, right?: number);
18
- /**
19
- * Interpolates the inset in-place.
20
- * This maintains the current inset value for any inset not present in `target`.
21
- *
22
- * @param {PaddingOptions} target
23
- * @param {number} t
24
- * @returns {EdgeInsets}
25
- * @memberof EdgeInsets
26
- */
27
- interpolate(start: IPaddingOptions | EdgeInsets, target: IPaddingOptions, t: number): EdgeInsets;
28
- /**
29
- * Utility method that computes the new apprent center or vanishing point after applying insets.
30
- * This is in pixels and with the top left being (0.0) and +y being downwards.
31
- *
32
- * @param {number} width
33
- * @param {number} height
34
- * @returns {Point}
35
- * @memberof EdgeInsets
36
- */
37
- getCenter(width: number, height: number): Point;
38
- equals(other: IPaddingOptions): boolean;
39
- clone(): EdgeInsets;
40
- /**
41
- * Returns the current sdtate as json, useful when you want to have a
42
- * read-only representation of the inset.
43
- *
44
- * @returns {PaddingOptions}
45
- * @memberof EdgeInsets
46
- */
47
- toJSON(): IPaddingOptions;
48
- }
49
- export interface IPaddingOptions {
50
- top?: number;
51
- bottom?: number;
52
- right?: number;
53
- left?: number;
54
- }
@@ -1,18 +0,0 @@
1
- export declare const earthRadius = 6371008.8;
2
- export type LngLatLike = LngLat | {
3
- lng: number;
4
- lat: number;
5
- } | {
6
- lon: number;
7
- lat: number;
8
- } | [number, number];
9
- export default class LngLat {
10
- static convert(input: LngLatLike): LngLat;
11
- lng: number;
12
- lat: number;
13
- constructor(lng: number, lat: number);
14
- wrap(): LngLat;
15
- toArray(): [number, number];
16
- toString(): string;
17
- distanceTo(lngLat: LngLat): number;
18
- }
package/es/geo/lng_lat.js DELETED
@@ -1,59 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { wrap } from "../util";
3
- export const earthRadius = 6371008.8;
4
- export default class LngLat {
5
- static convert(input) {
6
- if (input instanceof LngLat) {
7
- return input;
8
- }
9
- if (Array.isArray(input) && (input.length === 2 || input.length === 3)) {
10
- return new LngLat(Number(input[0]), Number(input[1]));
11
- }
12
- if (!Array.isArray(input) && typeof input === 'object' && input !== null) {
13
- const lng = 'lng' in input ? input.lng : input.lon;
14
- return new LngLat(
15
- // flow can't refine this to have one of lng or lat, so we have to cast to any
16
- Number(lng), Number(input.lat));
17
- }
18
- throw new Error('`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]');
19
- }
20
- constructor(lng, lat) {
21
- _defineProperty(this, "lng", void 0);
22
- _defineProperty(this, "lat", void 0);
23
- if (isNaN(lng) || isNaN(lat)) {
24
- throw new Error(`Invalid LngLat object: (${lng}, ${lat})`);
25
- }
26
- this.lng = +lng;
27
- this.lat = +lat;
28
- if (this.lat > 90 || this.lat < -90) {
29
- throw new Error('Invalid LngLat latitude value: must be between -90 and 90');
30
- }
31
- }
32
- wrap() {
33
- return new LngLat(wrap(this.lng, -180, 180), this.lat);
34
- }
35
- toArray() {
36
- return [this.lng, this.lat];
37
- }
38
- // public toBounds(radius: number = 0) {
39
- // const earthCircumferenceInMetersAtEquator = 40075017;
40
- // const latAccuracy = (360 * radius) / earthCircumferenceInMetersAtEquator;
41
- // const lngAccuracy = latAccuracy / Math.cos((Math.PI / 180) * this.lat);
42
-
43
- // return new LngLatBounds(
44
- // new LngLat(this.lng - lngAccuracy, this.lat - latAccuracy),
45
- // new LngLat(this.lng + lngAccuracy, this.lat + latAccuracy),
46
- // );
47
- // }
48
- toString() {
49
- return `LngLat(${this.lng}, ${this.lat})`;
50
- }
51
- distanceTo(lngLat) {
52
- const rad = Math.PI / 180;
53
- const lat1 = this.lat * rad;
54
- const lat2 = lngLat.lat * rad;
55
- const a = Math.sin(lat1) * Math.sin(lat2) + Math.cos(lat1) * Math.cos(lat2) * Math.cos((lngLat.lng - this.lng) * rad);
56
- const maxMeters = earthRadius * Math.acos(Math.min(a, 1));
57
- return maxMeters;
58
- }
59
- }
@@ -1,25 +0,0 @@
1
- import type { LngLatLike } from './lng_lat';
2
- import LngLat from './lng_lat';
3
- export type LngLatBoundsLike = LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number];
4
- export default class LngLatBounds {
5
- static convert(input: LngLatBoundsLike): LngLatBounds;
6
- private ne;
7
- private sw;
8
- constructor(sw?: any, ne?: any);
9
- setNorthEast(ne: LngLatLike): this;
10
- setSouthWest(sw: LngLatLike): this;
11
- extend(obj: LngLatLike | LngLatBoundsLike): this;
12
- getCenter(): LngLat;
13
- getSouthWest(): LngLat;
14
- getNorthEast(): LngLat;
15
- getNorthWest(): LngLat;
16
- getSouthEast(): LngLat;
17
- getWest(): number;
18
- getSouth(): number;
19
- getEast(): number;
20
- getNorth(): number;
21
- toArray(): [[number, number], [number, number]];
22
- toString(): string;
23
- isEmpty(): boolean;
24
- contains(lnglat: LngLatLike): boolean;
25
- }