maplibre-gl 2.0.5 → 2.1.3
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/build/{banner.js → banner.ts} +1 -1
- package/build/generate-query-test-fixtures.ts +123 -0
- package/build/generate-shaders.ts +35 -0
- package/build/generate-struct-arrays.ts +7 -7
- package/build/generate-style-code.ts +8 -8
- package/build/generate-style-spec.ts +5 -4
- package/build/generate-typings.ts +16 -0
- package/build/readme.md +8 -18
- package/build/release-notes.js +9 -13
- package/build/{rollup_plugin_minify_style_spec.js → rollup_plugin_minify_style_spec.ts} +4 -3
- package/build/{rollup_plugins.js → rollup_plugins.ts} +12 -26
- package/dist/maplibre-gl-dev.js +54885 -0
- package/dist/maplibre-gl.css +1 -1
- package/dist/maplibre-gl.d.ts +1574 -1022
- package/dist/maplibre-gl.js +3 -3
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +94 -131
- package/src/css/maplibre-gl.css +49 -49
- package/src/data/{array_types.ts → array_types.g.ts} +0 -0
- package/src/data/bucket/circle_bucket.ts +1 -1
- package/src/data/bucket/fill_bucket.test.ts +1 -1
- package/src/data/bucket/fill_bucket.ts +4 -4
- package/src/data/bucket/fill_extrusion_bucket.ts +1 -1
- package/src/data/bucket/line_bucket.test.ts +1 -1
- package/src/data/bucket/line_bucket.ts +6 -6
- package/src/data/bucket/symbol_bucket.test.ts +16 -16
- package/src/data/bucket/symbol_bucket.ts +56 -56
- package/src/data/bucket.ts +43 -43
- package/src/data/dem_data.ts +12 -12
- package/src/data/evaluation_feature.ts +10 -10
- package/src/data/feature_index.ts +37 -37
- package/src/data/feature_position_map.ts +5 -5
- package/src/data/index_array_type.ts +1 -1
- package/src/data/load_geometry.test.ts +1 -1
- package/src/data/program_configuration.ts +47 -47
- package/src/data/segment.ts +14 -14
- package/src/geo/edge_insets.ts +2 -2
- package/src/geo/lng_lat.ts +4 -4
- package/src/geo/lng_lat_bounds.ts +35 -35
- package/src/geo/mercator_coordinate.ts +5 -5
- package/src/geo/transform.test.ts +1 -1
- package/src/geo/transform.ts +14 -14
- package/src/gl/context.ts +3 -3
- package/src/gl/types.ts +19 -19
- package/src/gl/value.ts +6 -6
- package/src/gl/vertex_buffer.test.ts +1 -1
- package/src/index.ts +24 -9
- package/src/render/draw_circle.ts +8 -8
- package/src/render/draw_collision_debug.ts +5 -5
- package/src/render/draw_debug.ts +1 -1
- package/src/render/draw_line.ts +4 -4
- package/src/render/draw_symbol.ts +21 -21
- package/src/render/glyph_atlas.ts +12 -12
- package/src/render/glyph_manager.test.ts +10 -21
- package/src/render/glyph_manager.ts +34 -33
- package/src/render/image_manager.ts +4 -4
- package/src/render/painter.ts +16 -14
- package/src/render/program/background_program.ts +29 -29
- package/src/render/program/circle_program.ts +11 -11
- package/src/render/program/clipping_mask_program.ts +1 -1
- package/src/render/program/collision_program.ts +9 -9
- package/src/render/program/debug_program.ts +4 -4
- package/src/render/program/fill_extrusion_program.ts +31 -31
- package/src/render/program/fill_program.ts +29 -29
- package/src/render/program/heatmap_program.ts +12 -12
- package/src/render/program/hillshade_program.ts +12 -12
- package/src/render/program/line_program.ts +41 -41
- package/src/render/program/pattern.ts +28 -28
- package/src/render/program/raster_program.ts +21 -21
- package/src/render/program/symbol_program.ts +97 -97
- package/src/render/program.ts +25 -25
- package/src/render/texture.ts +9 -9
- package/src/render/uniform_binding.ts +1 -1
- package/src/render/vertex_array_object.ts +13 -13
- package/src/shaders/_prelude.fragment.glsl.g.ts +2 -0
- package/src/shaders/_prelude.vertex.glsl.g.ts +2 -0
- package/src/shaders/background.fragment.glsl.g.ts +2 -0
- package/src/shaders/background.vertex.glsl.g.ts +2 -0
- package/src/shaders/background_pattern.fragment.glsl.g.ts +2 -0
- package/src/shaders/background_pattern.vertex.glsl.g.ts +2 -0
- package/src/shaders/circle.fragment.glsl.g.ts +2 -0
- package/src/shaders/circle.vertex.glsl.g.ts +2 -0
- package/src/shaders/clipping_mask.fragment.glsl.g.ts +2 -0
- package/src/shaders/clipping_mask.vertex.glsl.g.ts +2 -0
- package/src/shaders/collision_box.fragment.glsl.g.ts +2 -0
- package/src/shaders/collision_box.vertex.glsl.g.ts +2 -0
- package/src/shaders/collision_circle.fragment.glsl.g.ts +2 -0
- package/src/shaders/collision_circle.vertex.glsl.g.ts +2 -0
- package/src/shaders/debug.fragment.glsl.g.ts +2 -0
- package/src/shaders/debug.vertex.glsl.g.ts +2 -0
- package/src/shaders/fill.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill.vertex.glsl.g.ts +2 -0
- package/src/shaders/fill_extrusion.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill_extrusion.vertex.glsl.g.ts +2 -0
- package/src/shaders/fill_extrusion_pattern.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill_extrusion_pattern.vertex.glsl.g.ts +2 -0
- package/src/shaders/fill_outline.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill_outline.vertex.glsl.g.ts +2 -0
- package/src/shaders/fill_outline_pattern.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill_outline_pattern.vertex.glsl.g.ts +2 -0
- package/src/shaders/fill_pattern.fragment.glsl.g.ts +2 -0
- package/src/shaders/fill_pattern.vertex.glsl.g.ts +2 -0
- package/src/shaders/heatmap.fragment.glsl.g.ts +2 -0
- package/src/shaders/heatmap.vertex.glsl.g.ts +2 -0
- package/src/shaders/heatmap_texture.fragment.glsl.g.ts +2 -0
- package/src/shaders/heatmap_texture.vertex.glsl.g.ts +2 -0
- package/src/shaders/hillshade.fragment.glsl.g.ts +2 -0
- package/src/shaders/hillshade.vertex.glsl.g.ts +2 -0
- package/src/shaders/hillshade_prepare.fragment.glsl.g.ts +2 -0
- package/src/shaders/hillshade_prepare.vertex.glsl.g.ts +2 -0
- package/src/shaders/line.fragment.glsl.g.ts +2 -0
- package/src/shaders/line.vertex.glsl.g.ts +2 -0
- package/src/shaders/line_gradient.fragment.glsl.g.ts +2 -0
- package/src/shaders/line_gradient.vertex.glsl.g.ts +2 -0
- package/src/shaders/line_pattern.fragment.glsl.g.ts +2 -0
- package/src/shaders/line_pattern.vertex.glsl.g.ts +2 -0
- package/src/shaders/line_sdf.fragment.glsl.g.ts +2 -0
- package/src/shaders/line_sdf.vertex.glsl.g.ts +2 -0
- package/src/shaders/raster.fragment.glsl.g.ts +2 -0
- package/src/shaders/raster.vertex.glsl.g.ts +2 -0
- package/src/shaders/shaders.ts +52 -55
- package/src/shaders/symbol_icon.fragment.glsl.g.ts +2 -0
- package/src/shaders/symbol_icon.vertex.glsl.g.ts +2 -0
- package/src/shaders/symbol_sdf.fragment.glsl.g.ts +2 -0
- package/src/shaders/symbol_sdf.vertex.glsl.g.ts +2 -0
- package/src/shaders/symbol_text_and_icon.fragment.glsl.g.ts +2 -0
- package/src/shaders/symbol_text_and_icon.vertex.glsl.g.ts +2 -0
- package/src/source/canvas_source.test.ts +11 -12
- package/src/source/canvas_source.ts +4 -4
- package/src/source/geojson_source.test.ts +2 -1
- package/src/source/geojson_source.ts +1 -1
- package/src/source/geojson_worker_source.ts +23 -23
- package/src/source/geojson_wrapper.ts +8 -8
- package/src/source/image_source.test.ts +2 -2
- package/src/source/image_source.ts +6 -6
- package/src/source/pixels_to_tile_units.ts +6 -6
- package/src/source/query_features.ts +20 -20
- package/src/source/raster_dem_tile_source.test.ts +4 -3
- package/src/source/raster_dem_tile_source.ts +1 -1
- package/src/source/raster_tile_source.test.ts +4 -3
- package/src/source/raster_tile_source.ts +1 -1
- package/src/source/rtl_text_plugin.ts +10 -10
- package/src/source/source.ts +29 -29
- package/src/source/source_cache.test.ts +33 -1
- package/src/source/source_cache.ts +7 -5
- package/src/source/source_state.ts +1 -1
- package/src/source/tile.test.ts +3 -3
- package/src/source/tile.ts +15 -15
- package/src/source/tile_cache.test.ts +6 -4
- package/src/source/tile_cache.ts +6 -6
- package/src/source/tile_id.test.ts +10 -13
- package/src/source/tile_id.ts +2 -2
- package/src/source/vector_tile_source.test.ts +17 -5
- package/src/source/vector_tile_source.ts +4 -5
- package/src/source/vector_tile_worker_source.test.ts +4 -4
- package/src/source/vector_tile_worker_source.ts +5 -5
- package/src/source/worker.test.ts +1 -1
- package/src/source/worker.ts +22 -22
- package/src/source/worker_source.ts +56 -56
- package/src/source/worker_tile.ts +4 -4
- package/src/style/evaluation_parameters.ts +3 -3
- package/src/style/format_section_override.test.ts +1 -1
- package/src/style/light.ts +10 -10
- package/src/style/load_glyph_range.test.ts +3 -5
- package/src/style/load_glyph_range.ts +6 -6
- package/src/style/load_sprite.ts +5 -4
- package/src/style/pauseable_placement.ts +1 -1
- package/src/style/properties.ts +70 -70
- package/src/style/query_utils.ts +7 -7
- package/src/style/style.test.ts +26 -15
- package/src/style/style.ts +30 -30
- package/src/style/style_glyph.ts +8 -8
- package/src/style/style_image.ts +58 -58
- package/src/style/style_layer/background_style_layer.ts +2 -2
- package/src/style/style_layer/{background_style_layer_properties.ts → background_style_layer_properties.g.ts} +0 -0
- package/src/style/style_layer/circle_style_layer.ts +10 -10
- package/src/style/style_layer/{circle_style_layer_properties.ts → circle_style_layer_properties.g.ts} +0 -0
- package/src/style/style_layer/custom_style_layer.ts +19 -19
- package/src/style/style_layer/fill_extrusion_style_layer.ts +11 -11
- package/src/style/style_layer/{fill_extrusion_style_layer_properties.ts → fill_extrusion_style_layer_properties.g.ts} +0 -0
- package/src/style/style_layer/fill_style_layer.ts +9 -9
- package/src/style/style_layer/{fill_style_layer_properties.ts → fill_style_layer_properties.g.ts} +0 -0
- package/src/style/style_layer/heatmap_style_layer.ts +2 -2
- package/src/style/style_layer/{heatmap_style_layer_properties.ts → heatmap_style_layer_properties.g.ts} +0 -0
- package/src/style/style_layer/hillshade_style_layer.ts +2 -2
- package/src/style/style_layer/{hillshade_style_layer_properties.ts → hillshade_style_layer_properties.g.ts} +0 -0
- package/src/style/style_layer/line_style_layer.ts +9 -9
- package/src/style/style_layer/{line_style_layer_properties.ts → line_style_layer_properties.g.ts} +0 -0
- package/src/style/style_layer/raster_style_layer.ts +2 -2
- package/src/style/style_layer/{raster_style_layer_properties.ts → raster_style_layer_properties.g.ts} +0 -0
- package/src/style/style_layer/symbol_style_layer.ts +26 -7
- package/src/style/style_layer/{symbol_style_layer_properties.ts → symbol_style_layer_properties.g.ts} +6 -0
- package/src/style/style_layer.ts +10 -10
- package/src/style/style_layer_index.ts +3 -3
- package/src/style/validate_style.ts +15 -15
- package/src/style-spec/CHANGELOG.md +6 -0
- package/src/style-spec/error/validation_error.ts +1 -1
- package/src/style-spec/expression/compound_expression.ts +3 -3
- package/src/style-spec/expression/definitions/format.ts +11 -11
- package/src/style-spec/expression/definitions/interpolate.ts +5 -5
- package/src/style-spec/expression/definitions/match.ts +2 -2
- package/src/style-spec/expression/definitions/number_format.ts +11 -11
- package/src/style-spec/expression/expression.ts +8 -8
- package/src/style-spec/expression/index.ts +97 -97
- package/src/style-spec/expression/parsing_context.ts +11 -11
- package/src/style-spec/expression/types/collator.ts +9 -9
- package/src/style-spec/expression/types/resolved_image.ts +2 -2
- package/src/style-spec/expression/types.ts +14 -14
- package/src/style-spec/expression/values.ts +1 -1
- package/src/style-spec/feature_filter/index.ts +66 -66
- package/src/style-spec/function/convert.ts +3 -3
- package/src/style-spec/package.json +1 -1
- package/src/style-spec/reference/v8.json +68 -2
- package/src/style-spec/style-spec.ts +44 -44
- package/src/style-spec/types.ts +2 -0
- package/src/style-spec/util/color_spaces.ts +8 -8
- package/src/style-spec/util/result.ts +4 -4
- package/src/style-spec/validate/validate_filter.ts +58 -58
- package/src/style-spec/validate/validate_source.ts +63 -63
- package/src/style-spec/visit.ts +11 -11
- package/src/symbol/collision_feature.test.ts +1 -1
- package/src/symbol/collision_feature.ts +10 -10
- package/src/symbol/collision_index.ts +43 -43
- package/src/symbol/cross_tile_symbol_index.ts +17 -17
- package/src/symbol/get_anchors.ts +16 -16
- package/src/symbol/grid_index.test.ts +42 -19
- package/src/symbol/grid_index.ts +69 -40
- package/src/symbol/placement.ts +124 -95
- package/src/symbol/projection.ts +30 -30
- package/src/symbol/quads.ts +30 -30
- package/src/symbol/shaping.ts +160 -160
- package/src/symbol/symbol_layout.ts +119 -119
- package/src/symbol/symbol_size.ts +29 -29
- package/src/symbol/symbol_style_layer.test.ts +49 -2
- package/src/types/cancelable.ts +1 -1
- package/src/types/tilejson.ts +13 -13
- package/src/ui/anchor.ts +1 -1
- package/src/ui/camera.test.ts +9 -9
- package/src/ui/camera.ts +18 -18
- package/src/ui/control/attribution_control.test.ts +51 -16
- package/src/ui/control/attribution_control.ts +35 -16
- package/src/ui/control/control.ts +40 -40
- package/src/ui/control/fullscreen_control.ts +1 -1
- package/src/ui/control/geolocate_control.test.ts +1 -1
- package/src/ui/control/geolocate_control.ts +102 -102
- package/src/ui/control/logo_control.test.ts +5 -4
- package/src/ui/control/navigation_control.ts +3 -3
- package/src/ui/control/scale_control.test.ts +2 -2
- package/src/ui/control/scale_control.ts +5 -5
- package/src/ui/events.ts +289 -200
- package/src/ui/handler/box_zoom.test.ts +1 -1
- package/src/ui/handler/box_zoom.ts +1 -1
- package/src/ui/handler/dblclick_zoom.test.ts +1 -1
- package/src/ui/handler/drag_pan.test.ts +1 -1
- package/src/ui/handler/drag_rotate.test.ts +1 -1
- package/src/ui/handler/keyboard.test.ts +1 -1
- package/src/ui/handler/keyboard.ts +51 -51
- package/src/ui/handler/map_event.test.ts +1 -1
- 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 +1 -1
- package/src/ui/handler/scroll_zoom.test.ts +3 -2
- package/src/ui/handler/scroll_zoom.ts +9 -9
- package/src/ui/handler/shim/drag_pan.ts +4 -4
- package/src/ui/handler/shim/drag_rotate.ts +1 -1
- package/src/ui/handler/shim/touch_zoom_rotate.ts +1 -1
- package/src/ui/handler/tap_recognizer.ts +4 -4
- package/src/ui/handler/touch_pan.ts +2 -2
- package/src/ui/handler/touch_zoom_rotate.test.ts +1 -1
- package/src/ui/handler/touch_zoom_rotate.ts +1 -1
- package/src/ui/handler_inertia.ts +6 -6
- package/src/ui/handler_manager.ts +44 -44
- package/src/ui/map/isMoving.test.ts +1 -1
- package/src/ui/map/isRotating.test.ts +1 -1
- package/src/ui/map/isZooming.test.ts +1 -1
- package/src/ui/map.test.ts +87 -14
- package/src/ui/map.ts +136 -106
- package/src/ui/map_events.test.ts +1 -1
- package/src/ui/marker.test.ts +12 -12
- package/src/ui/marker.ts +37 -37
- package/src/ui/popup.test.ts +7 -7
- package/src/ui/popup.ts +9 -9
- package/src/util/actor.test.ts +41 -10
- package/src/util/actor.ts +8 -8
- package/src/util/ajax.test.ts +29 -21
- package/src/util/ajax.ts +51 -30
- package/src/util/browser.ts +1 -1
- package/src/util/classify_rings.test.ts +1 -1
- package/src/util/color_ramp.ts +5 -5
- package/src/util/config.ts +2 -2
- package/src/util/dispatcher.ts +1 -1
- package/src/util/dom.ts +2 -2
- package/src/util/evented.ts +1 -1
- package/src/util/find_pole_of_inaccessibility.ts +3 -3
- package/src/util/image.ts +5 -5
- package/src/util/performance.ts +7 -7
- package/src/util/request_manager.ts +4 -4
- package/src/util/resolve_tokens.ts +4 -4
- package/src/util/struct_array.test.ts +1 -1
- package/src/util/struct_array.ts +15 -15
- package/src/util/task_queue.ts +3 -3
- package/src/util/tile_request_cache.ts +3 -3
- package/src/util/transferable_grid_index.ts +4 -4
- package/src/util/util.ts +8 -8
- package/src/util/web_worker.ts +4 -68
- package/src/util/web_worker_transfer.test.ts +3 -0
- package/src/util/web_worker_transfer.ts +21 -17
- package/src/util/worker_pool.ts +1 -1
- package/build/.eslintrc +0 -21
- package/build/glsl_to_js.js +0 -12
- package/build/post-ts-build.js +0 -43
- package/build/release-notes.md.ejs +0 -8
- package/build/test/build-tape.js +0 -17
- package/build/web_worker_replacement.js +0 -5
- package/dist/package.json +0 -1
- package/src/style-spec/validate_spec.test.ts +0 -29
- package/src/symbol/shaping.test.ts +0 -392
- package/src/types/glsl.d.ts +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Map from '../map';
|
|
2
2
|
import DOM from '../../util/dom';
|
|
3
|
-
import simulate from '../../../test/
|
|
3
|
+
import simulate from '../../../test/unit/lib/simulate_interaction';
|
|
4
4
|
import {setWebGlContext, setPerformance, setMatchMedia} from '../../util/test/util';
|
|
5
5
|
|
|
6
6
|
function createMap(clickTolerance) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import DOM from '../../util/dom';
|
|
2
|
-
import simulate from '../../../test/
|
|
2
|
+
import simulate from '../../../test/unit/lib/simulate_interaction';
|
|
3
3
|
import {setMatchMedia, setPerformance, setWebGlContext} from '../../util/test/util';
|
|
4
4
|
import Map, {MapOptions} from '../map';
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {extend} from '../../util/util';
|
|
2
2
|
import Map from '../map';
|
|
3
3
|
import DOM from '../../util/dom';
|
|
4
|
-
import simulate from '../../../test/
|
|
4
|
+
import simulate from '../../../test/unit/lib/simulate_interaction';
|
|
5
5
|
import browser from '../../util/browser';
|
|
6
6
|
|
|
7
7
|
import {setMatchMedia, setPerformance, setWebGlContext} from '../../util/test/util';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Map from '../../ui/map';
|
|
2
2
|
import DOM from '../../util/dom';
|
|
3
|
-
import simulate from '../../../test/
|
|
3
|
+
import simulate from '../../../test/unit/lib/simulate_interaction';
|
|
4
4
|
import {extend} from '../../util/util';
|
|
5
5
|
import {setMatchMedia, setPerformance, setWebGlContext} from '../../util/test/util';
|
|
6
6
|
|
|
@@ -53,57 +53,57 @@ class KeyboardHandler {
|
|
|
53
53
|
let yDir = 0;
|
|
54
54
|
|
|
55
55
|
switch (e.keyCode) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
56
|
+
case 61:
|
|
57
|
+
case 107:
|
|
58
|
+
case 171:
|
|
59
|
+
case 187:
|
|
60
|
+
zoomDir = 1;
|
|
61
|
+
break;
|
|
62
|
+
|
|
63
|
+
case 189:
|
|
64
|
+
case 109:
|
|
65
|
+
case 173:
|
|
66
|
+
zoomDir = -1;
|
|
67
|
+
break;
|
|
68
|
+
|
|
69
|
+
case 37:
|
|
70
|
+
if (e.shiftKey) {
|
|
71
|
+
bearingDir = -1;
|
|
72
|
+
} else {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
xDir = -1;
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
|
|
78
|
+
case 39:
|
|
79
|
+
if (e.shiftKey) {
|
|
80
|
+
bearingDir = 1;
|
|
81
|
+
} else {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
xDir = 1;
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
|
|
87
|
+
case 38:
|
|
88
|
+
if (e.shiftKey) {
|
|
89
|
+
pitchDir = 1;
|
|
90
|
+
} else {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
yDir = -1;
|
|
93
|
+
}
|
|
94
|
+
break;
|
|
95
|
+
|
|
96
|
+
case 40:
|
|
97
|
+
if (e.shiftKey) {
|
|
98
|
+
pitchDir = -1;
|
|
99
|
+
} else {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
yDir = 1;
|
|
102
|
+
}
|
|
103
|
+
break;
|
|
104
|
+
|
|
105
|
+
default:
|
|
106
|
+
return;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
if (this._rotationDisabled) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Map, {MapOptions} from '../map';
|
|
2
2
|
import DOM from '../../util/dom';
|
|
3
|
-
import simulate from '../../../test/
|
|
3
|
+
import simulate from '../../../test/unit/lib/simulate_interaction';
|
|
4
4
|
import {setMatchMedia, setPerformance, setWebGlContext} from '../../util/test/util';
|
|
5
5
|
|
|
6
6
|
function createMap() {
|
package/src/ui/handler/mouse.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {extend} from '../../util/util';
|
|
2
2
|
import Map from '../../ui/map';
|
|
3
3
|
import DOM from '../../util/dom';
|
|
4
|
-
import simulate from '../../../test/
|
|
4
|
+
import simulate from '../../../test/unit/lib/simulate_interaction';
|
|
5
5
|
import browser from '../../util/browser';
|
|
6
6
|
import {setMatchMedia, setPerformance, setWebGlContext} from '../../util/test/util';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import browser from '../../util/browser';
|
|
2
2
|
import Map from '../../ui/map';
|
|
3
3
|
import DOM from '../../util/dom';
|
|
4
|
-
import simulate from '../../../test/
|
|
4
|
+
import simulate from '../../../test/unit/lib/simulate_interaction';
|
|
5
5
|
import {setMatchMedia, setPerformance, setWebGlContext} from '../../util/test/util';
|
|
6
6
|
|
|
7
7
|
function createMap() {
|
|
@@ -46,7 +46,7 @@ describe('ScrollZoomHandler', () => {
|
|
|
46
46
|
map.remove();
|
|
47
47
|
});
|
|
48
48
|
|
|
49
|
-
test('Zooms for single mouse wheel tick with non-magical deltaY',
|
|
49
|
+
test('Zooms for single mouse wheel tick with non-magical deltaY', done => {
|
|
50
50
|
const browserNow = jest.spyOn(browser, 'now');
|
|
51
51
|
const now = 1555555555555;
|
|
52
52
|
browserNow.mockReturnValue(now);
|
|
@@ -60,6 +60,7 @@ describe('ScrollZoomHandler', () => {
|
|
|
60
60
|
simulate.wheel(map.getCanvas(), {type: 'wheel', deltaY: -20});
|
|
61
61
|
map.on('zoomstart', () => {
|
|
62
62
|
map.remove();
|
|
63
|
+
done();
|
|
63
64
|
});
|
|
64
65
|
});
|
|
65
66
|
|
|
@@ -47,9 +47,9 @@ class ScrollZoomHandler {
|
|
|
47
47
|
_delta: number;
|
|
48
48
|
_easing: ((a: number) => number);
|
|
49
49
|
_prevEase: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
start: number;
|
|
51
|
+
duration: number;
|
|
52
|
+
easing: (_: number) => number;
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
_frameId: boolean;
|
|
@@ -86,12 +86,12 @@ class ScrollZoomHandler {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
89
|
+
* Set the zoom rate of a mouse wheel
|
|
90
|
+
* @param {number} [wheelZoomRate=1/450] The rate used to scale mouse wheel movement to a zoom value.
|
|
91
|
+
* @example
|
|
92
|
+
* // Slow down zoom of mouse wheel
|
|
93
|
+
* map.scrollZoom.setWheelZoomRate(1/600);
|
|
94
|
+
*/
|
|
95
95
|
setWheelZoomRate(wheelZoomRate: number) {
|
|
96
96
|
this._wheelZoomRate = wheelZoomRate;
|
|
97
97
|
}
|
|
@@ -2,10 +2,10 @@ import type {MousePanHandler} from '../mouse';
|
|
|
2
2
|
import type TouchPanHandler from './../touch_pan';
|
|
3
3
|
|
|
4
4
|
export type DragPanOptions = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
linearity?: number;
|
|
6
|
+
easing?: (t: number) => number;
|
|
7
|
+
deceleration?: number;
|
|
8
|
+
maxSpeed?: number;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -18,7 +18,7 @@ export default class DragRotateHandler {
|
|
|
18
18
|
* @private
|
|
19
19
|
*/
|
|
20
20
|
constructor(options: {
|
|
21
|
-
|
|
21
|
+
pitchWithRotate: boolean;
|
|
22
22
|
}, mouseRotate: MouseRotateHandler, mousePitch: MousePitchHandler) {
|
|
23
23
|
this._pitchWithRotate = options.pitchWithRotate;
|
|
24
24
|
this._mouseRotate = mouseRotate;
|
|
@@ -41,7 +41,7 @@ export default class TouchZoomRotateHandler {
|
|
|
41
41
|
* map.touchZoomRotate.enable({ around: 'center' });
|
|
42
42
|
*/
|
|
43
43
|
enable(options?: {
|
|
44
|
-
|
|
44
|
+
around?: 'center';
|
|
45
45
|
} | null) {
|
|
46
46
|
this._touchZoom.enable(options);
|
|
47
47
|
if (!this._rotationDisabled) this._touchRotate.enable(options);
|
|
@@ -20,11 +20,11 @@ export class SingleTapRecognizer {
|
|
|
20
20
|
startTime: number;
|
|
21
21
|
aborted: boolean;
|
|
22
22
|
touches: {
|
|
23
|
-
|
|
23
|
+
[k in number | string]: Point;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
constructor(options: {
|
|
27
|
-
|
|
27
|
+
numTouches: number;
|
|
28
28
|
}) {
|
|
29
29
|
this.reset();
|
|
30
30
|
this.numTouches = options.numTouches;
|
|
@@ -92,8 +92,8 @@ export class TapRecognizer {
|
|
|
92
92
|
count: number;
|
|
93
93
|
|
|
94
94
|
constructor(options: {
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
numTaps: number;
|
|
96
|
+
numTouches: number;
|
|
97
97
|
}) {
|
|
98
98
|
this.singleTap = new SingleTapRecognizer(options);
|
|
99
99
|
this.numTaps = options.numTaps;
|
|
@@ -6,14 +6,14 @@ export default class TouchPanHandler {
|
|
|
6
6
|
_enabled: boolean;
|
|
7
7
|
_active: boolean;
|
|
8
8
|
_touches: {
|
|
9
|
-
|
|
9
|
+
[k in string | number]: Point;
|
|
10
10
|
};
|
|
11
11
|
_minTouches: number;
|
|
12
12
|
_clickTolerance: number;
|
|
13
13
|
_sum: Point;
|
|
14
14
|
|
|
15
15
|
constructor(options: {
|
|
16
|
-
|
|
16
|
+
clickTolerance: number;
|
|
17
17
|
}) {
|
|
18
18
|
this._minTouches = 1;
|
|
19
19
|
this._clickTolerance = options.clickTolerance || 1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Map, {MapOptions} from '../map';
|
|
2
2
|
import Marker from '../marker';
|
|
3
3
|
import DOM from '../../util/dom';
|
|
4
|
-
import simulate from '../../../test/
|
|
4
|
+
import simulate from '../../../test/unit/lib/simulate_interaction';
|
|
5
5
|
import {setMatchMedia, setPerformance, setWebGlContext} from '../../util/test/util';
|
|
6
6
|
|
|
7
7
|
function createMap() {
|
|
@@ -30,10 +30,10 @@ const defaultPitchInertiaOptions = extend({
|
|
|
30
30
|
}, defaultInertiaOptions);
|
|
31
31
|
|
|
32
32
|
export type InertiaOptions = {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
linearity: number;
|
|
34
|
+
easing: (t: number) => number;
|
|
35
|
+
deceleration: number;
|
|
36
|
+
maxSpeed: number;
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
export type InputEvent = MouseEvent | TouchEvent | KeyboardEvent | WheelEvent;
|
|
@@ -41,8 +41,8 @@ export type InputEvent = MouseEvent | TouchEvent | KeyboardEvent | WheelEvent;
|
|
|
41
41
|
export default class HandlerInertia {
|
|
42
42
|
_map: Map;
|
|
43
43
|
_inertiaBuffer: Array<{
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
time: number;
|
|
45
|
+
settings: any;
|
|
46
46
|
}>;
|
|
47
47
|
|
|
48
48
|
constructor(map: Map) {
|
|
@@ -36,49 +36,49 @@ class RenderFrameEvent extends Event {
|
|
|
36
36
|
// For example, if there is a mousedown and mousemove, the mousePan handler
|
|
37
37
|
// would return a `panDelta` on the mousemove.
|
|
38
38
|
export interface Handler {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
39
|
+
enable(): void;
|
|
40
|
+
disable(): void;
|
|
41
|
+
isEnabled(): boolean;
|
|
42
|
+
isActive(): boolean;
|
|
43
|
+
// `reset` can be called by the manager at any time and must reset everything to it's original state
|
|
44
|
+
reset(): void;
|
|
45
|
+
// Handlers can optionally implement these methods.
|
|
46
|
+
// They are called with dom events whenever those dom evens are received.
|
|
47
|
+
readonly touchstart?: (e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>) => HandlerResult | void;
|
|
48
|
+
readonly touchmove?: (e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>) => HandlerResult | void;
|
|
49
|
+
readonly touchend?: (e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>) => HandlerResult | void;
|
|
50
|
+
readonly touchcancel?: (e: TouchEvent, points: Array<Point>, mapTouches: Array<Touch>) => HandlerResult | void;
|
|
51
|
+
readonly mousedown?: (e: MouseEvent, point: Point) => HandlerResult | void;
|
|
52
|
+
readonly mousemove?: (e: MouseEvent, point: Point) => HandlerResult | void;
|
|
53
|
+
readonly mouseup?: (e: MouseEvent, point: Point) => HandlerResult | void;
|
|
54
|
+
readonly dblclick?: (e: MouseEvent, point: Point) => HandlerResult | void;
|
|
55
|
+
readonly wheel?: (e: WheelEvent, point: Point) => HandlerResult | void;
|
|
56
|
+
readonly keydown?: (e: KeyboardEvent) => HandlerResult | void;
|
|
57
|
+
readonly keyup?: (e: KeyboardEvent) => HandlerResult | void;
|
|
58
|
+
// `renderFrame` is the only non-dom event. It is called during render
|
|
59
|
+
// frames and can be used to smooth camera changes (see scroll handler).
|
|
60
|
+
readonly renderFrame?: () => HandlerResult | void;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// All handler methods that are called with events can optionally return a `HandlerResult`.
|
|
64
64
|
export type HandlerResult = {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
65
|
+
panDelta?: Point;
|
|
66
|
+
zoomDelta?: number;
|
|
67
|
+
bearingDelta?: number;
|
|
68
|
+
pitchDelta?: number;
|
|
69
|
+
// the point to not move when changing the camera
|
|
70
|
+
around?: Point | null;
|
|
71
|
+
// same as above, except for pinch actions, which are given higher priority
|
|
72
|
+
pinchAround?: Point | null;
|
|
73
|
+
// A method that can fire a one-off easing by directly changing the map's camera.
|
|
74
|
+
cameraAnimation?: (map: Map) => any;
|
|
75
|
+
// The last three properties are needed by only one handler: scrollzoom.
|
|
76
|
+
// The DOM event to be used as the `originalEvent` on any camera change events.
|
|
77
|
+
originalEvent?: any;
|
|
78
|
+
// Makes the manager trigger a frame, allowing the handler to return multiple results over time (see scrollzoom).
|
|
79
|
+
needsRenderFrame?: boolean;
|
|
80
|
+
// The camera changes won't get recorded for inertial zooming.
|
|
81
|
+
noInertia?: boolean;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
function hasChange(result: HandlerResult) {
|
|
@@ -89,9 +89,9 @@ class HandlerManager {
|
|
|
89
89
|
_map: Map;
|
|
90
90
|
_el: HTMLElement;
|
|
91
91
|
_handlers: Array<{
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
handlerName: string;
|
|
93
|
+
handler: Handler;
|
|
94
|
+
allowed: any;
|
|
95
95
|
}>;
|
|
96
96
|
_eventsInProgress: any;
|
|
97
97
|
_frameId: number;
|
|
@@ -102,8 +102,8 @@ class HandlerManager {
|
|
|
102
102
|
_changes: Array<[HandlerResult, any, any]>;
|
|
103
103
|
_previousActiveHandlers: {[x: string]: Handler};
|
|
104
104
|
_listeners: Array<[Window | Document | HTMLElement, string, {
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
passive?: boolean;
|
|
106
|
+
capture?: boolean;
|
|
107
107
|
} | undefined]>;
|
|
108
108
|
|
|
109
109
|
constructor(map: Map, options: CompleteMapOptions) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import browser from '../../util/browser';
|
|
2
2
|
import Map from '../map';
|
|
3
3
|
import DOM from '../../util/dom';
|
|
4
|
-
import simulate from '../../../test/
|
|
4
|
+
import simulate from '../../../test/unit/lib/simulate_interaction';
|
|
5
5
|
import {setWebGlContext, setPerformance, setMatchMedia} from '../../util/test/util';
|
|
6
6
|
|
|
7
7
|
let map;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Map from '../../ui/map';
|
|
2
2
|
import DOM from '../../util/dom';
|
|
3
|
-
import simulate from '../../../test/
|
|
3
|
+
import simulate from '../../../test/unit/lib/simulate_interaction';
|
|
4
4
|
import browser from '../../util/browser';
|
|
5
5
|
import {setWebGlContext, setPerformance, setMatchMedia} from '../../util/test/util';
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import browser from '../../util/browser';
|
|
2
2
|
import Map from '../../ui/map';
|
|
3
3
|
import DOM from '../../util/dom';
|
|
4
|
-
import simulate from '../../../test/
|
|
4
|
+
import simulate from '../../../test/unit/lib/simulate_interaction';
|
|
5
5
|
import {setWebGlContext, setPerformance, setMatchMedia} from '../../util/test/util';
|
|
6
6
|
|
|
7
7
|
function createMap() {
|