mapbox-gl 1.13.2
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.
- package/.flowconfig +61 -0
- package/CHANGELOG.md +2485 -0
- package/LICENSE.txt +84 -0
- package/README.md +34 -0
- package/build/banner.js +4 -0
- package/build/check-bundle-size.js +140 -0
- package/build/diff-tarball.js +18 -0
- package/build/generate-access-token-script.js +11 -0
- package/build/generate-flow-typed-style-spec.js +188 -0
- package/build/generate-release-list.js +21 -0
- package/build/generate-struct-arrays.js +243 -0
- package/build/generate-style-code.js +159 -0
- package/build/mapbox-gl.js.flow +3 -0
- package/build/print-release-url.js +6 -0
- package/build/rollup_plugin_minify_style_spec.js +24 -0
- package/build/rollup_plugins.js +80 -0
- package/build/run-node +3 -0
- package/build/run-tap +8 -0
- package/build/test/build-tape.js +19 -0
- package/dist/mapbox-gl-csp-worker.js +2 -0
- package/dist/mapbox-gl-csp-worker.js.map +1 -0
- package/dist/mapbox-gl-csp.js +2 -0
- package/dist/mapbox-gl-csp.js.map +1 -0
- package/dist/mapbox-gl-dev.js +65889 -0
- package/dist/mapbox-gl-dev.js.flow +3 -0
- package/dist/mapbox-gl-unminified.js +42889 -0
- package/dist/mapbox-gl-unminified.js.map +1 -0
- package/dist/mapbox-gl.css +1 -0
- package/dist/mapbox-gl.js +42 -0
- package/dist/mapbox-gl.js.flow +3 -0
- package/dist/mapbox-gl.js.map +1 -0
- package/dist/style-spec/index.es.js +15032 -0
- package/dist/style-spec/index.es.js.map +1 -0
- package/dist/style-spec/index.js +15058 -0
- package/dist/style-spec/index.js.map +1 -0
- package/flow-typed/gl.js +5 -0
- package/flow-typed/jsdom.js +18 -0
- package/flow-typed/mapbox-gl-supported.js +9 -0
- package/flow-typed/mapbox-unitbezier.js +14 -0
- package/flow-typed/offscreen-canvas.js +9 -0
- package/flow-typed/pbf.js +25 -0
- package/flow-typed/point-geometry.js +44 -0
- package/flow-typed/potpack.js +12 -0
- package/flow-typed/sinon.js +28 -0
- package/flow-typed/vector-tile.js +41 -0
- package/package.json +173 -0
- package/src/css/mapbox-gl.css +812 -0
- package/src/css/svg/mapboxgl-ctrl-attrib.svg +3 -0
- package/src/css/svg/mapboxgl-ctrl-compass.svg +4 -0
- package/src/css/svg/mapboxgl-ctrl-fullscreen.svg +3 -0
- package/src/css/svg/mapboxgl-ctrl-geolocate.svg +5 -0
- package/src/css/svg/mapboxgl-ctrl-logo.svg +20 -0
- package/src/css/svg/mapboxgl-ctrl-shrink.svg +3 -0
- package/src/css/svg/mapboxgl-ctrl-zoom-in.svg +3 -0
- package/src/css/svg/mapboxgl-ctrl-zoom-out.svg +3 -0
- package/src/data/array_types.js +1135 -0
- package/src/data/bucket/circle_attributes.js +9 -0
- package/src/data/bucket/circle_bucket.js +201 -0
- package/src/data/bucket/fill_attributes.js +9 -0
- package/src/data/bucket/fill_bucket.js +229 -0
- package/src/data/bucket/fill_extrusion_attributes.js +10 -0
- package/src/data/bucket/fill_extrusion_bucket.js +283 -0
- package/src/data/bucket/heatmap_bucket.js +17 -0
- package/src/data/bucket/line_attributes.js +10 -0
- package/src/data/bucket/line_attributes_ext.js +10 -0
- package/src/data/bucket/line_bucket.js +594 -0
- package/src/data/bucket/pattern_attributes.js +12 -0
- package/src/data/bucket/pattern_bucket_features.js +60 -0
- package/src/data/bucket/symbol_attributes.js +117 -0
- package/src/data/bucket/symbol_bucket.js +937 -0
- package/src/data/bucket.js +123 -0
- package/src/data/dem_data.js +125 -0
- package/src/data/evaluation_feature.js +25 -0
- package/src/data/extent.js +18 -0
- package/src/data/feature_index.js +322 -0
- package/src/data/feature_position_map.js +131 -0
- package/src/data/index_array_type.js +16 -0
- package/src/data/load_geometry.js +46 -0
- package/src/data/pos_attributes.js +6 -0
- package/src/data/program_configuration.js +708 -0
- package/src/data/raster_bounds_attributes.js +7 -0
- package/src/data/segment.js +76 -0
- package/src/geo/edge_insets.js +102 -0
- package/src/geo/lng_lat.js +168 -0
- package/src/geo/lng_lat_bounds.js +276 -0
- package/src/geo/mercator_coordinate.js +150 -0
- package/src/geo/transform.js +834 -0
- package/src/gl/color_mode.js +34 -0
- package/src/gl/context.js +302 -0
- package/src/gl/cull_face_mode.js +26 -0
- package/src/gl/depth_mode.js +29 -0
- package/src/gl/framebuffer.js +44 -0
- package/src/gl/index_buffer.js +55 -0
- package/src/gl/stencil_mode.js +30 -0
- package/src/gl/types.js +84 -0
- package/src/gl/value.js +520 -0
- package/src/gl/vertex_buffer.js +119 -0
- package/src/index.js +230 -0
- package/src/render/draw_background.js +57 -0
- package/src/render/draw_circle.js +113 -0
- package/src/render/draw_collision_debug.js +172 -0
- package/src/render/draw_custom.js +49 -0
- package/src/render/draw_debug.js +127 -0
- package/src/render/draw_fill.js +124 -0
- package/src/render/draw_fill_extrusion.js +95 -0
- package/src/render/draw_heatmap.js +133 -0
- package/src/render/draw_hillshade.js +107 -0
- package/src/render/draw_line.js +125 -0
- package/src/render/draw_raster.js +125 -0
- package/src/render/draw_symbol.js +392 -0
- package/src/render/glyph_atlas.js +71 -0
- package/src/render/glyph_manager.js +182 -0
- package/src/render/image_atlas.js +149 -0
- package/src/render/image_manager.js +306 -0
- package/src/render/line_atlas.js +210 -0
- package/src/render/painter.js +654 -0
- package/src/render/program/background_program.js +103 -0
- package/src/render/program/circle_program.js +69 -0
- package/src/render/program/clipping_mask_program.js +20 -0
- package/src/render/program/collision_program.js +76 -0
- package/src/render/program/debug_program.js +35 -0
- package/src/render/program/fill_extrusion_program.js +122 -0
- package/src/render/program/fill_program.js +126 -0
- package/src/render/program/heatmap_program.js +83 -0
- package/src/render/program/hillshade_program.js +119 -0
- package/src/render/program/line_program.js +211 -0
- package/src/render/program/pattern.js +102 -0
- package/src/render/program/program_uniforms.js +42 -0
- package/src/render/program/raster_program.js +92 -0
- package/src/render/program/symbol_program.js +224 -0
- package/src/render/program.js +188 -0
- package/src/render/texture.js +122 -0
- package/src/render/uniform_binding.js +147 -0
- package/src/render/vertex_array_object.js +163 -0
- package/src/shaders/README.md +42 -0
- package/src/shaders/_prelude.fragment.glsl +17 -0
- package/src/shaders/_prelude.vertex.glsl +73 -0
- package/src/shaders/background.fragment.glsl +10 -0
- package/src/shaders/background.vertex.glsl +7 -0
- package/src/shaders/background_pattern.fragment.glsl +28 -0
- package/src/shaders/background_pattern.vertex.glsl +20 -0
- package/src/shaders/circle.fragment.glsl +39 -0
- package/src/shaders/circle.vertex.glsl +64 -0
- package/src/shaders/clipping_mask.fragment.glsl +3 -0
- package/src/shaders/clipping_mask.vertex.glsl +7 -0
- package/src/shaders/collision_box.fragment.glsl +21 -0
- package/src/shaders/collision_box.vertex.glsl +27 -0
- package/src/shaders/collision_circle.fragment.glsl +17 -0
- package/src/shaders/collision_circle.vertex.glsl +59 -0
- package/src/shaders/debug.fragment.glsl +9 -0
- package/src/shaders/debug.vertex.glsl +12 -0
- package/src/shaders/encode_attribute.js +17 -0
- package/src/shaders/fill.fragment.glsl +13 -0
- package/src/shaders/fill.vertex.glsl +13 -0
- package/src/shaders/fill_extrusion.fragment.glsl +9 -0
- package/src/shaders/fill_extrusion.vertex.glsl +66 -0
- package/src/shaders/fill_extrusion_pattern.fragment.glsl +45 -0
- package/src/shaders/fill_extrusion_pattern.vertex.glsl +79 -0
- package/src/shaders/fill_outline.fragment.glsl +17 -0
- package/src/shaders/fill_outline.vertex.glsl +17 -0
- package/src/shaders/fill_outline_pattern.fragment.glsl +43 -0
- package/src/shaders/fill_outline_pattern.vertex.glsl +44 -0
- package/src/shaders/fill_pattern.fragment.glsl +36 -0
- package/src/shaders/fill_pattern.vertex.glsl +39 -0
- package/src/shaders/heatmap.fragment.glsl +22 -0
- package/src/shaders/heatmap.vertex.glsl +54 -0
- package/src/shaders/heatmap_texture.fragment.glsl +14 -0
- package/src/shaders/heatmap_texture.vertex.glsl +11 -0
- package/src/shaders/hillshade.fragment.glsl +52 -0
- package/src/shaders/hillshade.vertex.glsl +11 -0
- package/src/shaders/hillshade_prepare.fragment.glsl +75 -0
- package/src/shaders/hillshade_prepare.vertex.glsl +15 -0
- package/src/shaders/index.js +20 -0
- package/src/shaders/line.fragment.glsl +30 -0
- package/src/shaders/line.vertex.glsl +85 -0
- package/src/shaders/line_gradient.fragment.glsl +34 -0
- package/src/shaders/line_gradient.vertex.glsl +88 -0
- package/src/shaders/line_pattern.fragment.glsl +74 -0
- package/src/shaders/line_pattern.vertex.glsl +99 -0
- package/src/shaders/line_sdf.fragment.glsl +45 -0
- package/src/shaders/line_sdf.vertex.glsl +98 -0
- package/src/shaders/raster.fragment.glsl +52 -0
- package/src/shaders/raster.vertex.glsl +21 -0
- package/src/shaders/shaders.js +185 -0
- package/src/shaders/symbol_icon.fragment.glsl +17 -0
- package/src/shaders/symbol_icon.vertex.glsl +94 -0
- package/src/shaders/symbol_sdf.fragment.glsl +52 -0
- package/src/shaders/symbol_sdf.vertex.glsl +115 -0
- package/src/shaders/symbol_text_and_icon.fragment.glsl +68 -0
- package/src/shaders/symbol_text_and_icon.vertex.glsl +116 -0
- package/src/source/canvas_source.js +238 -0
- package/src/source/geojson_source.js +370 -0
- package/src/source/geojson_worker_source.js +366 -0
- package/src/source/geojson_wrapper.js +94 -0
- package/src/source/image_source.js +307 -0
- package/src/source/load_tilejson.js +39 -0
- package/src/source/pixels_to_tile_units.js +21 -0
- package/src/source/query_features.js +208 -0
- package/src/source/raster_dem_tile_source.js +138 -0
- package/src/source/raster_dem_tile_worker_source.js +62 -0
- package/src/source/raster_tile_source.js +169 -0
- package/src/source/rtl_text_plugin.js +143 -0
- package/src/source/source.js +137 -0
- package/src/source/source_cache.js +953 -0
- package/src/source/source_state.js +159 -0
- package/src/source/tile.js +458 -0
- package/src/source/tile_bounds.js +38 -0
- package/src/source/tile_cache.js +212 -0
- package/src/source/tile_id.js +199 -0
- package/src/source/vector_tile_source.js +259 -0
- package/src/source/vector_tile_worker_source.js +216 -0
- package/src/source/video_source.js +203 -0
- package/src/source/worker.js +240 -0
- package/src/source/worker_source.js +107 -0
- package/src/source/worker_tile.js +224 -0
- package/src/style/create_style_layer.js +36 -0
- package/src/style/evaluation_parameters.js +62 -0
- package/src/style/format_section_override.js +56 -0
- package/src/style/light.js +130 -0
- package/src/style/load_glyph_range.js +38 -0
- package/src/style/load_sprite.js +67 -0
- package/src/style/parse_glyph_pbf.js +44 -0
- package/src/style/pauseable_placement.js +132 -0
- package/src/style/properties.js +753 -0
- package/src/style/query_utils.js +43 -0
- package/src/style/style.js +1374 -0
- package/src/style/style_glyph.js +17 -0
- package/src/style/style_image.js +137 -0
- package/src/style/style_layer/background_style_layer.js +21 -0
- package/src/style/style_layer/background_style_layer_properties.js +40 -0
- package/src/style/style_layer/circle_style_layer.js +98 -0
- package/src/style/style_layer/circle_style_layer_properties.js +63 -0
- package/src/style/style_layer/custom_style_layer.js +223 -0
- package/src/style/style_layer/fill_extrusion_style_layer.js +224 -0
- package/src/style/style_layer/fill_extrusion_style_layer_properties.js +50 -0
- package/src/style/style_layer/fill_style_layer.js +67 -0
- package/src/style/style_layer/fill_style_layer_properties.js +55 -0
- package/src/style/style_layer/heatmap_style_layer.js +73 -0
- package/src/style/style_layer/heatmap_style_layer_properties.js +44 -0
- package/src/style/style_layer/hillshade_style_layer.js +25 -0
- package/src/style/style_layer/hillshade_style_layer_properties.js +46 -0
- package/src/style/style_layer/layer_properties.js.ejs +69 -0
- package/src/style/style_layer/line_style_layer.js +150 -0
- package/src/style/style_layer/line_style_layer_properties.js +71 -0
- package/src/style/style_layer/raster_style_layer.js +21 -0
- package/src/style/style_layer/raster_style_layer_properties.js +50 -0
- package/src/style/style_layer/symbol_style_layer.js +190 -0
- package/src/style/style_layer/symbol_style_layer_properties.js +153 -0
- package/src/style/style_layer/typed_style_layer.js +17 -0
- package/src/style/style_layer.js +283 -0
- package/src/style/style_layer_index.js +80 -0
- package/src/style/validate_style.js +42 -0
- package/src/style/zoom_history.js +44 -0
- package/src/style-spec/.eslintrc +5 -0
- package/src/style-spec/CHANGELOG.md +468 -0
- package/src/style-spec/README.md +59 -0
- package/src/style-spec/bin/gl-style-composite +9 -0
- package/src/style-spec/bin/gl-style-format +22 -0
- package/src/style-spec/bin/gl-style-migrate +9 -0
- package/src/style-spec/bin/gl-style-validate +50 -0
- package/src/style-spec/composite.js +50 -0
- package/src/style-spec/declass.js +42 -0
- package/src/style-spec/deref.js +52 -0
- package/src/style-spec/diff.js +393 -0
- package/src/style-spec/dist/.gitkeep +0 -0
- package/src/style-spec/dist/index.es.js +15032 -0
- package/src/style-spec/dist/index.es.js.map +1 -0
- package/src/style-spec/dist/index.js +15058 -0
- package/src/style-spec/dist/index.js.map +1 -0
- package/src/style-spec/empty.js +29 -0
- package/src/style-spec/error/parsing_error.js +16 -0
- package/src/style-spec/error/validation_error.js +18 -0
- package/src/style-spec/expression/compound_expression.js +162 -0
- package/src/style-spec/expression/definitions/assertion.js +130 -0
- package/src/style-spec/expression/definitions/at.js +70 -0
- package/src/style-spec/expression/definitions/case.js +85 -0
- package/src/style-spec/expression/definitions/coalesce.js +93 -0
- package/src/style-spec/expression/definitions/coercion.js +133 -0
- package/src/style-spec/expression/definitions/collator.js +78 -0
- package/src/style-spec/expression/definitions/comparison.js +184 -0
- package/src/style-spec/expression/definitions/format.js +144 -0
- package/src/style-spec/expression/definitions/image.js +52 -0
- package/src/style-spec/expression/definitions/in.js +72 -0
- package/src/style-spec/expression/definitions/index.js +565 -0
- package/src/style-spec/expression/definitions/index_of.js +89 -0
- package/src/style-spec/expression/definitions/interpolate.js +267 -0
- package/src/style-spec/expression/definitions/length.js +61 -0
- package/src/style-spec/expression/definitions/let.js +72 -0
- package/src/style-spec/expression/definitions/literal.js +77 -0
- package/src/style-spec/expression/definitions/match.js +158 -0
- package/src/style-spec/expression/definitions/number_format.js +142 -0
- package/src/style-spec/expression/definitions/slice.js +86 -0
- package/src/style-spec/expression/definitions/step.js +120 -0
- package/src/style-spec/expression/definitions/var.js +46 -0
- package/src/style-spec/expression/definitions/within.js +342 -0
- package/src/style-spec/expression/evaluation_context.js +59 -0
- package/src/style-spec/expression/expression.js +27 -0
- package/src/style-spec/expression/index.js +392 -0
- package/src/style-spec/expression/is_constant.js +59 -0
- package/src/style-spec/expression/parsing_context.js +233 -0
- package/src/style-spec/expression/parsing_error.js +13 -0
- package/src/style-spec/expression/runtime_error.js +17 -0
- package/src/style-spec/expression/scope.js +36 -0
- package/src/style-spec/expression/stops.js +39 -0
- package/src/style-spec/expression/types/collator.js +61 -0
- package/src/style-spec/expression/types/formatted.js +73 -0
- package/src/style-spec/expression/types/resolved_image.js +29 -0
- package/src/style-spec/expression/types.js +126 -0
- package/src/style-spec/expression/values.js +123 -0
- package/src/style-spec/feature_filter/README.md +55 -0
- package/src/style-spec/feature_filter/convert.js +208 -0
- package/src/style-spec/feature_filter/index.js +175 -0
- package/src/style-spec/format.js +51 -0
- package/src/style-spec/function/convert.js +270 -0
- package/src/style-spec/function/index.js +262 -0
- package/src/style-spec/group_by_layout.js +75 -0
- package/src/style-spec/migrate/expressions.js +39 -0
- package/src/style-spec/migrate/v8.js +203 -0
- package/src/style-spec/migrate/v9.js +26 -0
- package/src/style-spec/migrate.js +36 -0
- package/src/style-spec/package.json +41 -0
- package/src/style-spec/read_style.js +14 -0
- package/src/style-spec/reference/latest.js +3 -0
- package/src/style-spec/reference/v8.json +5914 -0
- package/src/style-spec/rollup.config.js +65 -0
- package/src/style-spec/style-spec.js +124 -0
- package/src/style-spec/types.js +432 -0
- package/src/style-spec/util/color.js +95 -0
- package/src/style-spec/util/color_spaces.js +139 -0
- package/src/style-spec/util/deep_equal.js +28 -0
- package/src/style-spec/util/extend.js +10 -0
- package/src/style-spec/util/get_type.js +17 -0
- package/src/style-spec/util/interpolate.js +22 -0
- package/src/style-spec/util/properties.js +15 -0
- package/src/style-spec/util/ref_properties.js +2 -0
- package/src/style-spec/util/result.js +19 -0
- package/src/style-spec/util/unbundle_jsonlint.js +24 -0
- package/src/style-spec/validate/latest.js +11 -0
- package/src/style-spec/validate/validate.js +75 -0
- package/src/style-spec/validate/validate_array.js +52 -0
- package/src/style-spec/validate/validate_boolean.js +15 -0
- package/src/style-spec/validate/validate_color.js +20 -0
- package/src/style-spec/validate/validate_constants.js +13 -0
- package/src/style-spec/validate/validate_enum.js +21 -0
- package/src/style-spec/validate/validate_expression.js +43 -0
- package/src/style-spec/validate/validate_filter.js +117 -0
- package/src/style-spec/validate/validate_formatted.js +11 -0
- package/src/style-spec/validate/validate_function.js +207 -0
- package/src/style-spec/validate/validate_glyphs_url.js +21 -0
- package/src/style-spec/validate/validate_image.js +11 -0
- package/src/style-spec/validate/validate_layer.js +134 -0
- package/src/style-spec/validate/validate_layout_property.js +6 -0
- package/src/style-spec/validate/validate_light.js +47 -0
- package/src/style-spec/validate/validate_number.js +29 -0
- package/src/style-spec/validate/validate_object.js +61 -0
- package/src/style-spec/validate/validate_paint_property.js +6 -0
- package/src/style-spec/validate/validate_property.js +64 -0
- package/src/style-spec/validate/validate_source.js +111 -0
- package/src/style-spec/validate/validate_string.js +15 -0
- package/src/style-spec/validate_mapbox_api_supported.js +171 -0
- package/src/style-spec/validate_style.js +39 -0
- package/src/style-spec/validate_style.min.js +78 -0
- package/src/style-spec/visit.js +77 -0
- package/src/symbol/anchor.js +26 -0
- package/src/symbol/check_max_angle.js +81 -0
- package/src/symbol/clip_line.js +71 -0
- package/src/symbol/collision_feature.js +109 -0
- package/src/symbol/collision_index.js +373 -0
- package/src/symbol/cross_tile_symbol_index.js +301 -0
- package/src/symbol/get_anchors.js +167 -0
- package/src/symbol/grid_index.js +335 -0
- package/src/symbol/mergelines.js +82 -0
- package/src/symbol/one_em.js +4 -0
- package/src/symbol/opacity_state.js +27 -0
- package/src/symbol/path_interpolator.js +61 -0
- package/src/symbol/placement.js +1124 -0
- package/src/symbol/projection.js +451 -0
- package/src/symbol/quads.js +334 -0
- package/src/symbol/shaping.js +816 -0
- package/src/symbol/symbol_layout.js +796 -0
- package/src/symbol/symbol_size.js +113 -0
- package/src/symbol/transform_text.js +29 -0
- package/src/types/callback.js +17 -0
- package/src/types/cancelable.js +3 -0
- package/src/types/tilejson.js +17 -0
- package/src/types/transferable.js +3 -0
- package/src/types/window.js +172 -0
- package/src/ui/anchor.js +32 -0
- package/src/ui/camera.js +1277 -0
- package/src/ui/control/attribution_control.js +212 -0
- package/src/ui/control/fullscreen_control.js +147 -0
- package/src/ui/control/geolocate_control.js +707 -0
- package/src/ui/control/logo_control.js +92 -0
- package/src/ui/control/navigation_control.js +257 -0
- package/src/ui/control/scale_control.js +142 -0
- package/src/ui/default_locale.js +22 -0
- package/src/ui/events.js +1301 -0
- package/src/ui/handler/box_zoom.js +170 -0
- package/src/ui/handler/click_zoom.js +52 -0
- package/src/ui/handler/handler_util.js +12 -0
- package/src/ui/handler/keyboard.js +208 -0
- package/src/ui/handler/map_event.js +156 -0
- package/src/ui/handler/mouse.js +171 -0
- package/src/ui/handler/scroll_zoom.js +350 -0
- package/src/ui/handler/shim/dblclick_zoom.js +62 -0
- package/src/ui/handler/shim/drag_pan.js +88 -0
- package/src/ui/handler/shim/drag_rotate.js +67 -0
- package/src/ui/handler/shim/touch_zoom_rotate.js +108 -0
- package/src/ui/handler/tap_drag_zoom.js +103 -0
- package/src/ui/handler/tap_recognizer.js +133 -0
- package/src/ui/handler/tap_zoom.js +93 -0
- package/src/ui/handler/touch_pan.js +101 -0
- package/src/ui/handler/touch_zoom_rotate.js +305 -0
- package/src/ui/handler_inertia.js +158 -0
- package/src/ui/handler_manager.js +531 -0
- package/src/ui/hash.js +148 -0
- package/src/ui/map.js +2874 -0
- package/src/ui/marker.js +672 -0
- package/src/ui/popup.js +640 -0
- package/src/util/actor.js +212 -0
- package/src/util/ajax.js +388 -0
- package/src/util/browser/web_worker.js +10 -0
- package/src/util/browser/window.js +6 -0
- package/src/util/browser.js +70 -0
- package/src/util/classify_rings.js +52 -0
- package/src/util/color_ramp.js +61 -0
- package/src/util/config.js +30 -0
- package/src/util/debug.js +28 -0
- package/src/util/dictionary_coder.js +30 -0
- package/src/util/dispatcher.js +70 -0
- package/src/util/dom.js +142 -0
- package/src/util/evented.js +174 -0
- package/src/util/find_pole_of_inaccessibility.js +129 -0
- package/src/util/global_worker_pool.js +35 -0
- package/src/util/image.js +142 -0
- package/src/util/intersection_tests.js +208 -0
- package/src/util/is_char_in_unicode_block.js +311 -0
- package/src/util/mapbox.js +491 -0
- package/src/util/offscreen_canvas_supported.js +14 -0
- package/src/util/performance.js +112 -0
- package/src/util/primitives.js +145 -0
- package/src/util/resolve_tokens.js +16 -0
- package/src/util/script_detection.js +328 -0
- package/src/util/sku_token.js +42 -0
- package/src/util/smart_wrap.js +55 -0
- package/src/util/struct_array.js +243 -0
- package/src/util/struct_array.js.ejs +112 -0
- package/src/util/struct_array_layout.js.ejs +98 -0
- package/src/util/task_queue.js +68 -0
- package/src/util/throttle.js +27 -0
- package/src/util/throttled_invoker.js +46 -0
- package/src/util/tile_request_cache.js +172 -0
- package/src/util/util.js +524 -0
- package/src/util/vectortile_to_geojson.js +50 -0
- package/src/util/verticalize_punctuation.js +114 -0
- package/src/util/web_worker.js +91 -0
- package/src/util/web_worker_transfer.js +266 -0
- package/src/util/webp_supported.js +69 -0
- package/src/util/window.js +102 -0
- package/src/util/worker_pool.js +57 -0
package/src/ui/events.js
ADDED
|
@@ -0,0 +1,1301 @@
|
|
|
1
|
+
// @flow
|
|
2
|
+
|
|
3
|
+
import {Event} from '../util/evented';
|
|
4
|
+
|
|
5
|
+
import DOM from '../util/dom';
|
|
6
|
+
import Point from '@mapbox/point-geometry';
|
|
7
|
+
import {extend} from '../util/util';
|
|
8
|
+
|
|
9
|
+
import type Map from './map';
|
|
10
|
+
import type LngLat from '../geo/lng_lat';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* `MapMouseEvent` is the event type for mouse-related map events.
|
|
14
|
+
* @extends {Object}
|
|
15
|
+
* @example
|
|
16
|
+
* // The `click` event is an example of a `MapMouseEvent`.
|
|
17
|
+
* // Set up an event listener on the map.
|
|
18
|
+
* map.on('click', function(e) {
|
|
19
|
+
* // The event object (e) contains information like the
|
|
20
|
+
* // coordinates of the point on the map that was clicked.
|
|
21
|
+
* console.log('A click event has occurred at ' + e.lngLat);
|
|
22
|
+
* });
|
|
23
|
+
*/
|
|
24
|
+
export class MapMouseEvent extends Event {
|
|
25
|
+
/**
|
|
26
|
+
* The event type (one of {@link Map.event:mousedown},
|
|
27
|
+
* {@link Map.event:mouseup},
|
|
28
|
+
* {@link Map.event:click},
|
|
29
|
+
* {@link Map.event:dblclick},
|
|
30
|
+
* {@link Map.event:mousemove},
|
|
31
|
+
* {@link Map.event:mouseover},
|
|
32
|
+
* {@link Map.event:mouseenter},
|
|
33
|
+
* {@link Map.event:mouseleave},
|
|
34
|
+
* {@link Map.event:mouseout},
|
|
35
|
+
* {@link Map.event:contextmenu}).
|
|
36
|
+
*/
|
|
37
|
+
type: 'mousedown'
|
|
38
|
+
| 'mouseup'
|
|
39
|
+
| 'click'
|
|
40
|
+
| 'dblclick'
|
|
41
|
+
| 'mousemove'
|
|
42
|
+
| 'mouseover'
|
|
43
|
+
| 'mouseenter'
|
|
44
|
+
| 'mouseleave'
|
|
45
|
+
| 'mouseout'
|
|
46
|
+
| 'contextmenu';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The `Map` object that fired the event.
|
|
50
|
+
*/
|
|
51
|
+
target: Map;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The DOM event which caused the map event.
|
|
55
|
+
*/
|
|
56
|
+
originalEvent: MouseEvent;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The pixel coordinates of the mouse cursor, relative to the map and measured from the top left corner.
|
|
60
|
+
*/
|
|
61
|
+
point: Point;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The geographic location on the map of the mouse cursor.
|
|
65
|
+
*/
|
|
66
|
+
lngLat: LngLat;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Prevents subsequent default processing of the event by the map.
|
|
70
|
+
*
|
|
71
|
+
* Calling this method will prevent the following default map behaviors:
|
|
72
|
+
*
|
|
73
|
+
* * On `mousedown` events, the behavior of {@link DragPanHandler}
|
|
74
|
+
* * On `mousedown` events, the behavior of {@link DragRotateHandler}
|
|
75
|
+
* * On `mousedown` events, the behavior of {@link BoxZoomHandler}
|
|
76
|
+
* * On `dblclick` events, the behavior of {@link DoubleClickZoomHandler}
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
preventDefault() {
|
|
80
|
+
this._defaultPrevented = true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* `true` if `preventDefault` has been called.
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
get defaultPrevented(): boolean {
|
|
88
|
+
return this._defaultPrevented;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
_defaultPrevented: boolean;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* @private
|
|
95
|
+
*/
|
|
96
|
+
constructor(type: string, map: Map, originalEvent: MouseEvent, data: Object = {}) {
|
|
97
|
+
const point = DOM.mousePos(map.getCanvasContainer(), originalEvent);
|
|
98
|
+
const lngLat = map.unproject(point);
|
|
99
|
+
super(type, extend({point, lngLat, originalEvent}, data));
|
|
100
|
+
this._defaultPrevented = false;
|
|
101
|
+
this.target = map;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* `MapTouchEvent` is the event type for touch-related map events.
|
|
107
|
+
* @extends {Object}
|
|
108
|
+
*/
|
|
109
|
+
export class MapTouchEvent extends Event {
|
|
110
|
+
/**
|
|
111
|
+
* The event type.
|
|
112
|
+
*/
|
|
113
|
+
type: 'touchstart'
|
|
114
|
+
| 'touchend'
|
|
115
|
+
| 'touchcancel';
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The `Map` object that fired the event.
|
|
119
|
+
*/
|
|
120
|
+
target: Map;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The DOM event which caused the map event.
|
|
124
|
+
*/
|
|
125
|
+
originalEvent: TouchEvent;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The geographic location on the map of the center of the touch event points.
|
|
129
|
+
*/
|
|
130
|
+
lngLat: LngLat;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* The pixel coordinates of the center of the touch event points, relative to the map and measured from the top left
|
|
134
|
+
* corner.
|
|
135
|
+
*/
|
|
136
|
+
point: Point;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The array of pixel coordinates corresponding to a
|
|
140
|
+
* [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
|
|
141
|
+
*/
|
|
142
|
+
points: Array<Point>;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The geographical locations on the map corresponding to a
|
|
146
|
+
* [touch event's `touches`](https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent/touches) property.
|
|
147
|
+
*/
|
|
148
|
+
lngLats: Array<LngLat>;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Prevents subsequent default processing of the event by the map.
|
|
152
|
+
*
|
|
153
|
+
* Calling this method will prevent the following default map behaviors:
|
|
154
|
+
*
|
|
155
|
+
* * On `touchstart` events, the behavior of {@link DragPanHandler}
|
|
156
|
+
* * On `touchstart` events, the behavior of {@link TouchZoomRotateHandler}
|
|
157
|
+
*
|
|
158
|
+
*/
|
|
159
|
+
preventDefault() {
|
|
160
|
+
this._defaultPrevented = true;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* `true` if `preventDefault` has been called.
|
|
165
|
+
* @private
|
|
166
|
+
*/
|
|
167
|
+
get defaultPrevented(): boolean {
|
|
168
|
+
return this._defaultPrevented;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
_defaultPrevented: boolean;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @private
|
|
175
|
+
*/
|
|
176
|
+
constructor(type: string, map: Map, originalEvent: TouchEvent) {
|
|
177
|
+
const touches = type === "touchend" ? originalEvent.changedTouches : originalEvent.touches;
|
|
178
|
+
const points = DOM.touchPos(map.getCanvasContainer(), touches);
|
|
179
|
+
const lngLats = points.map((t) => map.unproject(t));
|
|
180
|
+
const point = points.reduce((prev, curr, i, arr) => {
|
|
181
|
+
return prev.add(curr.div(arr.length));
|
|
182
|
+
}, new Point(0, 0));
|
|
183
|
+
const lngLat = map.unproject(point);
|
|
184
|
+
super(type, {points, point, lngLats, lngLat, originalEvent});
|
|
185
|
+
this._defaultPrevented = false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* `MapWheelEvent` is the event type for the `wheel` map event.
|
|
191
|
+
* @extends {Object}
|
|
192
|
+
*/
|
|
193
|
+
export class MapWheelEvent extends Event {
|
|
194
|
+
/**
|
|
195
|
+
* The event type.
|
|
196
|
+
*/
|
|
197
|
+
type: 'wheel';
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* The `Map` object that fired the event.
|
|
201
|
+
*/
|
|
202
|
+
target: Map;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* The DOM event which caused the map event.
|
|
206
|
+
*/
|
|
207
|
+
originalEvent: WheelEvent;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Prevents subsequent default processing of the event by the map.
|
|
211
|
+
*
|
|
212
|
+
* Calling this method will prevent the the behavior of {@link ScrollZoomHandler}.
|
|
213
|
+
*/
|
|
214
|
+
preventDefault() {
|
|
215
|
+
this._defaultPrevented = true;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* `true` if `preventDefault` has been called.
|
|
220
|
+
* @private
|
|
221
|
+
*/
|
|
222
|
+
get defaultPrevented(): boolean {
|
|
223
|
+
return this._defaultPrevented;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
_defaultPrevented: boolean;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @private
|
|
230
|
+
*/
|
|
231
|
+
constructor(type: string, map: Map, originalEvent: WheelEvent) {
|
|
232
|
+
super(type, {originalEvent});
|
|
233
|
+
this._defaultPrevented = false;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* A `MapBoxZoomEvent` is the event type for the boxzoom-related map events emitted by the {@link BoxZoomHandler}.
|
|
239
|
+
*
|
|
240
|
+
* @typedef {Object} MapBoxZoomEvent
|
|
241
|
+
* @property {MouseEvent} originalEvent The DOM event that triggered the boxzoom event. Can be a `MouseEvent` or `KeyboardEvent`
|
|
242
|
+
* @property {string} type The type of boxzoom event. One of `boxzoomstart`, `boxzoomend` or `boxzoomcancel`
|
|
243
|
+
* @property {Map} target The `Map` instance that triggerred the event
|
|
244
|
+
*/
|
|
245
|
+
export type MapBoxZoomEvent = {
|
|
246
|
+
type: 'boxzoomstart'
|
|
247
|
+
| 'boxzoomend'
|
|
248
|
+
| 'boxzoomcancel',
|
|
249
|
+
target: Map,
|
|
250
|
+
originalEvent: MouseEvent
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* A `MapDataEvent` object is emitted with the {@link Map.event:data}
|
|
255
|
+
* and {@link Map.event:dataloading} events. Possible values for
|
|
256
|
+
* `dataType`s are:
|
|
257
|
+
*
|
|
258
|
+
* - `'source'`: The non-tile data associated with any source
|
|
259
|
+
* - `'style'`: The [style](https://www.mapbox.com/mapbox-gl-style-spec/) used by the map
|
|
260
|
+
*
|
|
261
|
+
* @typedef {Object} MapDataEvent
|
|
262
|
+
* @property {string} type The event type.
|
|
263
|
+
* @property {string} dataType The type of data that has changed. One of `'source'`, `'style'`.
|
|
264
|
+
* @property {boolean} [isSourceLoaded] True if the event has a `dataType` of `source` and the source has no outstanding network requests.
|
|
265
|
+
* @property {Object} [source] The [style spec representation of the source](https://www.mapbox.com/mapbox-gl-style-spec/#sources) if the event has a `dataType` of `source`.
|
|
266
|
+
* @property {string} [sourceDataType] Included if the event has a `dataType` of `source` and the event signals
|
|
267
|
+
* that internal data has been received or changed. Possible values are `metadata`, `content` and `visibility`.
|
|
268
|
+
* @property {Object} [tile] The tile being loaded or changed, if the event has a `dataType` of `source` and
|
|
269
|
+
* the event is related to loading of a tile.
|
|
270
|
+
* @property {Coordinate} [coord] The coordinate of the tile if the event has a `dataType` of `source` and
|
|
271
|
+
* the event is related to loading of a tile.
|
|
272
|
+
* @example
|
|
273
|
+
* // The sourcedata event is an example of MapDataEvent.
|
|
274
|
+
* // Set up an event listener on the map.
|
|
275
|
+
* map.on('sourcedata', function(e) {
|
|
276
|
+
* if (e.isSourceLoaded) {
|
|
277
|
+
* // Do something when the source has finished loading
|
|
278
|
+
* }
|
|
279
|
+
* });
|
|
280
|
+
*/
|
|
281
|
+
export type MapDataEvent = {
|
|
282
|
+
type: string,
|
|
283
|
+
dataType: string
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
export type MapContextEvent = {
|
|
287
|
+
type: 'webglcontextlost' | 'webglcontextrestored',
|
|
288
|
+
originalEvent: WebGLContextEvent
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export type MapEvent =
|
|
292
|
+
/**
|
|
293
|
+
* Fired when a pointing device (usually a mouse) is pressed within the map.
|
|
294
|
+
*
|
|
295
|
+
* **Note:** This event is compatible with the optional `layerId` parameter.
|
|
296
|
+
* If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only when the
|
|
297
|
+
* the cursor is pressed while inside a visible portion of the specifed layer.
|
|
298
|
+
*
|
|
299
|
+
* @event mousedown
|
|
300
|
+
* @memberof Map
|
|
301
|
+
* @instance
|
|
302
|
+
* @property {MapMouseEvent} data
|
|
303
|
+
* @example
|
|
304
|
+
* // Initialize the map
|
|
305
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
306
|
+
* // Set an event listener
|
|
307
|
+
* map.on('mousedown', function() {
|
|
308
|
+
* console.log('A mousedown event has occurred.');
|
|
309
|
+
* });
|
|
310
|
+
* @example
|
|
311
|
+
* // Initialize the map
|
|
312
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
313
|
+
* // Set an event listener for a specific layer
|
|
314
|
+
* map.on('mousedown', 'poi-label', function() {
|
|
315
|
+
* console.log('A mousedown event has occurred on a visible portion of the poi-label layer.');
|
|
316
|
+
* });
|
|
317
|
+
* @see [Highlight features within a bounding box](https://docs.mapbox.com/mapbox-gl-js/example/using-box-queryrenderedfeatures/)
|
|
318
|
+
* @see [Create a draggable point](https://docs.mapbox.com/mapbox-gl-js/example/drag-a-point/)
|
|
319
|
+
*/
|
|
320
|
+
| 'mousedown'
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Fired when a pointing device (usually a mouse) is released within the map.
|
|
324
|
+
*
|
|
325
|
+
* **Note:** This event is compatible with the optional `layerId` parameter.
|
|
326
|
+
* If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only when the
|
|
327
|
+
* the cursor is released while inside a visible portion of the specifed layer.
|
|
328
|
+
*
|
|
329
|
+
* @event mouseup
|
|
330
|
+
* @memberof Map
|
|
331
|
+
* @instance
|
|
332
|
+
* @property {MapMouseEvent} data
|
|
333
|
+
* @example
|
|
334
|
+
* // Initialize the map
|
|
335
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
336
|
+
* // Set an event listener
|
|
337
|
+
* map.on('mouseup', function() {
|
|
338
|
+
* console.log('A mouseup event has occurred.');
|
|
339
|
+
* });
|
|
340
|
+
* @example
|
|
341
|
+
* // Initialize the map
|
|
342
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
343
|
+
* // Set an event listener for a specific layer
|
|
344
|
+
* map.on('mouseup', 'poi-label', function() {
|
|
345
|
+
* console.log('A mouseup event has occurred on a visible portion of the poi-label layer.');
|
|
346
|
+
* });
|
|
347
|
+
* @see [Highlight features within a bounding box](https://docs.mapbox.com/mapbox-gl-js/example/using-box-queryrenderedfeatures/)
|
|
348
|
+
* @see [Create a draggable point](https://docs.mapbox.com/mapbox-gl-js/example/drag-a-point/)
|
|
349
|
+
*/
|
|
350
|
+
| 'mouseup'
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Fired when a pointing device (usually a mouse) is moved within the map.
|
|
354
|
+
* As you move the cursor across a web page containing a map,
|
|
355
|
+
* the event will fire each time it enters the map or any child elements.
|
|
356
|
+
*
|
|
357
|
+
* **Note:** This event is compatible with the optional `layerId` parameter.
|
|
358
|
+
* If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only when the
|
|
359
|
+
* the cursor is moved inside a visible portion of the specifed layer.
|
|
360
|
+
*
|
|
361
|
+
* @event mouseover
|
|
362
|
+
* @memberof Map
|
|
363
|
+
* @instance
|
|
364
|
+
* @property {MapMouseEvent} data
|
|
365
|
+
* @example
|
|
366
|
+
* // Initialize the map
|
|
367
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
368
|
+
* // Set an event listener
|
|
369
|
+
* map.on('mouseover', function() {
|
|
370
|
+
* console.log('A mouseover event has occurred.');
|
|
371
|
+
* });
|
|
372
|
+
* @example
|
|
373
|
+
* // Initialize the map
|
|
374
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
375
|
+
* // Set an event listener for a specific layer
|
|
376
|
+
* map.on('mouseover', 'poi-label', function() {
|
|
377
|
+
* console.log('A mouseover event has occurred on a visible portion of the poi-label layer.');
|
|
378
|
+
* });
|
|
379
|
+
* @see [Get coordinates of the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/mouse-position/)
|
|
380
|
+
* @see [Highlight features under the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/hover-styles/)
|
|
381
|
+
* @see [Display a popup on hover](https://www.mapbox.com/mapbox-gl-js/example/popup-on-hover/)
|
|
382
|
+
*/
|
|
383
|
+
| 'mouseover'
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Fired when a pointing device (usually a mouse) is moved while the cursor is inside the map.
|
|
387
|
+
* As you move the cursor across the map, the event will fire every time the cursor changes position within the map.
|
|
388
|
+
*
|
|
389
|
+
* **Note:** This event is compatible with the optional `layerId` parameter.
|
|
390
|
+
* If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only when the
|
|
391
|
+
* the cursor is inside a visible portion of the specified layer.
|
|
392
|
+
*
|
|
393
|
+
* @event mousemove
|
|
394
|
+
* @memberof Map
|
|
395
|
+
* @instance
|
|
396
|
+
* @property {MapMouseEvent} data
|
|
397
|
+
* @example
|
|
398
|
+
* // Initialize the map
|
|
399
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
400
|
+
* // Set an event listener
|
|
401
|
+
* map.on('mousemove', function() {
|
|
402
|
+
* console.log('A mousemove event has occurred.');
|
|
403
|
+
* });
|
|
404
|
+
* @example
|
|
405
|
+
* // Initialize the map
|
|
406
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
407
|
+
* // Set an event listener for a specific layer
|
|
408
|
+
* map.on('mousemove', 'poi-label', function() {
|
|
409
|
+
* console.log('A mousemove event has occurred on a visible portion of the poi-label layer.');
|
|
410
|
+
* });
|
|
411
|
+
* @see [Get coordinates of the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/mouse-position/)
|
|
412
|
+
* @see [Highlight features under the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/hover-styles/)
|
|
413
|
+
* @see [Display a popup on over](https://www.mapbox.com/mapbox-gl-js/example/popup-on-hover/)
|
|
414
|
+
*/
|
|
415
|
+
| 'mousemove'
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Fired when a pointing device (usually a mouse) is pressed and released at the same point on the map.
|
|
419
|
+
*
|
|
420
|
+
* **Note:** This event is compatible with the optional `layerId` parameter.
|
|
421
|
+
* If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only when the
|
|
422
|
+
* point that is pressed and released contains a visible portion of the specifed layer.
|
|
423
|
+
*
|
|
424
|
+
* @event click
|
|
425
|
+
* @memberof Map
|
|
426
|
+
* @instance
|
|
427
|
+
* @property {MapMouseEvent} data
|
|
428
|
+
* @example
|
|
429
|
+
* // Initialize the map
|
|
430
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
431
|
+
* // Set an event listener
|
|
432
|
+
* map.on('click', function(e) {
|
|
433
|
+
* console.log('A click event has occurred at ' + e.lngLat);
|
|
434
|
+
* });
|
|
435
|
+
* @example
|
|
436
|
+
* // Initialize the map
|
|
437
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
438
|
+
* // Set an event listener for a specific layer
|
|
439
|
+
* map.on('click', 'poi-label', function(e) {
|
|
440
|
+
* console.log('A click event has occurred on a visible portion of the poi-label layer at ' + e.lngLat);
|
|
441
|
+
* });
|
|
442
|
+
* @see [Measure distances](https://www.mapbox.com/mapbox-gl-js/example/measure/)
|
|
443
|
+
* @see [Center the map on a clicked symbol](https://www.mapbox.com/mapbox-gl-js/example/center-on-symbol/)
|
|
444
|
+
*/
|
|
445
|
+
| 'click'
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Fired when a pointing device (usually a mouse) is pressed and released twice at the same point on
|
|
449
|
+
* the map in rapid succession.
|
|
450
|
+
*
|
|
451
|
+
* **Note:** This event is compatible with the optional `layerId` parameter.
|
|
452
|
+
* If `layerId` is included as the second argument in {@link Map#on}, the event listener will fire only
|
|
453
|
+
* when the point that is clicked twice contains a visible portion of the specifed layer.
|
|
454
|
+
*
|
|
455
|
+
* @event dblclick
|
|
456
|
+
* @memberof Map
|
|
457
|
+
* @instance
|
|
458
|
+
* @property {MapMouseEvent} data
|
|
459
|
+
* @example
|
|
460
|
+
* // Initialize the map
|
|
461
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
462
|
+
* // Set an event listener
|
|
463
|
+
* map.on('dblclick', function(e) {
|
|
464
|
+
* console.log('A dblclick event has occurred at ' + e.lngLat);
|
|
465
|
+
* });
|
|
466
|
+
* @example
|
|
467
|
+
* // Initialize the map
|
|
468
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
469
|
+
* // Set an event listener for a specific layer
|
|
470
|
+
* map.on('dblclick', 'poi-label', function(e) {
|
|
471
|
+
* console.log('A dblclick event has occurred on a visible portion of the poi-label layer at ' + e.lngLat);
|
|
472
|
+
* });
|
|
473
|
+
*/
|
|
474
|
+
| 'dblclick'
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Fired when a pointing device (usually a mouse) enters a visible portion of a specified layer from
|
|
478
|
+
* outside that layer or outside the map canvas.
|
|
479
|
+
*
|
|
480
|
+
* **Important:** This event can only be listened for when {@link Map#on} includes three arguments,
|
|
481
|
+
* where the second argument specifies the desired layer.
|
|
482
|
+
*
|
|
483
|
+
* @event mouseenter
|
|
484
|
+
* @memberof Map
|
|
485
|
+
* @instance
|
|
486
|
+
* @property {MapMouseEvent} data
|
|
487
|
+
* @example
|
|
488
|
+
* // Initialize the map
|
|
489
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
490
|
+
* // Set an event listener
|
|
491
|
+
* map.on('mouseenter', 'water', function() {
|
|
492
|
+
* console.log('A mouseenter event occurred on a visible portion of the water layer.');
|
|
493
|
+
* });
|
|
494
|
+
* @see [Center the map on a clicked symbol](https://docs.mapbox.com/mapbox-gl-js/example/center-on-symbol/)
|
|
495
|
+
* @see [Display a popup on click](https://docs.mapbox.com/mapbox-gl-js/example/popup-on-click/)
|
|
496
|
+
*/
|
|
497
|
+
| 'mouseenter'
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Fired when a pointing device (usually a mouse) leaves a visible portion of a specified layer, or leaves
|
|
501
|
+
* the map canvas.
|
|
502
|
+
*
|
|
503
|
+
* **Important:** This event can only be listened for when {@link Map#on} includes three arguements,
|
|
504
|
+
* where the second argument specifies the desired layer.
|
|
505
|
+
*
|
|
506
|
+
* @event mouseleave
|
|
507
|
+
* @memberof Map
|
|
508
|
+
* @instance
|
|
509
|
+
* @property {MapMouseEvent} data
|
|
510
|
+
* @example
|
|
511
|
+
* // Initialize the map
|
|
512
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
513
|
+
* // Set an event listener that fires
|
|
514
|
+
* // when the pointing device leaves
|
|
515
|
+
* // a visible portion of the specified layer.
|
|
516
|
+
* map.on('mouseleave', 'water', function() {
|
|
517
|
+
* console.log('A mouseleave event occurred.');
|
|
518
|
+
* });
|
|
519
|
+
* @see [Highlight features under the mouse pointer](https://www.mapbox.com/mapbox-gl-js/example/hover-styles/)
|
|
520
|
+
* @see [Display a popup on click](https://docs.mapbox.com/mapbox-gl-js/example/popup-on-click/)
|
|
521
|
+
*/
|
|
522
|
+
| 'mouseleave'
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Fired when a point device (usually a mouse) leaves the map's canvas.
|
|
526
|
+
*
|
|
527
|
+
* @event mouseout
|
|
528
|
+
* @memberof Map
|
|
529
|
+
* @instance
|
|
530
|
+
* @property {MapMouseEvent} data
|
|
531
|
+
* @example
|
|
532
|
+
* // Initialize the map
|
|
533
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
534
|
+
* // Set an event listener that fires
|
|
535
|
+
* // when the pointing device leave's
|
|
536
|
+
* // the map's canvas.
|
|
537
|
+
* map.on('mouseout', function() {
|
|
538
|
+
* console.log('A mouseout event occurred.');
|
|
539
|
+
* });
|
|
540
|
+
*/
|
|
541
|
+
| 'mouseout'
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* Fired when the right button of the mouse is clicked or the context menu key is pressed within the map.
|
|
545
|
+
*
|
|
546
|
+
* @event contextmenu
|
|
547
|
+
* @memberof Map
|
|
548
|
+
* @instance
|
|
549
|
+
* @property {MapMouseEvent} data
|
|
550
|
+
* @example
|
|
551
|
+
* // Initialize the map
|
|
552
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
553
|
+
* // Set an event listener that fires
|
|
554
|
+
* // when the right mouse button is
|
|
555
|
+
* // pressed within the map.
|
|
556
|
+
* map.on('contextmenu', function() {
|
|
557
|
+
* console.log('A contextmenu event occurred.');
|
|
558
|
+
* });
|
|
559
|
+
*/
|
|
560
|
+
| 'contextmenu'
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Fired when a [`wheel`](https://developer.mozilla.org/en-US/docs/Web/Events/wheel) event occurs within the map.
|
|
564
|
+
*
|
|
565
|
+
* @event wheel
|
|
566
|
+
* @memberof Map
|
|
567
|
+
* @instance
|
|
568
|
+
* @property {MapWheelEvent} data
|
|
569
|
+
* @example
|
|
570
|
+
* // Initialize the map
|
|
571
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
572
|
+
* // Set an event listener that fires
|
|
573
|
+
* // when a wheel event occurs within the map.
|
|
574
|
+
* map.on('wheel', function() {
|
|
575
|
+
* console.log('A wheel event occurred.');
|
|
576
|
+
* });
|
|
577
|
+
*/
|
|
578
|
+
| 'wheel'
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Fired when a [`touchstart`](https://developer.mozilla.org/en-US/docs/Web/Events/touchstart) event occurs within the map.
|
|
582
|
+
*
|
|
583
|
+
* @event touchstart
|
|
584
|
+
* @memberof Map
|
|
585
|
+
* @instance
|
|
586
|
+
* @property {MapTouchEvent} data
|
|
587
|
+
* // Initialize the map
|
|
588
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
589
|
+
* // Set an event listener that fires
|
|
590
|
+
* // when a touchstart event occurs within the map.
|
|
591
|
+
* map.on('touchstart', function() {
|
|
592
|
+
* console.log('A touchstart event occurred.');
|
|
593
|
+
* });
|
|
594
|
+
* @see [Create a draggable point](https://docs.mapbox.com/mapbox-gl-js/example/drag-a-point/)
|
|
595
|
+
*/
|
|
596
|
+
| 'touchstart'
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Fired when a [`touchend`](https://developer.mozilla.org/en-US/docs/Web/Events/touchend) event occurs within the map.
|
|
600
|
+
*
|
|
601
|
+
* @event touchend
|
|
602
|
+
* @memberof Map
|
|
603
|
+
* @instance
|
|
604
|
+
* @property {MapTouchEvent} data
|
|
605
|
+
* @example
|
|
606
|
+
* // Initialize the map
|
|
607
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
608
|
+
* // Set an event listener that fires
|
|
609
|
+
* // when a touchstart event occurs within the map.
|
|
610
|
+
* map.on('touchstart', function() {
|
|
611
|
+
* console.log('A touchstart event occurred.');
|
|
612
|
+
* });
|
|
613
|
+
* @see [Create a draggable point](https://docs.mapbox.com/mapbox-gl-js/example/drag-a-point/)
|
|
614
|
+
*/
|
|
615
|
+
| 'touchend'
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Fired when a [`touchmove`](https://developer.mozilla.org/en-US/docs/Web/Events/touchmove) event occurs within the map.
|
|
619
|
+
*
|
|
620
|
+
* @event touchmove
|
|
621
|
+
* @memberof Map
|
|
622
|
+
* @instance
|
|
623
|
+
* @property {MapTouchEvent} data
|
|
624
|
+
* @example
|
|
625
|
+
* // Initialize the map
|
|
626
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
627
|
+
* // Set an event listener that fires
|
|
628
|
+
* // when a touchmove event occurs within the map.
|
|
629
|
+
* map.on('touchmove', function() {
|
|
630
|
+
* console.log('A touchmove event occurred.');
|
|
631
|
+
* });
|
|
632
|
+
* @see [Create a draggable point](https://docs.mapbox.com/mapbox-gl-js/example/drag-a-point/)
|
|
633
|
+
*/
|
|
634
|
+
| 'touchmove'
|
|
635
|
+
|
|
636
|
+
/**
|
|
637
|
+
* Fired when a [`touchcancel`](https://developer.mozilla.org/en-US/docs/Web/Events/touchcancel) event occurs within the map.
|
|
638
|
+
*
|
|
639
|
+
* @event touchcancel
|
|
640
|
+
* @memberof Map
|
|
641
|
+
* @instance
|
|
642
|
+
* @property {MapTouchEvent} data
|
|
643
|
+
* @example
|
|
644
|
+
* // Initialize the map
|
|
645
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
646
|
+
* // Set an event listener that fires
|
|
647
|
+
* // when a touchcancel event occurs within the map.
|
|
648
|
+
* map.on('touchcancel', function() {
|
|
649
|
+
* console.log('A touchcancel event occurred.');
|
|
650
|
+
* });
|
|
651
|
+
*/
|
|
652
|
+
| 'touchcancel'
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* Fired just before the map begins a transition from one
|
|
656
|
+
* view to another, as the result of either user interaction or methods such as {@link Map#jumpTo}.
|
|
657
|
+
*
|
|
658
|
+
* @event movestart
|
|
659
|
+
* @memberof Map
|
|
660
|
+
* @instance
|
|
661
|
+
* @property {{originalEvent: DragEvent}} data
|
|
662
|
+
* @example
|
|
663
|
+
* // Initialize the map
|
|
664
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
665
|
+
* // Set an event listener that fires
|
|
666
|
+
* // just before the map begins a transition
|
|
667
|
+
* // from one view to another.
|
|
668
|
+
* map.on('movestart', function() {
|
|
669
|
+
* console.log('A movestart` event occurred.');
|
|
670
|
+
* });
|
|
671
|
+
*/
|
|
672
|
+
| 'movestart'
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
|
+
* Fired repeatedly during an animated transition from one view to
|
|
676
|
+
* another, as the result of either user interaction or methods such as {@link Map#flyTo}.
|
|
677
|
+
*
|
|
678
|
+
* @event move
|
|
679
|
+
* @memberof Map
|
|
680
|
+
* @instance
|
|
681
|
+
* @property {MapMouseEvent | MapTouchEvent} data
|
|
682
|
+
* @example
|
|
683
|
+
* // Initialize the map
|
|
684
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
685
|
+
* // Set an event listener that fires
|
|
686
|
+
* // repeatedly during an animated transition.
|
|
687
|
+
* map.on('move', function() {
|
|
688
|
+
* console.log('A move event occurred.');
|
|
689
|
+
* });
|
|
690
|
+
* @see [Display HTML clusters with custom properties](https://docs.mapbox.com/mapbox-gl-js/example/cluster-html/)
|
|
691
|
+
* @see [Filter features within map view](https://docs.mapbox.com/mapbox-gl-js/example/filter-features-within-map-view/)
|
|
692
|
+
*/
|
|
693
|
+
| 'move'
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* Fired just after the map completes a transition from one
|
|
697
|
+
* view to another, as the result of either user interaction or methods such as {@link Map#jumpTo}.
|
|
698
|
+
*
|
|
699
|
+
* @event moveend
|
|
700
|
+
* @memberof Map
|
|
701
|
+
* @instance
|
|
702
|
+
* @property {{originalEvent: DragEvent}} data
|
|
703
|
+
* @example
|
|
704
|
+
* // Initialize the map
|
|
705
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
706
|
+
* // Set an event listener that fires
|
|
707
|
+
* // just after the map completes a transition.
|
|
708
|
+
* map.on('moveend', function() {
|
|
709
|
+
* console.log('A moveend event occurred.');
|
|
710
|
+
* });
|
|
711
|
+
* @see [Play map locations as a slideshow](https://www.mapbox.com/mapbox-gl-js/example/playback-locations/)
|
|
712
|
+
* @see [Filter features within map view](https://www.mapbox.com/mapbox-gl-js/example/filter-features-within-map-view/)
|
|
713
|
+
* @see [Display HTML clusters with custom properties](https://docs.mapbox.com/mapbox-gl-js/example/cluster-html/)
|
|
714
|
+
*/
|
|
715
|
+
| 'moveend'
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* Fired when a "drag to pan" interaction starts. See {@link DragPanHandler}.
|
|
719
|
+
*
|
|
720
|
+
* @event dragstart
|
|
721
|
+
* @memberof Map
|
|
722
|
+
* @instance
|
|
723
|
+
* @property {{originalEvent: DragEvent}} data
|
|
724
|
+
* @example
|
|
725
|
+
* // Initialize the map
|
|
726
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
727
|
+
* // Set an event listener that fires
|
|
728
|
+
* // when a "drag to pan" interaction starts.
|
|
729
|
+
* map.on('dragstart', function() {
|
|
730
|
+
* console.log('A dragstart event occurred.');
|
|
731
|
+
* });
|
|
732
|
+
*/
|
|
733
|
+
| 'dragstart'
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Fired repeatedly during a "drag to pan" interaction. See {@link DragPanHandler}.
|
|
737
|
+
*
|
|
738
|
+
* @event drag
|
|
739
|
+
* @memberof Map
|
|
740
|
+
* @instance
|
|
741
|
+
* @property {MapMouseEvent | MapTouchEvent} data
|
|
742
|
+
* @example
|
|
743
|
+
* // Initialize the map
|
|
744
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
745
|
+
* // Set an event listener that fires
|
|
746
|
+
* // repeatedly during a "drag to pan" interaction.
|
|
747
|
+
* map.on('drag', function() {
|
|
748
|
+
* console.log('A drag event occurred.');
|
|
749
|
+
* });
|
|
750
|
+
*/
|
|
751
|
+
| 'drag'
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Fired when a "drag to pan" interaction ends. See {@link DragPanHandler}.
|
|
755
|
+
*
|
|
756
|
+
* @event dragend
|
|
757
|
+
* @memberof Map
|
|
758
|
+
* @instance
|
|
759
|
+
* @property {{originalEvent: DragEvent}} data
|
|
760
|
+
* @example
|
|
761
|
+
* // Initialize the map
|
|
762
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
763
|
+
* // Set an event listener that fires
|
|
764
|
+
* // when a "drag to pan" interaction ends.
|
|
765
|
+
* map.on('dragend', function() {
|
|
766
|
+
* console.log('A dragend event occurred.');
|
|
767
|
+
* });
|
|
768
|
+
* @see [Create a draggable marker](https://docs.mapbox.com/mapbox-gl-js/example/drag-a-marker/)
|
|
769
|
+
*/
|
|
770
|
+
| 'dragend'
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Fired just before the map begins a transition from one zoom level to another,
|
|
774
|
+
* as the result of either user interaction or methods such as {@link Map#flyTo}.
|
|
775
|
+
*
|
|
776
|
+
* @event zoomstart
|
|
777
|
+
* @memberof Map
|
|
778
|
+
* @instance
|
|
779
|
+
* @property {MapMouseEvent | MapTouchEvent} data
|
|
780
|
+
* @example
|
|
781
|
+
* // Initialize the map
|
|
782
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
783
|
+
* // Set an event listener that fires
|
|
784
|
+
* // just before a zoom transition starts.
|
|
785
|
+
* map.on('zoomstart', function() {
|
|
786
|
+
* console.log('A zoomstart event occurred.');
|
|
787
|
+
* });
|
|
788
|
+
*/
|
|
789
|
+
| 'zoomstart'
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
|
+
* Fired repeatedly during an animated transition from one zoom level to another,
|
|
793
|
+
* as the result of either user interaction or methods such as {@link Map#flyTo}.
|
|
794
|
+
*
|
|
795
|
+
* @event zoom
|
|
796
|
+
* @memberof Map
|
|
797
|
+
* @instance
|
|
798
|
+
* @property {MapMouseEvent | MapTouchEvent} data
|
|
799
|
+
* @example
|
|
800
|
+
* // Initialize the map
|
|
801
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
802
|
+
* // Set an event listener that fires
|
|
803
|
+
* // repeatedly during a zoom transition.
|
|
804
|
+
* map.on('zoom', function() {
|
|
805
|
+
* console.log('A zoom event occurred.');
|
|
806
|
+
* });
|
|
807
|
+
* @see [Update a choropleth layer by zoom level](https://www.mapbox.com/mapbox-gl-js/example/updating-choropleth/)
|
|
808
|
+
*/
|
|
809
|
+
| 'zoom'
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* Fired just after the map completes a transition from one zoom level to another,
|
|
813
|
+
* as the result of either user interaction or methods such as {@link Map#flyTo}.
|
|
814
|
+
*
|
|
815
|
+
* @event zoomend
|
|
816
|
+
* @memberof Map
|
|
817
|
+
* @instance
|
|
818
|
+
* @property {MapMouseEvent | MapTouchEvent} data
|
|
819
|
+
* @example
|
|
820
|
+
* // Initialize the map
|
|
821
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
822
|
+
* // Set an event listener that fires
|
|
823
|
+
* // just after a zoom transition finishes.
|
|
824
|
+
* map.on('zoomend', function() {
|
|
825
|
+
* console.log('A zoomend event occurred.');
|
|
826
|
+
* });
|
|
827
|
+
*/
|
|
828
|
+
| 'zoomend'
|
|
829
|
+
|
|
830
|
+
/**
|
|
831
|
+
* Fired when a "drag to rotate" interaction starts. See {@link DragRotateHandler}.
|
|
832
|
+
*
|
|
833
|
+
* @event rotatestart
|
|
834
|
+
* @memberof Map
|
|
835
|
+
* @instance
|
|
836
|
+
* @property {MapMouseEvent | MapTouchEvent} data
|
|
837
|
+
* @example
|
|
838
|
+
* // Initialize the map
|
|
839
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
840
|
+
* // Set an event listener that fires
|
|
841
|
+
* // just before a "drag to rotate" interaction starts.
|
|
842
|
+
* map.on('rotatestart', function() {
|
|
843
|
+
* console.log('A rotatestart event occurred.');
|
|
844
|
+
* });
|
|
845
|
+
*/
|
|
846
|
+
| 'rotatestart'
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Fired repeatedly during a "drag to rotate" interaction. See {@link DragRotateHandler}.
|
|
850
|
+
*
|
|
851
|
+
* @event rotate
|
|
852
|
+
* @memberof Map
|
|
853
|
+
* @instance
|
|
854
|
+
* @property {MapMouseEvent | MapTouchEvent} data
|
|
855
|
+
* @example
|
|
856
|
+
* // Initialize the map
|
|
857
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
858
|
+
* // Set an event listener that fires
|
|
859
|
+
* // repeatedly during "drag to rotate" interaction.
|
|
860
|
+
* map.on('rotate', function() {
|
|
861
|
+
* console.log('A rotate event occurred.');
|
|
862
|
+
* });
|
|
863
|
+
*/
|
|
864
|
+
| 'rotate'
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Fired when a "drag to rotate" interaction ends. See {@link DragRotateHandler}.
|
|
868
|
+
*
|
|
869
|
+
* @event rotateend
|
|
870
|
+
* @memberof Map
|
|
871
|
+
* @instance
|
|
872
|
+
* @property {MapMouseEvent | MapTouchEvent} data
|
|
873
|
+
* @example
|
|
874
|
+
* // Initialize the map
|
|
875
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
876
|
+
* // Set an event listener that fires
|
|
877
|
+
* // just after a "drag to rotate" interaction ends.
|
|
878
|
+
* map.on('rotateend', function() {
|
|
879
|
+
* console.log('A rotateend event occurred.');
|
|
880
|
+
* });
|
|
881
|
+
*/
|
|
882
|
+
| 'rotateend'
|
|
883
|
+
|
|
884
|
+
/**
|
|
885
|
+
* Fired whenever the map's pitch (tilt) begins a change as
|
|
886
|
+
* the result of either user interaction or methods such as {@link Map#flyTo} .
|
|
887
|
+
*
|
|
888
|
+
* @event pitchstart
|
|
889
|
+
* @memberof Map
|
|
890
|
+
* @instance
|
|
891
|
+
* @property {MapEventData} data
|
|
892
|
+
* @example
|
|
893
|
+
* // Initialize the map
|
|
894
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
895
|
+
* // Set an event listener that fires
|
|
896
|
+
* // just before a pitch (tilt) transition starts.
|
|
897
|
+
* map.on('pitchstart', function() {
|
|
898
|
+
* console.log('A pitchstart event occurred.');
|
|
899
|
+
* });
|
|
900
|
+
*/
|
|
901
|
+
| 'pitchstart'
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* Fired repeatedly during the map's pitch (tilt) animation between
|
|
905
|
+
* one state and another as the result of either user interaction
|
|
906
|
+
* or methods such as {@link Map#flyTo}.
|
|
907
|
+
*
|
|
908
|
+
* @event pitch
|
|
909
|
+
* @memberof Map
|
|
910
|
+
* @instance
|
|
911
|
+
* @property {MapEventData} data
|
|
912
|
+
* @example
|
|
913
|
+
* // Initialize the map
|
|
914
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
915
|
+
* // Set an event listener that fires
|
|
916
|
+
* // repeatedly during a pitch (tilt) transition.
|
|
917
|
+
* map.on('pitch', function() {
|
|
918
|
+
* console.log('A pitch event occurred.');
|
|
919
|
+
* });
|
|
920
|
+
*/
|
|
921
|
+
| 'pitch'
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* Fired immediately after the map's pitch (tilt) finishes changing as
|
|
925
|
+
* the result of either user interaction or methods such as {@link Map#flyTo}.
|
|
926
|
+
*
|
|
927
|
+
* @event pitchend
|
|
928
|
+
* @memberof Map
|
|
929
|
+
* @instance
|
|
930
|
+
* @property {MapEventData} data
|
|
931
|
+
* @example
|
|
932
|
+
* // Initialize the map
|
|
933
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
934
|
+
* // Set an event listener that fires
|
|
935
|
+
* // just after a pitch (tilt) transition ends.
|
|
936
|
+
* map.on('pitchend', function() {
|
|
937
|
+
* console.log('A pitchend event occurred.');
|
|
938
|
+
* });
|
|
939
|
+
*/
|
|
940
|
+
| 'pitchend'
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* Fired when a "box zoom" interaction starts. See {@link BoxZoomHandler}.
|
|
944
|
+
*
|
|
945
|
+
* @event boxzoomstart
|
|
946
|
+
* @memberof Map
|
|
947
|
+
* @instance
|
|
948
|
+
* @property {MapBoxZoomEvent} data
|
|
949
|
+
* @example
|
|
950
|
+
* // Initialize the map
|
|
951
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
952
|
+
* // Set an event listener that fires
|
|
953
|
+
* // just before a "box zoom" interaction starts.
|
|
954
|
+
* map.on('boxzoomstart', function() {
|
|
955
|
+
* console.log('A boxzoomstart event occurred.');
|
|
956
|
+
* });
|
|
957
|
+
*/
|
|
958
|
+
| 'boxzoomstart'
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Fired when a "box zoom" interaction ends. See {@link BoxZoomHandler}.
|
|
962
|
+
*
|
|
963
|
+
* @event boxzoomend
|
|
964
|
+
* @memberof Map
|
|
965
|
+
* @instance
|
|
966
|
+
* @type {Object}
|
|
967
|
+
* @property {MapBoxZoomEvent} data
|
|
968
|
+
* @example
|
|
969
|
+
* // Initialize the map
|
|
970
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
971
|
+
* // Set an event listener that fires
|
|
972
|
+
* // just after a "box zoom" interaction ends.
|
|
973
|
+
* map.on('boxzoomend', function() {
|
|
974
|
+
* console.log('A boxzoomend event occurred.');
|
|
975
|
+
* });
|
|
976
|
+
*/
|
|
977
|
+
| 'boxzoomend'
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Fired when the user cancels a "box zoom" interaction, or when the bounding box does not meet the minimum size threshold.
|
|
981
|
+
* See {@link BoxZoomHandler}.
|
|
982
|
+
*
|
|
983
|
+
* @event boxzoomcancel
|
|
984
|
+
* @memberof Map
|
|
985
|
+
* @instance
|
|
986
|
+
* @property {MapBoxZoomEvent} data
|
|
987
|
+
* @example
|
|
988
|
+
* // Initialize the map
|
|
989
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
990
|
+
* // Set an event listener that fires
|
|
991
|
+
* // the user cancels a "box zoom" interaction.
|
|
992
|
+
* map.on('boxzoomcancel', function() {
|
|
993
|
+
* console.log('A boxzoomcancel event occurred.');
|
|
994
|
+
* });
|
|
995
|
+
*/
|
|
996
|
+
| 'boxzoomcancel'
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Fired immediately after the map has been resized.
|
|
1000
|
+
*
|
|
1001
|
+
* @event resize
|
|
1002
|
+
* @memberof Map
|
|
1003
|
+
* @instance
|
|
1004
|
+
* @example
|
|
1005
|
+
* // Initialize the map
|
|
1006
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1007
|
+
* // Set an event listener that fires
|
|
1008
|
+
* // immediately after the map has been resized.
|
|
1009
|
+
* map.on('resize', function() {
|
|
1010
|
+
* console.log('A resize event occurred.');
|
|
1011
|
+
* });
|
|
1012
|
+
*/
|
|
1013
|
+
| 'resize'
|
|
1014
|
+
|
|
1015
|
+
/**
|
|
1016
|
+
* Fired when the WebGL context is lost.
|
|
1017
|
+
*
|
|
1018
|
+
* @event webglcontextlost
|
|
1019
|
+
* @memberof Map
|
|
1020
|
+
* @instance
|
|
1021
|
+
* @example
|
|
1022
|
+
* // Initialize the map
|
|
1023
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1024
|
+
* // Set an event listener that fires
|
|
1025
|
+
* // when the WebGL context is lost.
|
|
1026
|
+
* map.on('webglcontextlost', function() {
|
|
1027
|
+
* console.log('A webglcontextlost event occurred.');
|
|
1028
|
+
* });
|
|
1029
|
+
*/
|
|
1030
|
+
| 'webglcontextlost'
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* Fired when the WebGL context is restored.
|
|
1034
|
+
*
|
|
1035
|
+
* @event webglcontextrestored
|
|
1036
|
+
* @memberof Map
|
|
1037
|
+
* @instance
|
|
1038
|
+
* @example
|
|
1039
|
+
* // Initialize the map
|
|
1040
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1041
|
+
* // Set an event listener that fires
|
|
1042
|
+
* // when the WebGL context is restored.
|
|
1043
|
+
* map.on('webglcontextrestored', function() {
|
|
1044
|
+
* console.log('A webglcontextrestored event occurred.');
|
|
1045
|
+
* });
|
|
1046
|
+
*/
|
|
1047
|
+
| 'webglcontextrestored'
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Fired immediately after all necessary resources have been downloaded
|
|
1051
|
+
* and the first visually complete rendering of the map has occurred.
|
|
1052
|
+
*
|
|
1053
|
+
* @event load
|
|
1054
|
+
* @memberof Map
|
|
1055
|
+
* @instance
|
|
1056
|
+
* @type {Object}
|
|
1057
|
+
* @example
|
|
1058
|
+
* // Initialize the map
|
|
1059
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1060
|
+
* // Set an event listener that fires
|
|
1061
|
+
* // when the map has finished loading.
|
|
1062
|
+
* map.on('load', function() {
|
|
1063
|
+
* console.log('A load event occurred.');
|
|
1064
|
+
* });
|
|
1065
|
+
* @see [Draw GeoJSON points](https://www.mapbox.com/mapbox-gl-js/example/geojson-markers/)
|
|
1066
|
+
* @see [Add live realtime data](https://www.mapbox.com/mapbox-gl-js/example/live-geojson/)
|
|
1067
|
+
* @see [Animate a point](https://www.mapbox.com/mapbox-gl-js/example/animate-point-along-line/)
|
|
1068
|
+
*/
|
|
1069
|
+
| 'load'
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* Fired whenever the map is drawn to the screen, as the result of
|
|
1073
|
+
*
|
|
1074
|
+
* - a change to the map's position, zoom, pitch, or bearing
|
|
1075
|
+
* - a change to the map's style
|
|
1076
|
+
* - a change to a GeoJSON source
|
|
1077
|
+
* - the loading of a vector tile, GeoJSON file, glyph, or sprite
|
|
1078
|
+
*
|
|
1079
|
+
* @event render
|
|
1080
|
+
* @memberof Map
|
|
1081
|
+
* @instance
|
|
1082
|
+
* @example
|
|
1083
|
+
* // Initialize the map
|
|
1084
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1085
|
+
* // Set an event listener that fires
|
|
1086
|
+
* // whenever the map is drawn to the screen.
|
|
1087
|
+
* map.on('render', function() {
|
|
1088
|
+
* console.log('A render event occurred.');
|
|
1089
|
+
* });
|
|
1090
|
+
*/
|
|
1091
|
+
| 'render'
|
|
1092
|
+
|
|
1093
|
+
/**
|
|
1094
|
+
* Fired after the last frame rendered before the map enters an
|
|
1095
|
+
* "idle" state:
|
|
1096
|
+
*
|
|
1097
|
+
* - No camera transitions are in progress
|
|
1098
|
+
* - All currently requested tiles have loaded
|
|
1099
|
+
* - All fade/transition animations have completed
|
|
1100
|
+
*
|
|
1101
|
+
* @event idle
|
|
1102
|
+
* @memberof Map
|
|
1103
|
+
* @instance
|
|
1104
|
+
* @example
|
|
1105
|
+
* // Initialize the map
|
|
1106
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1107
|
+
* // Set an event listener that fires
|
|
1108
|
+
* // just before the map enters an "idle" state.
|
|
1109
|
+
* map.on('idle', function() {
|
|
1110
|
+
* console.log('A idle event occurred.');
|
|
1111
|
+
* });
|
|
1112
|
+
*/
|
|
1113
|
+
| 'idle'
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Fired immediately after the map has been removed with {@link Map.event:remove}.
|
|
1117
|
+
*
|
|
1118
|
+
* @event remove
|
|
1119
|
+
* @memberof Map
|
|
1120
|
+
* @instance
|
|
1121
|
+
* @example
|
|
1122
|
+
* // Initialize the map
|
|
1123
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1124
|
+
* // Set an event listener that fires
|
|
1125
|
+
* // just after the map is removed.
|
|
1126
|
+
* map.on('remove', function() {
|
|
1127
|
+
* console.log('A remove event occurred.');
|
|
1128
|
+
* });
|
|
1129
|
+
*/
|
|
1130
|
+
| 'remove'
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* Fired when an error occurs. This is GL JS's primary error reporting
|
|
1134
|
+
* mechanism. We use an event instead of `throw` to better accommodate
|
|
1135
|
+
* asyncronous operations. If no listeners are bound to the `error` event, the
|
|
1136
|
+
* error will be printed to the console.
|
|
1137
|
+
*
|
|
1138
|
+
* @event error
|
|
1139
|
+
* @memberof Map
|
|
1140
|
+
* @instance
|
|
1141
|
+
* @property {{error: {message: string}}} data
|
|
1142
|
+
* @example
|
|
1143
|
+
* // Initialize the map
|
|
1144
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1145
|
+
* // Set an event listener that fires
|
|
1146
|
+
* // when an error occurs.
|
|
1147
|
+
* map.on('error', function() {
|
|
1148
|
+
* console.log('A error event occurred.');
|
|
1149
|
+
* });
|
|
1150
|
+
*/
|
|
1151
|
+
| 'error'
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* Fired when any map data loads or changes. See {@link MapDataEvent}
|
|
1155
|
+
* for more information.
|
|
1156
|
+
*
|
|
1157
|
+
* @event data
|
|
1158
|
+
* @memberof Map
|
|
1159
|
+
* @instance
|
|
1160
|
+
* @property {MapDataEvent} data
|
|
1161
|
+
* @example
|
|
1162
|
+
* // Initialize the map
|
|
1163
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1164
|
+
* // Set an event listener that fires
|
|
1165
|
+
* // when map data loads or changes.
|
|
1166
|
+
* map.on('data', function() {
|
|
1167
|
+
* console.log('A data event occurred.');
|
|
1168
|
+
* });
|
|
1169
|
+
* @see [Display HTML clusters with custom properties](https://docs.mapbox.com/mapbox-gl-js/example/cluster-html/)
|
|
1170
|
+
*/
|
|
1171
|
+
| 'data'
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* Fired when the map's style loads or changes. See
|
|
1175
|
+
* {@link MapDataEvent} for more information.
|
|
1176
|
+
*
|
|
1177
|
+
* @event styledata
|
|
1178
|
+
* @memberof Map
|
|
1179
|
+
* @instance
|
|
1180
|
+
* @property {MapDataEvent} data
|
|
1181
|
+
* @example
|
|
1182
|
+
* // Initialize the map
|
|
1183
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1184
|
+
* // Set an event listener that fires
|
|
1185
|
+
* // when the map's style loads or changes.
|
|
1186
|
+
* map.on('styledata', function() {
|
|
1187
|
+
* console.log('A styledata event occurred.');
|
|
1188
|
+
* });
|
|
1189
|
+
*/
|
|
1190
|
+
| 'styledata'
|
|
1191
|
+
|
|
1192
|
+
/**
|
|
1193
|
+
* Fired when one of the map's sources loads or changes, including if a tile belonging
|
|
1194
|
+
* to a source loads or changes. See {@link MapDataEvent} for more information.
|
|
1195
|
+
*
|
|
1196
|
+
* @event sourcedata
|
|
1197
|
+
* @memberof Map
|
|
1198
|
+
* @instance
|
|
1199
|
+
* @property {MapDataEvent} data
|
|
1200
|
+
* @example
|
|
1201
|
+
* // Initialize the map
|
|
1202
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1203
|
+
* // Set an event listener that fires
|
|
1204
|
+
* // when one of the map's sources loads or changes.
|
|
1205
|
+
* map.on('sourcedata', function() {
|
|
1206
|
+
* console.log('A sourcedata event occurred.');
|
|
1207
|
+
* });
|
|
1208
|
+
*/
|
|
1209
|
+
| 'sourcedata'
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* Fired when any map data (style, source, tile, etc) begins loading or
|
|
1213
|
+
* changing asyncronously. All `dataloading` events are followed by a `data`
|
|
1214
|
+
* or `error` event. See {@link MapDataEvent} for more information.
|
|
1215
|
+
*
|
|
1216
|
+
* @event dataloading
|
|
1217
|
+
* @memberof Map
|
|
1218
|
+
* @instance
|
|
1219
|
+
* @property {MapDataEvent} data
|
|
1220
|
+
* @example
|
|
1221
|
+
* // Initialize the map
|
|
1222
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1223
|
+
* // Set an event listener that fires
|
|
1224
|
+
* // when any map data begins loading
|
|
1225
|
+
* // or changing asynchronously.
|
|
1226
|
+
* map.on('dataloading', function() {
|
|
1227
|
+
* console.log('A dataloading event occurred.');
|
|
1228
|
+
* });
|
|
1229
|
+
*/
|
|
1230
|
+
| 'dataloading'
|
|
1231
|
+
|
|
1232
|
+
/**
|
|
1233
|
+
* Fired when the map's style begins loading or changing asyncronously.
|
|
1234
|
+
* All `styledataloading` events are followed by a `styledata`
|
|
1235
|
+
* or `error` event. See {@link MapDataEvent} for more information.
|
|
1236
|
+
*
|
|
1237
|
+
* @event styledataloading
|
|
1238
|
+
* @memberof Map
|
|
1239
|
+
* @instance
|
|
1240
|
+
* @property {MapDataEvent} data
|
|
1241
|
+
* @example
|
|
1242
|
+
* // Initialize the map
|
|
1243
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1244
|
+
* // Set an event listener that fires
|
|
1245
|
+
* // map's style begins loading or
|
|
1246
|
+
* // changing asyncronously.
|
|
1247
|
+
* map.on('styledataloading', function() {
|
|
1248
|
+
* console.log('A styledataloading event occurred.');
|
|
1249
|
+
* });
|
|
1250
|
+
*/
|
|
1251
|
+
| 'styledataloading'
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* Fired when one of the map's sources begins loading or changing asyncronously.
|
|
1255
|
+
* All `sourcedataloading` events are followed by a `sourcedata` or `error` event.
|
|
1256
|
+
* See {@link MapDataEvent} for more information.
|
|
1257
|
+
*
|
|
1258
|
+
* @event sourcedataloading
|
|
1259
|
+
* @memberof Map
|
|
1260
|
+
* @instance
|
|
1261
|
+
* @property {MapDataEvent} data
|
|
1262
|
+
* @example
|
|
1263
|
+
* // Initialize the map
|
|
1264
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1265
|
+
* // Set an event listener that fires
|
|
1266
|
+
* // map's sources begin loading or
|
|
1267
|
+
* // changing asyncronously.
|
|
1268
|
+
* map.on('sourcedataloading', function() {
|
|
1269
|
+
* console.log('A sourcedataloading event occurred.');
|
|
1270
|
+
* });
|
|
1271
|
+
*/
|
|
1272
|
+
| 'sourcedataloading'
|
|
1273
|
+
|
|
1274
|
+
/**
|
|
1275
|
+
* Fired when an icon or pattern needed by the style is missing. The missing image can
|
|
1276
|
+
* be added with {@link Map#addImage} within this event listener callback to prevent the image from
|
|
1277
|
+
* being skipped. This event can be used to dynamically generate icons and patterns.
|
|
1278
|
+
*
|
|
1279
|
+
* @event styleimagemissing
|
|
1280
|
+
* @memberof Map
|
|
1281
|
+
* @instance
|
|
1282
|
+
* @property {string} id The id of the missing image.
|
|
1283
|
+
* @example
|
|
1284
|
+
* // Initialize the map
|
|
1285
|
+
* var map = new mapboxgl.Map({ // map options });
|
|
1286
|
+
* // Set an event listener that fires
|
|
1287
|
+
* // an icon or pattern is missing.
|
|
1288
|
+
* map.on('styleimagemissing', function() {
|
|
1289
|
+
* console.log('A styleimagemissing event occurred.');
|
|
1290
|
+
* });
|
|
1291
|
+
* @see [Generate and add a missing icon to the map](https://mapbox.com/mapbox-gl-js/example/add-image-missing-generated/)
|
|
1292
|
+
*/
|
|
1293
|
+
| 'styleimagemissing'
|
|
1294
|
+
|
|
1295
|
+
/**
|
|
1296
|
+
* @event style.load
|
|
1297
|
+
* @memberof Map
|
|
1298
|
+
* @instance
|
|
1299
|
+
* @private
|
|
1300
|
+
*/
|
|
1301
|
+
| 'style.load';
|