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