@mapgis/mapbox-gl 16.0.1 → 16.2.0

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 (434) hide show
  1. package/dist/mapbox-gl.js +3 -3
  2. package/dist/mapbox-gl.js.map +1 -1
  3. package/package.json +1 -1
  4. package/.flowconfig +0 -61
  5. package/LICENSE.txt +0 -84
  6. package/README.md +0 -34
  7. package/build/banner.js +0 -4
  8. package/build/check-bundle-size.js +0 -140
  9. package/build/generate-access-token-script.js +0 -11
  10. package/build/generate-flow-typed-style-spec.js +0 -188
  11. package/build/generate-release-list.js +0 -21
  12. package/build/generate-struct-arrays.js +0 -237
  13. package/build/generate-style-code.js +0 -159
  14. package/build/mapbox-gl.js.flow +0 -3
  15. package/build/print-release-url.js +0 -6
  16. package/build/rollup_plugin_minify_style_spec.js +0 -20
  17. package/build/rollup_plugins.js +0 -80
  18. package/build/run-node +0 -3
  19. package/build/run-tap +0 -8
  20. package/build/test/build-tape.js +0 -19
  21. package/flow-typed/gl.js +0 -5
  22. package/flow-typed/jsdom.js +0 -18
  23. package/flow-typed/mapbox-gl-supported.js +0 -9
  24. package/flow-typed/mapbox-unitbezier.js +0 -14
  25. package/flow-typed/offscreen-canvas.js +0 -9
  26. package/flow-typed/pbf.js +0 -25
  27. package/flow-typed/point-geometry.js +0 -44
  28. package/flow-typed/potpack.js +0 -12
  29. package/flow-typed/sinon.js +0 -28
  30. package/flow-typed/vector-tile.js +0 -41
  31. package/src/css/mapbox-gl.css +0 -798
  32. package/src/css/svg/mapboxgl-ctrl-attrib.svg +0 -3
  33. package/src/css/svg/mapboxgl-ctrl-compass.svg +0 -4
  34. package/src/css/svg/mapboxgl-ctrl-fullscreen.svg +0 -3
  35. package/src/css/svg/mapboxgl-ctrl-geolocate.svg +0 -5
  36. package/src/css/svg/mapboxgl-ctrl-logo.svg +0 -20
  37. package/src/css/svg/mapboxgl-ctrl-shrink.svg +0 -3
  38. package/src/css/svg/mapboxgl-ctrl-zoom-in.svg +0 -3
  39. package/src/css/svg/mapboxgl-ctrl-zoom-out.svg +0 -3
  40. package/src/data/array_types.js +0 -1095
  41. package/src/data/bucket/circle_attributes.js +0 -9
  42. package/src/data/bucket/circle_bucket.js +0 -204
  43. package/src/data/bucket/fill_attributes.js +0 -9
  44. package/src/data/bucket/fill_bucket.js +0 -233
  45. package/src/data/bucket/fill_extrusion_attributes.js +0 -10
  46. package/src/data/bucket/fill_extrusion_bucket.js +0 -289
  47. package/src/data/bucket/heatmap_bucket.js +0 -17
  48. package/src/data/bucket/line_attributes.js +0 -10
  49. package/src/data/bucket/line_bucket.js +0 -556
  50. package/src/data/bucket/pattern_attributes.js +0 -10
  51. package/src/data/bucket/pattern_bucket_features.js +0 -60
  52. package/src/data/bucket/symbol_attributes.js +0 -117
  53. package/src/data/bucket/symbol_bucket.js +0 -972
  54. package/src/data/bucket.js +0 -123
  55. package/src/data/dem_data.js +0 -125
  56. package/src/data/extent.js +0 -18
  57. package/src/data/feature_index.js +0 -321
  58. package/src/data/feature_position_map.js +0 -125
  59. package/src/data/index_array_type.js +0 -16
  60. package/src/data/load_geometry.js +0 -48
  61. package/src/data/pos_attributes.js +0 -6
  62. package/src/data/program_configuration.js +0 -687
  63. package/src/data/raster_bounds_attributes.js +0 -7
  64. package/src/data/segment.js +0 -76
  65. package/src/geo/edge_insets.js +0 -102
  66. package/src/geo/lng_lat.js +0 -165
  67. package/src/geo/lng_lat_bounds.js +0 -267
  68. package/src/geo/mercator_coordinate.js +0 -153
  69. package/src/geo/transform.js +0 -864
  70. package/src/gl/color_mode.js +0 -34
  71. package/src/gl/context.js +0 -298
  72. package/src/gl/cull_face_mode.js +0 -26
  73. package/src/gl/depth_mode.js +0 -29
  74. package/src/gl/framebuffer.js +0 -44
  75. package/src/gl/index_buffer.js +0 -55
  76. package/src/gl/stencil_mode.js +0 -30
  77. package/src/gl/types.js +0 -84
  78. package/src/gl/value.js +0 -520
  79. package/src/gl/vertex_buffer.js +0 -119
  80. package/src/index.js +0 -201
  81. package/src/render/draw_background.js +0 -57
  82. package/src/render/draw_circle.js +0 -113
  83. package/src/render/draw_collision_debug.js +0 -49
  84. package/src/render/draw_custom.js +0 -49
  85. package/src/render/draw_debug.js +0 -127
  86. package/src/render/draw_fill.js +0 -126
  87. package/src/render/draw_fill_extrusion.js +0 -96
  88. package/src/render/draw_heatmap.js +0 -140
  89. package/src/render/draw_hillshade.js +0 -108
  90. package/src/render/draw_line.js +0 -98
  91. package/src/render/draw_raster.js +0 -125
  92. package/src/render/draw_symbol.js +0 -394
  93. package/src/render/glyph_atlas.js +0 -71
  94. package/src/render/glyph_manager.js +0 -182
  95. package/src/render/image_atlas.js +0 -149
  96. package/src/render/image_manager.js +0 -306
  97. package/src/render/line_atlas.js +0 -210
  98. package/src/render/painter.js +0 -653
  99. package/src/render/program/background_program.js +0 -103
  100. package/src/render/program/circle_program.js +0 -69
  101. package/src/render/program/clipping_mask_program.js +0 -20
  102. package/src/render/program/collision_program.js +0 -49
  103. package/src/render/program/debug_program.js +0 -35
  104. package/src/render/program/fill_extrusion_program.js +0 -122
  105. package/src/render/program/fill_program.js +0 -126
  106. package/src/render/program/heatmap_program.js +0 -83
  107. package/src/render/program/hillshade_program.js +0 -122
  108. package/src/render/program/line_program.js +0 -207
  109. package/src/render/program/pattern.js +0 -102
  110. package/src/render/program/program_uniforms.js +0 -42
  111. package/src/render/program/raster_program.js +0 -92
  112. package/src/render/program/symbol_program.js +0 -224
  113. package/src/render/program.js +0 -168
  114. package/src/render/texture.js +0 -122
  115. package/src/render/uniform_binding.js +0 -147
  116. package/src/render/vertex_array_object.js +0 -163
  117. package/src/shaders/README.md +0 -42
  118. package/src/shaders/_prelude.fragment.glsl +0 -17
  119. package/src/shaders/_prelude.vertex.glsl +0 -73
  120. package/src/shaders/background.fragment.glsl +0 -10
  121. package/src/shaders/background.vertex.glsl +0 -7
  122. package/src/shaders/background_pattern.fragment.glsl +0 -28
  123. package/src/shaders/background_pattern.vertex.glsl +0 -20
  124. package/src/shaders/circle.fragment.glsl +0 -39
  125. package/src/shaders/circle.vertex.glsl +0 -64
  126. package/src/shaders/clipping_mask.fragment.glsl +0 -3
  127. package/src/shaders/clipping_mask.vertex.glsl +0 -7
  128. package/src/shaders/collision_box.fragment.glsl +0 -21
  129. package/src/shaders/collision_box.vertex.glsl +0 -27
  130. package/src/shaders/collision_circle.fragment.glsl +0 -34
  131. package/src/shaders/collision_circle.vertex.glsl +0 -36
  132. package/src/shaders/debug.fragment.glsl +0 -9
  133. package/src/shaders/debug.vertex.glsl +0 -12
  134. package/src/shaders/encode_attribute.js +0 -17
  135. package/src/shaders/fill.fragment.glsl +0 -13
  136. package/src/shaders/fill.vertex.glsl +0 -13
  137. package/src/shaders/fill_extrusion.fragment.glsl +0 -9
  138. package/src/shaders/fill_extrusion.vertex.glsl +0 -66
  139. package/src/shaders/fill_extrusion_pattern.fragment.glsl +0 -45
  140. package/src/shaders/fill_extrusion_pattern.vertex.glsl +0 -79
  141. package/src/shaders/fill_outline.fragment.glsl +0 -17
  142. package/src/shaders/fill_outline.vertex.glsl +0 -17
  143. package/src/shaders/fill_outline_pattern.fragment.glsl +0 -43
  144. package/src/shaders/fill_outline_pattern.vertex.glsl +0 -44
  145. package/src/shaders/fill_pattern.fragment.glsl +0 -36
  146. package/src/shaders/fill_pattern.vertex.glsl +0 -39
  147. package/src/shaders/heatmap.fragment.glsl +0 -22
  148. package/src/shaders/heatmap.vertex.glsl +0 -54
  149. package/src/shaders/heatmap_texture.fragment.glsl +0 -14
  150. package/src/shaders/heatmap_texture.vertex.glsl +0 -11
  151. package/src/shaders/hillshade.fragment.glsl +0 -52
  152. package/src/shaders/hillshade.vertex.glsl +0 -11
  153. package/src/shaders/hillshade_prepare.fragment.glsl +0 -74
  154. package/src/shaders/hillshade_prepare.vertex.glsl +0 -15
  155. package/src/shaders/index.js +0 -20
  156. package/src/shaders/line.fragment.glsl +0 -30
  157. package/src/shaders/line.vertex.glsl +0 -85
  158. package/src/shaders/line_gradient.fragment.glsl +0 -34
  159. package/src/shaders/line_gradient.vertex.glsl +0 -87
  160. package/src/shaders/line_pattern.fragment.glsl +0 -74
  161. package/src/shaders/line_pattern.vertex.glsl +0 -99
  162. package/src/shaders/line_sdf.fragment.glsl +0 -45
  163. package/src/shaders/line_sdf.vertex.glsl +0 -98
  164. package/src/shaders/raster.fragment.glsl +0 -52
  165. package/src/shaders/raster.vertex.glsl +0 -21
  166. package/src/shaders/shaders.js +0 -180
  167. package/src/shaders/symbol_icon.fragment.glsl +0 -17
  168. package/src/shaders/symbol_icon.vertex.glsl +0 -94
  169. package/src/shaders/symbol_sdf.fragment.glsl +0 -52
  170. package/src/shaders/symbol_sdf.vertex.glsl +0 -115
  171. package/src/shaders/symbol_text_and_icon.fragment.glsl +0 -68
  172. package/src/shaders/symbol_text_and_icon.vertex.glsl +0 -116
  173. package/src/source/canvas_source.js +0 -238
  174. package/src/source/geojson_helper.js +0 -92
  175. package/src/source/geojson_source.js +0 -374
  176. package/src/source/geojson_worker_source.js +0 -357
  177. package/src/source/geojson_wrapper.js +0 -94
  178. package/src/source/image_source.js +0 -307
  179. package/src/source/load_tilejson.js +0 -39
  180. package/src/source/mbtiles_source.js +0 -115
  181. package/src/source/offline_database.js +0 -61
  182. package/src/source/offline_database_root.js +0 -62
  183. package/src/source/pixels_to_tile_units.js +0 -21
  184. package/src/source/query_features.js +0 -208
  185. package/src/source/raster_dem_tile_source.js +0 -138
  186. package/src/source/raster_dem_tile_worker_source.js +0 -62
  187. package/src/source/raster_tile_offline_source.js +0 -136
  188. package/src/source/raster_tile_source.js +0 -177
  189. package/src/source/rtl_text_plugin.js +0 -138
  190. package/src/source/source.js +0 -137
  191. package/src/source/source_cache.js +0 -957
  192. package/src/source/source_state.js +0 -159
  193. package/src/source/tile.js +0 -465
  194. package/src/source/tile_bounds.js +0 -38
  195. package/src/source/tile_cache.js +0 -212
  196. package/src/source/tile_id.js +0 -402
  197. package/src/source/vector_tile_source.js +0 -192
  198. package/src/source/vector_tile_worker_source.js +0 -216
  199. package/src/source/video_source.js +0 -203
  200. package/src/source/worker.js +0 -237
  201. package/src/source/worker_source.js +0 -106
  202. package/src/source/worker_tile.js +0 -224
  203. package/src/style/create_style_layer.js +0 -36
  204. package/src/style/evaluation_parameters.js +0 -62
  205. package/src/style/light.js +0 -130
  206. package/src/style/load_glyph_range.js +0 -38
  207. package/src/style/load_sprite.js +0 -67
  208. package/src/style/parse_glyph_pbf.js +0 -44
  209. package/src/style/pauseable_placement.js +0 -132
  210. package/src/style/properties.js +0 -753
  211. package/src/style/query_utils.js +0 -43
  212. package/src/style/style.js +0 -1361
  213. package/src/style/style_glyph.js +0 -17
  214. package/src/style/style_image.js +0 -137
  215. package/src/style/style_layer/background_style_layer.js +0 -21
  216. package/src/style/style_layer/background_style_layer_properties.js +0 -40
  217. package/src/style/style_layer/circle_style_layer.js +0 -98
  218. package/src/style/style_layer/circle_style_layer_properties.js +0 -63
  219. package/src/style/style_layer/custom_style_layer.js +0 -223
  220. package/src/style/style_layer/fill_extrusion_style_layer.js +0 -224
  221. package/src/style/style_layer/fill_extrusion_style_layer_properties.js +0 -50
  222. package/src/style/style_layer/fill_style_layer.js +0 -67
  223. package/src/style/style_layer/fill_style_layer_properties.js +0 -55
  224. package/src/style/style_layer/heatmap_style_layer.js +0 -69
  225. package/src/style/style_layer/heatmap_style_layer_properties.js +0 -44
  226. package/src/style/style_layer/hillshade_style_layer.js +0 -25
  227. package/src/style/style_layer/hillshade_style_layer_properties.js +0 -46
  228. package/src/style/style_layer/layer_properties.js.ejs +0 -69
  229. package/src/style/style_layer/line_style_layer.js +0 -151
  230. package/src/style/style_layer/line_style_layer_properties.js +0 -71
  231. package/src/style/style_layer/raster_style_layer.js +0 -21
  232. package/src/style/style_layer/raster_style_layer_properties.js +0 -50
  233. package/src/style/style_layer/symbol_style_layer.js +0 -190
  234. package/src/style/style_layer/symbol_style_layer_properties.js +0 -153
  235. package/src/style/style_layer/typed_style_layer.js +0 -17
  236. package/src/style/style_layer.js +0 -281
  237. package/src/style/style_layer_index.js +0 -80
  238. package/src/style/validate_style.js +0 -42
  239. package/src/style/zoom_history.js +0 -44
  240. package/src/style-spec/.eslintrc +0 -5
  241. package/src/style-spec/CHANGELOG.md +0 -438
  242. package/src/style-spec/README.md +0 -59
  243. package/src/style-spec/bin/gl-style-composite +0 -9
  244. package/src/style-spec/bin/gl-style-format +0 -22
  245. package/src/style-spec/bin/gl-style-migrate +0 -9
  246. package/src/style-spec/bin/gl-style-validate +0 -50
  247. package/src/style-spec/composite.js +0 -50
  248. package/src/style-spec/declass.js +0 -42
  249. package/src/style-spec/deref.js +0 -52
  250. package/src/style-spec/diff.js +0 -393
  251. package/src/style-spec/dist/.gitkeep +0 -0
  252. package/src/style-spec/empty.js +0 -29
  253. package/src/style-spec/error/parsing_error.js +0 -16
  254. package/src/style-spec/error/validation_error.js +0 -18
  255. package/src/style-spec/expression/compound_expression.js +0 -162
  256. package/src/style-spec/expression/definitions/assertion.js +0 -130
  257. package/src/style-spec/expression/definitions/at.js +0 -70
  258. package/src/style-spec/expression/definitions/case.js +0 -85
  259. package/src/style-spec/expression/definitions/coalesce.js +0 -93
  260. package/src/style-spec/expression/definitions/coercion.js +0 -133
  261. package/src/style-spec/expression/definitions/collator.js +0 -78
  262. package/src/style-spec/expression/definitions/comparison.js +0 -184
  263. package/src/style-spec/expression/definitions/format.js +0 -144
  264. package/src/style-spec/expression/definitions/format_section_override.js +0 -54
  265. package/src/style-spec/expression/definitions/image.js +0 -52
  266. package/src/style-spec/expression/definitions/in.js +0 -92
  267. package/src/style-spec/expression/definitions/index.js +0 -561
  268. package/src/style-spec/expression/definitions/interpolate.js +0 -267
  269. package/src/style-spec/expression/definitions/length.js +0 -61
  270. package/src/style-spec/expression/definitions/let.js +0 -72
  271. package/src/style-spec/expression/definitions/literal.js +0 -77
  272. package/src/style-spec/expression/definitions/match.js +0 -158
  273. package/src/style-spec/expression/definitions/number_format.js +0 -142
  274. package/src/style-spec/expression/definitions/step.js +0 -120
  275. package/src/style-spec/expression/definitions/var.js +0 -46
  276. package/src/style-spec/expression/definitions/within.js +0 -333
  277. package/src/style-spec/expression/evaluation_context.js +0 -59
  278. package/src/style-spec/expression/expression.js +0 -27
  279. package/src/style-spec/expression/index.js +0 -392
  280. package/src/style-spec/expression/is_constant.js +0 -59
  281. package/src/style-spec/expression/parsing_context.js +0 -233
  282. package/src/style-spec/expression/parsing_error.js +0 -13
  283. package/src/style-spec/expression/runtime_error.js +0 -17
  284. package/src/style-spec/expression/scope.js +0 -36
  285. package/src/style-spec/expression/stops.js +0 -39
  286. package/src/style-spec/expression/types/collator.js +0 -61
  287. package/src/style-spec/expression/types/formatted.js +0 -73
  288. package/src/style-spec/expression/types/resolved_image.js +0 -29
  289. package/src/style-spec/expression/types.js +0 -106
  290. package/src/style-spec/expression/values.js +0 -123
  291. package/src/style-spec/feature_filter/README.md +0 -55
  292. package/src/style-spec/feature_filter/convert.js +0 -208
  293. package/src/style-spec/feature_filter/index.js +0 -165
  294. package/src/style-spec/format.js +0 -51
  295. package/src/style-spec/function/convert.js +0 -254
  296. package/src/style-spec/function/index.js +0 -262
  297. package/src/style-spec/group_by_layout.js +0 -75
  298. package/src/style-spec/migrate/expressions.js +0 -39
  299. package/src/style-spec/migrate/v8.js +0 -203
  300. package/src/style-spec/migrate/v9.js +0 -26
  301. package/src/style-spec/migrate.js +0 -36
  302. package/src/style-spec/package.json +0 -41
  303. package/src/style-spec/read_style.js +0 -14
  304. package/src/style-spec/reference/latest.js +0 -3
  305. package/src/style-spec/reference/v8.json +0 -5808
  306. package/src/style-spec/rollup.config.js +0 -45
  307. package/src/style-spec/style-spec.js +0 -122
  308. package/src/style-spec/types.js +0 -438
  309. package/src/style-spec/util/color.js +0 -95
  310. package/src/style-spec/util/color_spaces.js +0 -139
  311. package/src/style-spec/util/deep_equal.js +0 -28
  312. package/src/style-spec/util/extend.js +0 -10
  313. package/src/style-spec/util/get_type.js +0 -17
  314. package/src/style-spec/util/interpolate.js +0 -22
  315. package/src/style-spec/util/properties.js +0 -15
  316. package/src/style-spec/util/ref_properties.js +0 -2
  317. package/src/style-spec/util/result.js +0 -19
  318. package/src/style-spec/util/unbundle_jsonlint.js +0 -24
  319. package/src/style-spec/validate/latest.js +0 -11
  320. package/src/style-spec/validate/validate.js +0 -75
  321. package/src/style-spec/validate/validate_array.js +0 -52
  322. package/src/style-spec/validate/validate_boolean.js +0 -15
  323. package/src/style-spec/validate/validate_color.js +0 -20
  324. package/src/style-spec/validate/validate_constants.js +0 -13
  325. package/src/style-spec/validate/validate_enum.js +0 -21
  326. package/src/style-spec/validate/validate_expression.js +0 -43
  327. package/src/style-spec/validate/validate_filter.js +0 -111
  328. package/src/style-spec/validate/validate_formatted.js +0 -11
  329. package/src/style-spec/validate/validate_function.js +0 -207
  330. package/src/style-spec/validate/validate_glyphs_url.js +0 -21
  331. package/src/style-spec/validate/validate_image.js +0 -11
  332. package/src/style-spec/validate/validate_layer.js +0 -134
  333. package/src/style-spec/validate/validate_layout_property.js +0 -6
  334. package/src/style-spec/validate/validate_light.js +0 -47
  335. package/src/style-spec/validate/validate_number.js +0 -29
  336. package/src/style-spec/validate/validate_object.js +0 -61
  337. package/src/style-spec/validate/validate_paint_property.js +0 -6
  338. package/src/style-spec/validate/validate_property.js +0 -64
  339. package/src/style-spec/validate/validate_source.js +0 -111
  340. package/src/style-spec/validate/validate_string.js +0 -15
  341. package/src/style-spec/validate_mapbox_api_supported.js +0 -171
  342. package/src/style-spec/validate_style.js +0 -39
  343. package/src/style-spec/validate_style.min.js +0 -78
  344. package/src/style-spec/visit.js +0 -77
  345. package/src/symbol/anchor.js +0 -26
  346. package/src/symbol/check_max_angle.js +0 -81
  347. package/src/symbol/clip_line.js +0 -71
  348. package/src/symbol/collision_feature.js +0 -217
  349. package/src/symbol/collision_index.js +0 -372
  350. package/src/symbol/cross_tile_symbol_index.js +0 -301
  351. package/src/symbol/get_anchors.js +0 -167
  352. package/src/symbol/grid_index.js +0 -335
  353. package/src/symbol/mergelines.js +0 -82
  354. package/src/symbol/one_em.js +0 -4
  355. package/src/symbol/opacity_state.js +0 -27
  356. package/src/symbol/placement.js +0 -1062
  357. package/src/symbol/projection.js +0 -450
  358. package/src/symbol/quads.js +0 -334
  359. package/src/symbol/shaping.js +0 -816
  360. package/src/symbol/symbol_layout.js +0 -772
  361. package/src/symbol/symbol_size.js +0 -113
  362. package/src/symbol/transform_text.js +0 -29
  363. package/src/types/callback.js +0 -17
  364. package/src/types/cancelable.js +0 -3
  365. package/src/types/tilejson.js +0 -17
  366. package/src/types/transferable.js +0 -3
  367. package/src/types/window.js +0 -172
  368. package/src/ui/anchor.js +0 -32
  369. package/src/ui/bind_handlers.js +0 -202
  370. package/src/ui/camera.js +0 -1152
  371. package/src/ui/control/attribution_control.js +0 -189
  372. package/src/ui/control/fps_control.js +0 -185
  373. package/src/ui/control/fullscreen_control.js +0 -147
  374. package/src/ui/control/geolocate_control.js +0 -594
  375. package/src/ui/control/logo_control.js +0 -92
  376. package/src/ui/control/navigation_control.js +0 -148
  377. package/src/ui/control/scale_control.js +0 -142
  378. package/src/ui/crs.js +0 -64
  379. package/src/ui/default_locale.js +0 -20
  380. package/src/ui/events.js +0 -806
  381. package/src/ui/handler/box_zoom.js +0 -175
  382. package/src/ui/handler/dblclick_zoom.js +0 -139
  383. package/src/ui/handler/drag_pan.js +0 -416
  384. package/src/ui/handler/drag_rotate.js +0 -378
  385. package/src/ui/handler/keyboard.js +0 -161
  386. package/src/ui/handler/scroll_zoom.js +0 -333
  387. package/src/ui/handler/touch_zoom_rotate.js +0 -293
  388. package/src/ui/hash.js +0 -147
  389. package/src/ui/map.js +0 -2883
  390. package/src/ui/marker.js +0 -607
  391. package/src/ui/offline_map.js +0 -91
  392. package/src/ui/popup.js +0 -530
  393. package/src/util/actor.js +0 -212
  394. package/src/util/ajax.js +0 -371
  395. package/src/util/browser/web_worker.js +0 -10
  396. package/src/util/browser/window.js +0 -5
  397. package/src/util/browser.js +0 -70
  398. package/src/util/classify_rings.js +0 -52
  399. package/src/util/color_ramp.js +0 -28
  400. package/src/util/config.js +0 -30
  401. package/src/util/debug.js +0 -12
  402. package/src/util/dictionary_coder.js +0 -30
  403. package/src/util/dispatcher.js +0 -70
  404. package/src/util/dom.js +0 -144
  405. package/src/util/evented.js +0 -174
  406. package/src/util/find_pole_of_inaccessibility.js +0 -129
  407. package/src/util/global_worker_pool.js +0 -17
  408. package/src/util/image.js +0 -142
  409. package/src/util/intersection_tests.js +0 -208
  410. package/src/util/is_char_in_unicode_block.js +0 -311
  411. package/src/util/mapbox.js +0 -486
  412. package/src/util/offscreen_canvas_supported.js +0 -14
  413. package/src/util/performance.js +0 -112
  414. package/src/util/primitives.js +0 -145
  415. package/src/util/resolve_tokens.js +0 -16
  416. package/src/util/script_detection.js +0 -328
  417. package/src/util/sku_token.js +0 -42
  418. package/src/util/smart_wrap.js +0 -55
  419. package/src/util/struct_array.js +0 -243
  420. package/src/util/struct_array.js.ejs +0 -112
  421. package/src/util/struct_array_layout.js.ejs +0 -98
  422. package/src/util/task_queue.js +0 -68
  423. package/src/util/throttle.js +0 -28
  424. package/src/util/throttled_invoker.js +0 -46
  425. package/src/util/tile_cover.js +0 -101
  426. package/src/util/tile_request_cache.js +0 -172
  427. package/src/util/util.js +0 -504
  428. package/src/util/vectortile_to_geojson.js +0 -54
  429. package/src/util/verticalize_punctuation.js +0 -114
  430. package/src/util/web_worker.js +0 -91
  431. package/src/util/web_worker_transfer.js +0 -266
  432. package/src/util/webp_supported.js +0 -69
  433. package/src/util/window.js +0 -102
  434. package/src/util/worker_pool.js +0 -47
package/src/ui/camera.js DELETED
@@ -1,1152 +0,0 @@
1
- // @flow
2
-
3
- import {
4
- bindAll,
5
- extend,
6
- warnOnce,
7
- clamp,
8
- wrap,
9
- ease as defaultEasing,
10
- pick
11
- } from '../util/util';
12
- import {number as interpolate} from '../style-spec/util/interpolate';
13
- import browser from '../util/browser';
14
- import LngLat from '../geo/lng_lat';
15
- import LngLatBounds from '../geo/lng_lat_bounds';
16
- import Point from '@mapbox/point-geometry';
17
- import {Event, Evented} from '../util/evented';
18
-
19
- import type Transform from '../geo/transform';
20
- import type {LngLatLike} from '../geo/lng_lat';
21
- import type {LngLatBoundsLike} from '../geo/lng_lat_bounds';
22
- import type {TaskID} from '../util/task_queue';
23
- import type {PointLike} from '@mapbox/point-geometry';
24
- import type {PaddingOptions} from '../geo/edge_insets';
25
-
26
- /**
27
- * Options common to {@link Map#jumpTo}, {@link Map#easeTo}, and {@link Map#flyTo}, controlling the desired location,
28
- * zoom, bearing, and pitch of the camera. All properties are optional, and when a property is omitted, the current
29
- * camera value for that property will remain unchanged.
30
- *
31
- * @typedef {Object} CameraOptions
32
- * @property {LngLatLike} center The desired center.
33
- * @property {number} zoom The desired zoom level.
34
- * @property {number} bearing The desired bearing, in degrees. The bearing is the compass direction that
35
- * is "up"; for example, a bearing of 90° orients the map so that east is up.
36
- * @property {number} pitch The desired pitch, in degrees.
37
- * @property {LngLatLike} around If `zoom` is specified, `around` determines the point around which the zoom is centered.
38
- * @property {PaddingOptions} padding Dimensions in pixels applied on eachs side of the viewport for shifting the vanishing point.
39
- */
40
- export type CameraOptions = {
41
- center?: LngLatLike,
42
- zoom?: number,
43
- bearing?: number,
44
- pitch?: number,
45
- around?: LngLatLike,
46
- padding?: PaddingOptions
47
- };
48
-
49
- /**
50
- * Options common to map movement methods that involve animation, such as {@link Map#panBy} and
51
- * {@link Map#easeTo}, controlling the duration and easing function of the animation. All properties
52
- * are optional.
53
- *
54
- * @typedef {Object} AnimationOptions
55
- * @property {number} duration The animation's duration, measured in milliseconds.
56
- * @property {Function} easing A function taking a time in the range 0..1 and returning a number where 0 is
57
- * the initial state and 1 is the final state.
58
- * @property {PointLike} offset of the target center relative to real map container center at the end of animation.
59
- * @property {boolean} animate If `false`, no animation will occur.
60
- * @property {boolean} essential If `true`, then the animation is considered essential and will not be affected by
61
- * [`prefers-reduced-motion`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion).
62
- */
63
- export type AnimationOptions = {
64
- duration?: number,
65
- easing?: (_: number) => number,
66
- offset?: PointLike,
67
- animate?: boolean,
68
- essential?: boolean
69
- };
70
-
71
- /**
72
- * Options for setting padding on a call to {@link Map#fitBounds}. All properties of this object must be
73
- * non-negative integers.
74
- *
75
- * @typedef {Object} PaddingOptions
76
- * @property {number} top Padding in pixels from the top of the map canvas.
77
- * @property {number} bottom Padding in pixels from the bottom of the map canvas.
78
- * @property {number} left Padding in pixels from the left of the map canvas.
79
- * @property {number} right Padding in pixels from the right of the map canvas.
80
- */
81
-
82
- class Camera extends Evented {
83
- transform: Transform;
84
- _moving: boolean;
85
- _zooming: boolean;
86
- _rotating: boolean;
87
- _pitching: boolean;
88
- _padding: boolean;
89
-
90
- _bearingSnap: number;
91
- _easeEndTimeoutID: TimeoutID;
92
- _easeStart: number;
93
- _easeOptions: {duration: number, easing: (_: number) => number};
94
-
95
- _onEaseFrame: (_: number) => void;
96
- _onEaseEnd: () => void;
97
- _easeFrameId: ?TaskID;
98
-
99
- +_requestRenderFrame: (() => void) => TaskID;
100
- +_cancelRenderFrame: (_: TaskID) => void;
101
-
102
- constructor(transform: Transform, options: {bearingSnap: number}) {
103
- super();
104
- this._moving = false;
105
- this._zooming = false;
106
- this.transform = transform;
107
- this._bearingSnap = options.bearingSnap;
108
-
109
- bindAll(['_renderFrameCallback'], this);
110
- }
111
-
112
- /**
113
- * Returns the map's geographical centerpoint.
114
- *
115
- * @memberof Map#
116
- * @returns The map's geographical centerpoint.
117
- */
118
- getCenter(): LngLat { return new LngLat(this.transform.center.lng, this.transform.center.lat); }
119
-
120
- /**
121
- * Sets the map's geographical centerpoint. Equivalent to `jumpTo({center: center})`.
122
- *
123
- * @memberof Map#
124
- * @param center The centerpoint to set.
125
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
126
- * @fires movestart
127
- * @fires moveend
128
- * @returns {Map} `this`
129
- * @example
130
- * map.setCenter([-74, 38]);
131
- */
132
- setCenter(center: LngLatLike, eventData?: Object) {
133
- return this.jumpTo({center}, eventData);
134
- }
135
-
136
- /**
137
- * Pans the map by the specified offset.
138
- *
139
- * @memberof Map#
140
- * @param offset `x` and `y` coordinates by which to pan the map.
141
- * @param options Options object
142
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
143
- * @fires movestart
144
- * @fires moveend
145
- * @returns {Map} `this`
146
- * @see [Navigate the map with game-like controls](https://www.mapbox.com/mapbox-gl-js/example/game-controls/)
147
- */
148
- panBy(offset: PointLike, options?: AnimationOptions, eventData?: Object) {
149
- offset = Point.convert(offset).mult(-1);
150
- return this.panTo(this.transform.center, extend({offset}, options), eventData);
151
- }
152
-
153
- /**
154
- * Pans the map to the specified location, with an animated transition.
155
- *
156
- * @memberof Map#
157
- * @param lnglat The location to pan the map to.
158
- * @param options Options object
159
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
160
- * @fires movestart
161
- * @fires moveend
162
- * @returns {Map} `this`
163
- */
164
- panTo(lnglat: LngLatLike, options?: AnimationOptions, eventData?: Object) {
165
- return this.easeTo(extend({
166
- center: lnglat
167
- }, options), eventData);
168
- }
169
-
170
- /**
171
- * Returns the map's current zoom level.
172
- *
173
- * @memberof Map#
174
- * @returns The map's current zoom level.
175
- */
176
- getZoom(): number { return this.transform.zoom; }
177
-
178
- /**
179
- * Sets the map's zoom level. Equivalent to `jumpTo({zoom: zoom})`.
180
- *
181
- * @memberof Map#
182
- * @param zoom The zoom level to set (0-20).
183
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
184
- * @fires movestart
185
- * @fires zoomstart
186
- * @fires move
187
- * @fires zoom
188
- * @fires moveend
189
- * @fires zoomend
190
- * @returns {Map} `this`
191
- * @example
192
- * // zoom the map to 5
193
- * map.setZoom(5);
194
- */
195
- setZoom(zoom: number, eventData?: Object) {
196
- this.jumpTo({zoom}, eventData);
197
- return this;
198
- }
199
-
200
- /**
201
- * Zooms the map to the specified zoom level, with an animated transition.
202
- *
203
- * @memberof Map#
204
- * @param zoom The zoom level to transition to.
205
- * @param options Options object
206
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
207
- * @fires movestart
208
- * @fires zoomstart
209
- * @fires move
210
- * @fires zoom
211
- * @fires moveend
212
- * @fires zoomend
213
- * @returns {Map} `this`
214
- */
215
- zoomTo(zoom: number, options: ? AnimationOptions, eventData?: Object) {
216
- return this.easeTo(extend({
217
- zoom
218
- }, options), eventData);
219
- }
220
-
221
- /**
222
- * Increases the map's zoom level by 1.
223
- *
224
- * @memberof Map#
225
- * @param options Options object
226
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
227
- * @fires movestart
228
- * @fires zoomstart
229
- * @fires move
230
- * @fires zoom
231
- * @fires moveend
232
- * @fires zoomend
233
- * @returns {Map} `this`
234
- */
235
- zoomIn(options?: AnimationOptions, eventData?: Object) {
236
- this.zoomTo(this.getZoom() + 1, options, eventData);
237
- return this;
238
- }
239
-
240
- /**
241
- * Decreases the map's zoom level by 1.
242
- *
243
- * @memberof Map#
244
- * @param options Options object
245
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
246
- * @fires movestart
247
- * @fires zoomstart
248
- * @fires move
249
- * @fires zoom
250
- * @fires moveend
251
- * @fires zoomend
252
- * @returns {Map} `this`
253
- */
254
- zoomOut(options?: AnimationOptions, eventData?: Object) {
255
- this.zoomTo(this.getZoom() - 1, options, eventData);
256
- return this;
257
- }
258
-
259
- /**
260
- * Returns the map's current bearing. The bearing is the compass direction that is \"up\"; for example, a bearing
261
- * of 90° orients the map so that east is up.
262
- *
263
- * @memberof Map#
264
- * @returns The map's current bearing.
265
- * @see [Navigate the map with game-like controls](https://www.mapbox.com/mapbox-gl-js/example/game-controls/)
266
- */
267
- getBearing(): number { return this.transform.bearing; }
268
-
269
- /**
270
- * Sets the map's bearing (rotation). The bearing is the compass direction that is \"up\"; for example, a bearing
271
- * of 90° orients the map so that east is up.
272
- *
273
- * Equivalent to `jumpTo({bearing: bearing})`.
274
- *
275
- * @memberof Map#
276
- * @param bearing The desired bearing.
277
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
278
- * @fires movestart
279
- * @fires moveend
280
- * @returns {Map} `this`
281
- * @example
282
- * // rotate the map to 90 degrees
283
- * map.setBearing(90);
284
- */
285
- setBearing(bearing: number, eventData?: Object) {
286
- this.jumpTo({bearing}, eventData);
287
- return this;
288
- }
289
-
290
- /**
291
- * Returns the current padding applied around the map viewport.
292
- *
293
- * @memberof Map#
294
- * @returns The current padding around the map viewport.
295
- */
296
- getPadding(): PaddingOptions { return this.transform.padding; }
297
-
298
- /**
299
- * Sets the padding in pixels around the viewport.
300
- *
301
- * Equivalent to `jumpTo({padding: padding})`.
302
- *
303
- * @memberof Map#
304
- * @param padding The desired padding. Format: { left: number, right: number, top: number, bottom: number }
305
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
306
- * @fires movestart
307
- * @fires moveend
308
- * @returns {Map} `this`
309
- * @example
310
- * // Sets a left padding of 300px, and a top padding of 50px
311
- * map.setPadding({ left: 300, top: 50 });
312
- */
313
- setPadding(padding: PaddingOptions, eventData?: Object) {
314
- this.jumpTo({padding}, eventData);
315
- return this;
316
- }
317
-
318
- /**
319
- * Rotates the map to the specified bearing, with an animated transition. The bearing is the compass direction
320
- * that is \"up\"; for example, a bearing of 90° orients the map so that east is up.
321
- *
322
- * @memberof Map#
323
- * @param bearing The desired bearing.
324
- * @param options Options object
325
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
326
- * @fires movestart
327
- * @fires moveend
328
- * @returns {Map} `this`
329
- */
330
- rotateTo(bearing: number, options?: AnimationOptions, eventData?: Object) {
331
- return this.easeTo(extend({
332
- bearing
333
- }, options), eventData);
334
- }
335
-
336
- /**
337
- * Rotates the map so that north is up (0° bearing), with an animated transition.
338
- *
339
- * @memberof Map#
340
- * @param options Options object
341
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
342
- * @fires movestart
343
- * @fires moveend
344
- * @returns {Map} `this`
345
- */
346
- resetNorth(options?: AnimationOptions, eventData?: Object) {
347
- this.rotateTo(0, extend({duration: 1000}, options), eventData);
348
- return this;
349
- }
350
-
351
- /**
352
- * Rotates and pitches the map so that north is up (0° bearing) and pitch is 0°, with an animated transition.
353
- *
354
- * @memberof Map#
355
- * @param options Options object
356
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
357
- * @fires movestart
358
- * @fires moveend
359
- * @returns {Map} `this`
360
- */
361
- resetNorthPitch(options?: AnimationOptions, eventData?: Object) {
362
- this.easeTo(extend({
363
- bearing: 0,
364
- pitch: 0,
365
- duration: 1000
366
- }, options), eventData);
367
- return this;
368
- }
369
-
370
- /**
371
- * Snaps the map so that north is up (0° bearing), if the current bearing is close enough to it (i.e. within the
372
- * `bearingSnap` threshold).
373
- *
374
- * @memberof Map#
375
- * @param options Options object
376
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
377
- * @fires movestart
378
- * @fires moveend
379
- * @returns {Map} `this`
380
- */
381
- snapToNorth(options?: AnimationOptions, eventData?: Object) {
382
- if (Math.abs(this.getBearing()) < this._bearingSnap) {
383
- return this.resetNorth(options, eventData);
384
- }
385
- return this;
386
- }
387
-
388
- /**
389
- * Returns the map's current pitch (tilt).
390
- *
391
- * @memberof Map#
392
- * @returns The map's current pitch, measured in degrees away from the plane of the screen.
393
- */
394
- getPitch(): number { return this.transform.pitch; }
395
-
396
- /**
397
- * Sets the map's pitch (tilt). Equivalent to `jumpTo({pitch: pitch})`.
398
- *
399
- * @memberof Map#
400
- * @param pitch The pitch to set, measured in degrees away from the plane of the screen (0-60).
401
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
402
- * @fires pitchstart
403
- * @fires movestart
404
- * @fires moveend
405
- * @returns {Map} `this`
406
- */
407
- setPitch(pitch: number, eventData?: Object) {
408
- this.jumpTo({pitch}, eventData);
409
- return this;
410
- }
411
-
412
- /**
413
- * @memberof Map#
414
- * @param {LngLatBoundsLike} bounds Calculate the center for these bounds in the viewport and use
415
- * the highest zoom level up to and including `Map#getMaxZoom()` that fits
416
- * in the viewport. LatLngBounds represent a box that is always axis-aligned with bearing 0.
417
- * @param options Options object
418
- * @param {number | PaddingOptions} [options.padding] The amount of padding in pixels to add to the given bounds.
419
- * @param {PointLike} [options.offset=[0, 0]] The center of the given bounds relative to the map's center, measured in pixels.
420
- * @param {number} [options.maxZoom] The maximum zoom level to allow when the camera would transition to the specified bounds.
421
- * @returns {CameraOptions | void} If map is able to fit to provided bounds, returns `CameraOptions` with
422
- * `center`, `zoom`, and `bearing`. If map is unable to fit, method will warn and return undefined.
423
- * @example
424
- * var bbox = [[-79, 43], [-73, 45]];
425
- * var newCameraTransform = map.cameraForBounds(bbox, {
426
- * padding: {top: 10, bottom:25, left: 15, right: 5}
427
- * });
428
- */
429
- cameraForBounds(bounds: LngLatBoundsLike, options?: CameraOptions): void | CameraOptions & AnimationOptions {
430
- bounds = LngLatBounds.convert(bounds);
431
- return this._cameraForBoxAndBearing(bounds.getNorthWest(), bounds.getSouthEast(), 0, options);
432
- }
433
-
434
- /**
435
- * Calculate the center of these two points in the viewport and use
436
- * the highest zoom level up to and including `Map#getMaxZoom()` that fits
437
- * the points in the viewport at the specified bearing.
438
- * @memberof Map#
439
- * @param {LngLatLike} p0 First point
440
- * @param {LngLatLike} p1 Second point
441
- * @param bearing Desired map bearing at end of animation, in degrees
442
- * @param options
443
- * @param {number | PaddingOptions} [options.padding] The amount of padding in pixels to add to the given bounds.
444
- * @param {PointLike} [options.offset=[0, 0]] The center of the given bounds relative to the map's center, measured in pixels.
445
- * @param {number} [options.maxZoom] The maximum zoom level to allow when the camera would transition to the specified bounds.
446
- * @returns {CameraOptions | void} If map is able to fit to provided bounds, returns `CameraOptions` with
447
- * `center`, `zoom`, and `bearing`. If map is unable to fit, method will warn and return undefined.
448
- * @private
449
- * @example
450
- * var p0 = [-79, 43];
451
- * var p1 = [-73, 45];
452
- * var bearing = 90;
453
- * var newCameraTransform = map._cameraForBoxAndBearing(p0, p1, bearing, {
454
- * padding: {top: 10, bottom:25, left: 15, right: 5}
455
- * });
456
- */
457
- _cameraForBoxAndBearing(p0: LngLatLike, p1: LngLatLike, bearing: number, options?: CameraOptions): void | CameraOptions & AnimationOptions {
458
- const defaultPadding = {
459
- top: 0,
460
- bottom: 0,
461
- right: 0,
462
- left: 0
463
- };
464
- options = extend({
465
- padding: defaultPadding,
466
- offset: [0, 0],
467
- maxZoom: this.transform.maxZoom
468
- }, options);
469
-
470
- if (typeof options.padding === 'number') {
471
- const p = options.padding;
472
- options.padding = {
473
- top: p,
474
- bottom: p,
475
- right: p,
476
- left: p
477
- };
478
- }
479
-
480
- options.padding = extend(defaultPadding, options.padding);
481
- const tr = this.transform;
482
- const edgePadding = tr.padding;
483
-
484
- // We want to calculate the upper right and lower left of the box defined by p0 and p1
485
- // in a coordinate system rotate to match the destination bearing.
486
- const p0world = tr.project(LngLat.convert(p0));
487
- const p1world = tr.project(LngLat.convert(p1));
488
- const p0rotated = p0world.rotate(-bearing * Math.PI / 180);
489
- const p1rotated = p1world.rotate(-bearing * Math.PI / 180);
490
-
491
- const upperRight = new Point(Math.max(p0rotated.x, p1rotated.x), Math.max(p0rotated.y, p1rotated.y));
492
- const lowerLeft = new Point(Math.min(p0rotated.x, p1rotated.x), Math.min(p0rotated.y, p1rotated.y));
493
-
494
- // Calculate zoom: consider the original bbox and padding.
495
- const size = upperRight.sub(lowerLeft);
496
- const scaleX = (tr.width - (edgePadding.left + edgePadding.right + options.padding.left + options.padding.right)) / size.x;
497
- const scaleY = (tr.height - (edgePadding.top + edgePadding.bottom + options.padding.top + options.padding.bottom)) / size.y;
498
-
499
- if (scaleY < 0 || scaleX < 0) {
500
- warnOnce(
501
- 'Map cannot fit within canvas with the given bounds, padding, and/or offset.'
502
- );
503
- return;
504
- }
505
-
506
- const zoom = Math.min(tr.scaleZoom(tr.scale * Math.min(scaleX, scaleY)), options.maxZoom);
507
-
508
- // Calculate center: apply the zoom, the configured offset, as well as offset that exists as a result of padding.
509
- const offset = Point.convert(options.offset);
510
- const paddingOffsetX = (options.padding.left - options.padding.right) / 2;
511
- const paddingOffsetY = (options.padding.top - options.padding.bottom) / 2;
512
- const offsetAtInitialZoom = new Point(offset.x + paddingOffsetX, offset.y + paddingOffsetY);
513
- const offsetAtFinalZoom = offsetAtInitialZoom.mult(tr.scale / tr.zoomScale(zoom));
514
-
515
- const center = tr.unproject(p0world.add(p1world).div(2).sub(offsetAtFinalZoom));
516
-
517
- return {
518
- center,
519
- zoom,
520
- bearing
521
- };
522
- }
523
-
524
- /**
525
- * Pans and zooms the map to contain its visible area within the specified geographical bounds.
526
- * This function will also reset the map's bearing to 0 if bearing is nonzero.
527
- *
528
- * @memberof Map#
529
- * @param bounds Center these bounds in the viewport and use the highest
530
- * zoom level up to and including `Map#getMaxZoom()` that fits them in the viewport.
531
- * @param {Object} [options] Options supports all properties from {@link AnimationOptions} and {@link CameraOptions} in addition to the fields below.
532
- * @param {number | PaddingOptions} [options.padding] The amount of padding in pixels to add to the given bounds.
533
- * @param {boolean} [options.linear=false] If `true`, the map transitions using
534
- * {@link Map#easeTo}. If `false`, the map transitions using {@link Map#flyTo}. See
535
- * those functions and {@link AnimationOptions} for information about options available.
536
- * @param {Function} [options.easing] An easing function for the animated transition. See {@link AnimationOptions}.
537
- * @param {PointLike} [options.offset=[0, 0]] The center of the given bounds relative to the map's center, measured in pixels.
538
- * @param {number} [options.maxZoom] The maximum zoom level to allow when the map view transitions to the specified bounds.
539
- * @param {Object} [eventData] Additional properties to be added to event objects of events triggered by this method.
540
- * @fires movestart
541
- * @fires moveend
542
- * @returns {Map} `this`
543
- * @example
544
- * var bbox = [[-79, 43], [-73, 45]];
545
- * map.fitBounds(bbox, {
546
- * padding: {top: 10, bottom:25, left: 15, right: 5}
547
- * });
548
- * @see [Fit a map to a bounding box](https://www.mapbox.com/mapbox-gl-js/example/fitbounds/)
549
- */
550
- fitBounds(bounds: LngLatBoundsLike, options?: AnimationOptions & CameraOptions, eventData?: Object) {
551
- return this._fitInternal(
552
- this.cameraForBounds(bounds, options),
553
- options,
554
- eventData);
555
- }
556
-
557
- /**
558
- * Pans, rotates and zooms the map to to fit the box made by points p0 and p1
559
- * once the map is rotated to the specified bearing. To zoom without rotating,
560
- * pass in the current map bearing.
561
- *
562
- * @memberof Map#
563
- * @param p0 First point on screen, in pixel coordinates
564
- * @param p1 Second point on screen, in pixel coordinates
565
- * @param bearing Desired map bearing at end of animation, in degrees
566
- * @param options Options object
567
- * @param {number | PaddingOptions} [options.padding] The amount of padding in pixels to add to the given bounds.
568
- * @param {boolean} [options.linear=false] If `true`, the map transitions using
569
- * {@link Map#easeTo}. If `false`, the map transitions using {@link Map#flyTo}. See
570
- * those functions and {@link AnimationOptions} for information about options available.
571
- * @param {Function} [options.easing] An easing function for the animated transition. See {@link AnimationOptions}.
572
- * @param {PointLike} [options.offset=[0, 0]] The center of the given bounds relative to the map's center, measured in pixels.
573
- * @param {number} [options.maxZoom] The maximum zoom level to allow when the map view transitions to the specified bounds.
574
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
575
- * @fires movestart
576
- * @fires moveend
577
- * @returns {Map} `this`
578
- * @example
579
- * var p0 = [220, 400];
580
- * var p1 = [500, 900];
581
- * map.fitScreenCoordinates(p0, p1, map.getBearing(), {
582
- * padding: {top: 10, bottom:25, left: 15, right: 5}
583
- * });
584
- * @see [Used by BoxZoomHandler](https://www.mapbox.com/mapbox-gl-js/api/#boxzoomhandler)
585
- */
586
- fitScreenCoordinates(p0: PointLike, p1: PointLike, bearing: number, options?: AnimationOptions & CameraOptions, eventData?: Object) {
587
- return this._fitInternal(
588
- this._cameraForBoxAndBearing(
589
- this.transform.pointLocation(Point.convert(p0)),
590
- this.transform.pointLocation(Point.convert(p1)),
591
- bearing,
592
- options),
593
- options,
594
- eventData);
595
- }
596
-
597
- _fitInternal(calculatedOptions?: CameraOptions & AnimationOptions, options?: AnimationOptions & CameraOptions, eventData?: Object) {
598
- // cameraForBounds warns + returns undefined if unable to fit:
599
- if (!calculatedOptions) return this;
600
-
601
- options = extend(calculatedOptions, options);
602
-
603
- return options.linear ?
604
- this.easeTo(options, eventData) :
605
- this.flyTo(options, eventData);
606
- }
607
-
608
- /**
609
- * Changes any combination of center, zoom, bearing, and pitch, without
610
- * an animated transition. The map will retain its current values for any
611
- * details not specified in `options`.
612
- *
613
- * @memberof Map#
614
- * @param options Options object
615
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
616
- * @fires movestart
617
- * @fires zoomstart
618
- * @fires pitchstart
619
- * @fires rotate
620
- * @fires move
621
- * @fires zoom
622
- * @fires pitch
623
- * @fires moveend
624
- * @fires zoomend
625
- * @fires pitchend
626
- * @returns {Map} `this`
627
- */
628
- jumpTo(options: CameraOptions, eventData?: Object) {
629
- this.stop();
630
-
631
- const tr = this.transform;
632
- let zoomChanged = false,
633
- bearingChanged = false,
634
- pitchChanged = false;
635
-
636
- if ('zoom' in options && tr.zoom !== +options.zoom) {
637
- zoomChanged = true;
638
- tr.zoom = +options.zoom;
639
- }
640
-
641
- if (options.center !== undefined) {
642
- tr.center = LngLat.convert(options.center);
643
- }
644
-
645
- if ('bearing' in options && tr.bearing !== +options.bearing) {
646
- bearingChanged = true;
647
- tr.bearing = +options.bearing;
648
- }
649
-
650
- if ('pitch' in options && tr.pitch !== +options.pitch) {
651
- pitchChanged = true;
652
- tr.pitch = +options.pitch;
653
- }
654
-
655
- if (options.padding != null && !tr.isPaddingEqual(options.padding)) {
656
- tr.padding = options.padding;
657
- }
658
-
659
- this.fire(new Event('movestart', eventData))
660
- .fire(new Event('move', eventData));
661
-
662
- if (zoomChanged) {
663
- this.fire(new Event('zoomstart', eventData))
664
- .fire(new Event('zoom', eventData))
665
- .fire(new Event('zoomend', eventData));
666
- }
667
-
668
- if (bearingChanged) {
669
- this.fire(new Event('rotatestart', eventData))
670
- .fire(new Event('rotate', eventData))
671
- .fire(new Event('rotateend', eventData));
672
- }
673
-
674
- if (pitchChanged) {
675
- this.fire(new Event('pitchstart', eventData))
676
- .fire(new Event('pitch', eventData))
677
- .fire(new Event('pitchend', eventData));
678
- }
679
-
680
- return this.fire(new Event('moveend', eventData));
681
- }
682
-
683
- /**
684
- * Changes any combination of center, zoom, bearing, pitch, and padding with an animated transition
685
- * between old and new values. The map will retain its current values for any
686
- * details not specified in `options`.
687
- *
688
- * Note: The transition will happen instantly if the user has enabled
689
- * the `reduced motion` accesibility feature enabled in their operating system,
690
- * unless 'options' includes `essential: true`.
691
- *
692
- * @memberof Map#
693
- * @param options Options describing the destination and animation of the transition.
694
- * Accepts {@link CameraOptions} and {@link AnimationOptions}.
695
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
696
- * @fires movestart
697
- * @fires zoomstart
698
- * @fires pitchstart
699
- * @fires rotate
700
- * @fires move
701
- * @fires zoom
702
- * @fires pitch
703
- * @fires moveend
704
- * @fires zoomend
705
- * @fires pitchend
706
- * @returns {Map} `this`
707
- * @see [Navigate the map with game-like controls](https://www.mapbox.com/mapbox-gl-js/example/game-controls/)
708
- */
709
- easeTo(options: CameraOptions & AnimationOptions & {delayEndEvents?: number}, eventData?: Object) {
710
- this.stop();
711
-
712
- options = extend({
713
- offset: [0, 0],
714
- duration: 500,
715
- easing: defaultEasing
716
- }, options);
717
-
718
- if (options.animate === false || (!options.essential && browser.prefersReducedMotion)) options.duration = 0;
719
-
720
- const tr = this.transform,
721
- startZoom = this.getZoom(),
722
- startBearing = this.getBearing(),
723
- startPitch = this.getPitch(),
724
- startPadding = this.getPadding(),
725
-
726
- zoom = 'zoom' in options ? +options.zoom : startZoom,
727
- bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing,
728
- pitch = 'pitch' in options ? +options.pitch : startPitch,
729
- padding = 'padding' in options ? options.padding : tr.padding;
730
-
731
- const offsetAsPoint = Point.convert(options.offset);
732
- let pointAtOffset = tr.centerPoint.add(offsetAsPoint);
733
- const locationAtOffset = tr.pointLocation(pointAtOffset);
734
- const center = LngLat.convert(options.center || locationAtOffset);
735
- this._normalizeCenter(center);
736
-
737
- const from = tr.project(locationAtOffset);
738
- const delta = tr.project(center).sub(from);
739
- const finalScale = tr.zoomScale(zoom - startZoom);
740
-
741
- let around, aroundPoint;
742
-
743
- if (options.around) {
744
- around = LngLat.convert(options.around);
745
- aroundPoint = tr.locationPoint(around);
746
- }
747
-
748
- this._zooming = (zoom !== startZoom);
749
- this._rotating = (startBearing !== bearing);
750
- this._pitching = (pitch !== startPitch);
751
- this._padding = !tr.isPaddingEqual(padding);
752
-
753
- this._prepareEase(eventData, options.noMoveStart);
754
-
755
- clearTimeout(this._easeEndTimeoutID);
756
-
757
- this._ease((k) => {
758
- if (this._zooming) {
759
- tr.zoom = interpolate(startZoom, zoom, k);
760
- }
761
- if (this._rotating) {
762
- tr.bearing = interpolate(startBearing, bearing, k);
763
- }
764
- if (this._pitching) {
765
- tr.pitch = interpolate(startPitch, pitch, k);
766
- }
767
- if (this._padding) {
768
- tr.interpolatePadding(startPadding, padding, k);
769
- // When padding is being applied, Transform#centerPoint is changing continously,
770
- // thus we need to recalculate offsetPoint every fra,e
771
- pointAtOffset = tr.centerPoint.add(offsetAsPoint);
772
- }
773
-
774
- if (around) {
775
- tr.setLocationAtPoint(around, aroundPoint);
776
- } else {
777
- const scale = tr.zoomScale(tr.zoom - startZoom);
778
- const base = zoom > startZoom ?
779
- Math.min(2, finalScale) :
780
- Math.max(0.5, finalScale);
781
- const speedup = Math.pow(base, 1 - k);
782
- const newCenter = tr.unproject(from.add(delta.mult(k * speedup)).mult(scale));
783
- tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);
784
- }
785
-
786
- this._fireMoveEvents(eventData);
787
-
788
- }, () => {
789
- if (options.delayEndEvents) {
790
- this._easeEndTimeoutID = setTimeout(() => this._afterEase(eventData), options.delayEndEvents);
791
- } else {
792
- this._afterEase(eventData);
793
- }
794
- }, options);
795
-
796
- return this;
797
- }
798
-
799
- _prepareEase(eventData?: Object, noMoveStart: boolean) {
800
- this._moving = true;
801
-
802
- if (!noMoveStart) {
803
- this.fire(new Event('movestart', eventData));
804
- }
805
- if (this._zooming) {
806
- this.fire(new Event('zoomstart', eventData));
807
- }
808
- if (this._rotating) {
809
- this.fire(new Event('rotatestart', eventData));
810
- }
811
- if (this._pitching) {
812
- this.fire(new Event('pitchstart', eventData));
813
- }
814
- }
815
-
816
- _fireMoveEvents(eventData?: Object) {
817
- this.fire(new Event('move', eventData));
818
- if (this._zooming) {
819
- this.fire(new Event('zoom', eventData));
820
- }
821
- if (this._rotating) {
822
- this.fire(new Event('rotate', eventData));
823
- }
824
- if (this._pitching) {
825
- this.fire(new Event('pitch', eventData));
826
- }
827
- }
828
-
829
- _afterEase(eventData?: Object) {
830
- const wasZooming = this._zooming;
831
- const wasRotating = this._rotating;
832
- const wasPitching = this._pitching;
833
- this._moving = false;
834
- this._zooming = false;
835
- this._rotating = false;
836
- this._pitching = false;
837
- this._padding = false;
838
-
839
- if (wasZooming) {
840
- this.fire(new Event('zoomend', eventData));
841
- }
842
- if (wasRotating) {
843
- this.fire(new Event('rotateend', eventData));
844
- }
845
- if (wasPitching) {
846
- this.fire(new Event('pitchend', eventData));
847
- }
848
- this.fire(new Event('moveend', eventData));
849
- }
850
-
851
- /**
852
- * Changes any combination of center, zoom, bearing, and pitch, animating the transition along a curve that
853
- * evokes flight. The animation seamlessly incorporates zooming and panning to help
854
- * the user maintain her bearings even after traversing a great distance.
855
- *
856
- * Note: The animation will be skipped, and this will behave equivalently to `jumpTo`
857
- * if the user has the `reduced motion` accesibility feature enabled in their operating system,
858
- * unless 'options' includes `essential: true`.
859
- *
860
- * @memberof Map#
861
- * @param {Object} options Options describing the destination and animation of the transition.
862
- * Accepts {@link CameraOptions}, {@link AnimationOptions},
863
- * and the following additional options.
864
- * @param {number} [options.curve=1.42] The zooming "curve" that will occur along the
865
- * flight path. A high value maximizes zooming for an exaggerated animation, while a low
866
- * value minimizes zooming for an effect closer to {@link Map#easeTo}. 1.42 is the average
867
- * value selected by participants in the user study discussed in
868
- * [van Wijk (2003)](https://www.win.tue.nl/~vanwijk/zoompan.pdf). A value of
869
- * `Math.pow(6, 0.25)` would be equivalent to the root mean squared average velocity. A
870
- * value of 1 would produce a circular motion.
871
- * @param {number} [options.minZoom] The zero-based zoom level at the peak of the flight path. If
872
- * `options.curve` is specified, this option is ignored.
873
- * @param {number} [options.speed=1.2] The average speed of the animation defined in relation to
874
- * `options.curve`. A speed of 1.2 means that the map appears to move along the flight path
875
- * by 1.2 times `options.curve` screenfuls every second. A _screenful_ is the map's visible span.
876
- * It does not correspond to a fixed physical distance, but varies by zoom level.
877
- * @param {number} [options.screenSpeed] The average speed of the animation measured in screenfuls
878
- * per second, assuming a linear timing curve. If `options.speed` is specified, this option is ignored.
879
- * @param {number} [options.maxDuration] The animation's maximum duration, measured in milliseconds.
880
- * If duration exceeds maximum duration, it resets to 0.
881
- * @param eventData Additional properties to be added to event objects of events triggered by this method.
882
- * @fires movestart
883
- * @fires zoomstart
884
- * @fires pitchstart
885
- * @fires move
886
- * @fires zoom
887
- * @fires rotate
888
- * @fires pitch
889
- * @fires moveend
890
- * @fires zoomend
891
- * @fires pitchend
892
- * @returns {Map} `this`
893
- * @example
894
- * // fly with default options to null island
895
- * map.flyTo({center: [0, 0], zoom: 9});
896
- * // using flyTo options
897
- * map.flyTo({
898
- * center: [0, 0],
899
- * zoom: 9,
900
- * speed: 0.2,
901
- * curve: 1,
902
- * easing(t) {
903
- * return t;
904
- * }
905
- * });
906
- * @see [Fly to a location](https://www.mapbox.com/mapbox-gl-js/example/flyto/)
907
- * @see [Slowly fly to a location](https://www.mapbox.com/mapbox-gl-js/example/flyto-options/)
908
- * @see [Fly to a location based on scroll position](https://www.mapbox.com/mapbox-gl-js/example/scroll-fly-to/)
909
- */
910
- flyTo(options: Object, eventData?: Object) {
911
- // Fall through to jumpTo if user has set prefers-reduced-motion
912
- if (!options.essential && browser.prefersReducedMotion) {
913
- const coercedOptions = (pick(options, ['center', 'zoom', 'bearing', 'pitch', 'around']): CameraOptions);
914
- return this.jumpTo(coercedOptions, eventData);
915
- }
916
-
917
- // This method implements an “optimal path” animation, as detailed in:
918
- //
919
- // Van Wijk, Jarke J.; Nuij, Wim A. A. “Smooth and efficient zooming and panning.” INFOVIS
920
- // ’03. pp. 15–22. <https://www.win.tue.nl/~vanwijk/zoompan.pdf#page=5>.
921
- //
922
- // Where applicable, local variable documentation begins with the associated variable or
923
- // function in van Wijk (2003).
924
-
925
- this.stop();
926
-
927
- options = extend({
928
- offset: [0, 0],
929
- speed: 1.2,
930
- curve: 1.42,
931
- easing: defaultEasing
932
- }, options);
933
-
934
- const tr = this.transform,
935
- startZoom = this.getZoom(),
936
- startBearing = this.getBearing(),
937
- startPitch = this.getPitch(),
938
- startPadding = this.getPadding();
939
-
940
- const zoom = 'zoom' in options ? clamp(+options.zoom, tr.minZoom, tr.maxZoom) : startZoom;
941
- const bearing = 'bearing' in options ? this._normalizeBearing(options.bearing, startBearing) : startBearing;
942
- const pitch = 'pitch' in options ? +options.pitch : startPitch;
943
- const padding = 'padding' in options ? options.padding : tr.padding;
944
-
945
- const scale = tr.zoomScale(zoom - startZoom);
946
- const offsetAsPoint = Point.convert(options.offset);
947
- let pointAtOffset = tr.centerPoint.add(offsetAsPoint);
948
- const locationAtOffset = tr.pointLocation(pointAtOffset);
949
- if (options.center && options.center.length >= 2) {
950
- if (options.center[0] == 0) {
951
- options.center[0] = 0.000001;
952
- }
953
- if (options.center[1] == 0) {
954
- options.center[1] = 0.000001;
955
- }
956
- }
957
- const center = LngLat.convert(options.center || locationAtOffset);
958
- this._normalizeCenter(center);
959
-
960
- const from = tr.project(locationAtOffset);
961
- const delta = tr.project(center).sub(from);
962
-
963
- let rho = options.curve;
964
-
965
- // w₀: Initial visible span, measured in pixels at the initial scale.
966
- const w0 = Math.max(tr.width, tr.height),
967
- // w₁: Final visible span, measured in pixels with respect to the initial scale.
968
- w1 = w0 / scale,
969
- // Length of the flight path as projected onto the ground plane, measured in pixels from
970
- // the world image origin at the initial scale.
971
- u1 = delta.mag();
972
-
973
- if ('minZoom' in options) {
974
- const minZoom = clamp(Math.min(options.minZoom, startZoom, zoom), tr.minZoom, tr.maxZoom);
975
- // w<sub>m</sub>: Maximum visible span, measured in pixels with respect to the initial
976
- // scale.
977
- const wMax = w0 / tr.zoomScale(minZoom - startZoom);
978
- rho = Math.sqrt(wMax / u1 * 2);
979
- }
980
-
981
- // ρ²
982
- const rho2 = rho * rho;
983
-
984
- /**
985
- * rᵢ: Returns the zoom-out factor at one end of the animation.
986
- *
987
- * @param i 0 for the ascent or 1 for the descent.
988
- * @private
989
- */
990
- function r(i) {
991
- const b = (w1 * w1 - w0 * w0 + (i ? -1 : 1) * rho2 * rho2 * u1 * u1) / (2 * (i ? w1 : w0) * rho2 * u1);
992
- return Math.log(Math.sqrt(b * b + 1) - b);
993
- }
994
-
995
- function sinh(n) { return (Math.exp(n) - Math.exp(-n)) / 2; }
996
- function cosh(n) { return (Math.exp(n) + Math.exp(-n)) / 2; }
997
- function tanh(n) { return sinh(n) / cosh(n); }
998
-
999
- // r₀: Zoom-out factor during ascent.
1000
- const r0 = r(0);
1001
-
1002
- // w(s): Returns the visible span on the ground, measured in pixels with respect to the
1003
- // initial scale. Assumes an angular field of view of 2 arctan ½ ≈ 53°.
1004
- let w: (_: number) => number = function (s) {
1005
- return (cosh(r0) / cosh(r0 + rho * s));
1006
- };
1007
-
1008
- // u(s): Returns the distance along the flight path as projected onto the ground plane,
1009
- // measured in pixels from the world image origin at the initial scale.
1010
- let u: (_: number) => number = function (s) {
1011
- return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1;
1012
- };
1013
-
1014
- // S: Total length of the flight path, measured in ρ-screenfuls.
1015
- let S = (r(1) - r0) / rho;
1016
-
1017
- // When u₀ = u₁, the optimal path doesn’t require both ascent and descent.
1018
- if (Math.abs(u1) < 0.000001 || !isFinite(S)) {
1019
- // Perform a more or less instantaneous transition if the path is too short.
1020
- if (Math.abs(w0 - w1) < 0.000001) return this.easeTo(options, eventData);
1021
-
1022
- const k = w1 < w0 ? -1 : 1;
1023
- S = Math.abs(Math.log(w1 / w0)) / rho;
1024
-
1025
- u = function() { return 0; };
1026
- w = function(s) { return Math.exp(k * rho * s); };
1027
- }
1028
-
1029
- if ('duration' in options) {
1030
- options.duration = +options.duration;
1031
- } else {
1032
- const V = 'screenSpeed' in options ? +options.screenSpeed / rho : +options.speed;
1033
- options.duration = 1000 * S / V;
1034
- }
1035
-
1036
- if (options.maxDuration && options.duration > options.maxDuration) {
1037
- options.duration = 0;
1038
- }
1039
-
1040
- this._zooming = true;
1041
- this._rotating = (startBearing !== bearing);
1042
- this._pitching = (pitch !== startPitch);
1043
- this._padding = !tr.isPaddingEqual(padding);
1044
-
1045
- this._prepareEase(eventData, false);
1046
-
1047
- this._ease((k) => {
1048
- // s: The distance traveled along the flight path, measured in ρ-screenfuls.
1049
- const s = k * S;
1050
- const scale = 1 / w(s);
1051
- tr.zoom = k === 1 ? zoom : startZoom + tr.scaleZoom(scale);
1052
-
1053
- if (this._rotating) {
1054
- tr.bearing = interpolate(startBearing, bearing, k);
1055
- }
1056
- if (this._pitching) {
1057
- tr.pitch = interpolate(startPitch, pitch, k);
1058
- }
1059
- if (this._padding) {
1060
- tr.interpolatePadding(startPadding, padding, k);
1061
- // When padding is being applied, Transform#centerPoint is changing continously,
1062
- // thus we need to recalculate offsetPoint every frame
1063
- pointAtOffset = tr.centerPoint.add(offsetAsPoint);
1064
- }
1065
-
1066
- const newCenter = k === 1 ? center : tr.unproject(from.add(delta.mult(u(s))).mult(scale));
1067
- tr.setLocationAtPoint(tr.renderWorldCopies ? newCenter.wrap() : newCenter, pointAtOffset);
1068
-
1069
- this._fireMoveEvents(eventData);
1070
-
1071
- }, () => this._afterEase(eventData), options);
1072
-
1073
- return this;
1074
- }
1075
-
1076
- isEasing() {
1077
- return !!this._easeFrameId;
1078
- }
1079
-
1080
- /**
1081
- * Stops any animated transition underway.
1082
- *
1083
- * @memberof Map#
1084
- * @returns {Map} `this`
1085
- */
1086
- stop(): this {
1087
- if (this._easeFrameId) {
1088
- this._cancelRenderFrame(this._easeFrameId);
1089
- delete this._easeFrameId;
1090
- delete this._onEaseFrame;
1091
- }
1092
-
1093
- if (this._onEaseEnd) {
1094
- // The _onEaseEnd function might emit events which trigger new
1095
- // animation, which sets a new _onEaseEnd. Ensure we don't delete
1096
- // it unintentionally.
1097
- const onEaseEnd = this._onEaseEnd;
1098
- delete this._onEaseEnd;
1099
- onEaseEnd.call(this);
1100
- }
1101
- return this;
1102
- }
1103
-
1104
- _ease(frame: (_: number) => void,
1105
- finish: () => void,
1106
- options: {animate: boolean, duration: number, easing: (_: number) => number}) {
1107
- if (options.animate === false || options.duration === 0) {
1108
- frame(1);
1109
- finish();
1110
- } else {
1111
- this._easeStart = browser.now();
1112
- this._easeOptions = options;
1113
- this._onEaseFrame = frame;
1114
- this._onEaseEnd = finish;
1115
- this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback);
1116
- }
1117
- }
1118
-
1119
- // Callback for map._requestRenderFrame
1120
- _renderFrameCallback() {
1121
- const t = Math.min((browser.now() - this._easeStart) / this._easeOptions.duration, 1);
1122
- this._onEaseFrame(this._easeOptions.easing(t));
1123
- if (t < 1) {
1124
- this._easeFrameId = this._requestRenderFrame(this._renderFrameCallback);
1125
- } else {
1126
- this.stop();
1127
- }
1128
- }
1129
-
1130
- // convert bearing so that it's numerically close to the current one so that it interpolates properly
1131
- _normalizeBearing(bearing: number, currentBearing: number) {
1132
- bearing = wrap(bearing, -180, 180);
1133
- const diff = Math.abs(bearing - currentBearing);
1134
- if (Math.abs(bearing - 360 - currentBearing) < diff) bearing -= 360;
1135
- if (Math.abs(bearing + 360 - currentBearing) < diff) bearing += 360;
1136
- return bearing;
1137
- }
1138
-
1139
- // If a path crossing the antimeridian would be shorter, extend the final coordinate so that
1140
- // interpolating between the two endpoints will cross it.
1141
- _normalizeCenter(center: LngLat) {
1142
- const tr = this.transform;
1143
- if (!tr.renderWorldCopies || tr.lngRange) return;
1144
-
1145
- const delta = center.lng - tr.center.lng;
1146
- center.lng +=
1147
- delta > 180 ? -360 :
1148
- delta < -180 ? 360 : 0;
1149
- }
1150
- }
1151
-
1152
- export default Camera;