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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {CollisionBoxArray} from '../data/array_types.g';
|
|
2
2
|
import Point from '@mapbox/point-geometry';
|
|
3
|
-
import type Anchor from './anchor';
|
|
3
|
+
import type {Anchor} from './anchor';
|
|
4
4
|
import {SymbolPadding} from '../style/style_layer/symbol_style_layer';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -8,10 +8,8 @@ import {SymbolPadding} from '../style/style_layer/symbol_style_layer';
|
|
|
8
8
|
* It is used with CollisionIndex to check if the label overlaps with any
|
|
9
9
|
* previous labels. A CollisionFeature is mostly just a set of CollisionBox
|
|
10
10
|
* objects.
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
13
11
|
*/
|
|
14
|
-
class CollisionFeature {
|
|
12
|
+
export class CollisionFeature {
|
|
15
13
|
boxStartIndex: number;
|
|
16
14
|
boxEndIndex: number;
|
|
17
15
|
circleDiameter: number;
|
|
@@ -20,12 +18,11 @@ class CollisionFeature {
|
|
|
20
18
|
* Create a CollisionFeature, adding its collision box data to the given collisionBoxArray in the process.
|
|
21
19
|
* For line aligned labels a collision circle diameter is computed instead.
|
|
22
20
|
*
|
|
23
|
-
* @param anchor The point along the line around which the label is anchored.
|
|
24
|
-
* @param shaped The text or icon shaping results.
|
|
25
|
-
* @param boxScale A magic number used to convert from glyph metrics units to geometry units.
|
|
26
|
-
* @param padding The amount of padding to add around the label edges.
|
|
27
|
-
* @param alignLine Whether the label is aligned with the line or the viewport.
|
|
28
|
-
* @private
|
|
21
|
+
* @param anchor - The point along the line around which the label is anchored.
|
|
22
|
+
* @param shaped - The text or icon shaping results.
|
|
23
|
+
* @param boxScale - A magic number used to convert from glyph metrics units to geometry units.
|
|
24
|
+
* @param padding - The amount of padding to add around the label edges.
|
|
25
|
+
* @param alignLine - Whether the label is aligned with the line or the viewport.
|
|
29
26
|
*/
|
|
30
27
|
constructor(collisionBoxArray: CollisionBoxArray,
|
|
31
28
|
anchor: Anchor,
|
|
@@ -105,5 +102,3 @@ class CollisionFeature {
|
|
|
105
102
|
this.boxEndIndex = collisionBoxArray.length;
|
|
106
103
|
}
|
|
107
104
|
}
|
|
108
|
-
|
|
109
|
-
export default CollisionFeature;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import CollisionIndex from './collision_index';
|
|
1
|
+
import {CollisionIndex} from './collision_index';
|
|
2
2
|
import {mat4} from 'gl-matrix';
|
|
3
3
|
|
|
4
|
-
import Transform from '../geo/transform';
|
|
4
|
+
import {Transform} from '../geo/transform';
|
|
5
5
|
|
|
6
6
|
describe('CollisionIndex', () => {
|
|
7
7
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import Point from '@mapbox/point-geometry';
|
|
2
|
-
import clipLine from './clip_line';
|
|
3
|
-
import PathInterpolator from './path_interpolator';
|
|
2
|
+
import {clipLine} from './clip_line';
|
|
3
|
+
import {PathInterpolator} from './path_interpolator';
|
|
4
4
|
|
|
5
5
|
import * as intersectionTests from '../util/intersection_tests';
|
|
6
|
-
import GridIndex from './grid_index';
|
|
6
|
+
import {GridIndex} from './grid_index';
|
|
7
7
|
import {mat4, vec4} from 'gl-matrix';
|
|
8
8
|
import ONE_EM from '../symbol/one_em';
|
|
9
9
|
|
|
10
10
|
import * as projection from '../symbol/projection';
|
|
11
11
|
|
|
12
|
-
import type Transform from '../geo/transform';
|
|
12
|
+
import type {Transform} from '../geo/transform';
|
|
13
13
|
import type {SingleCollisionBox} from '../data/bucket/symbol_bucket';
|
|
14
14
|
import type {
|
|
15
15
|
GlyphOffsetArray,
|
|
@@ -41,10 +41,8 @@ export type FeatureKey = {
|
|
|
41
41
|
* there's room for a symbol, then insertCollisionBox/Circles actually puts the
|
|
42
42
|
* symbol in the index. The two step process allows paired symbols to be inserted
|
|
43
43
|
* together even if they overlap.
|
|
44
|
-
*
|
|
45
|
-
* @private
|
|
46
44
|
*/
|
|
47
|
-
class CollisionIndex {
|
|
45
|
+
export class CollisionIndex {
|
|
48
46
|
grid: GridIndex<FeatureKey>;
|
|
49
47
|
ignoredGrid: GridIndex<FeatureKey>;
|
|
50
48
|
transform: Transform;
|
|
@@ -282,8 +280,6 @@ class CollisionIndex {
|
|
|
282
280
|
* Because the geometries in the CollisionIndex are an approximation of the shape of
|
|
283
281
|
* symbols on the map, we use the CollisionIndex to look up the symbol part of
|
|
284
282
|
* `queryRenderedFeatures`.
|
|
285
|
-
*
|
|
286
|
-
* @private
|
|
287
283
|
*/
|
|
288
284
|
queryRenderedSymbols(viewportQueryGeometry: Array<Point>) {
|
|
289
285
|
if (viewportQueryGeometry.length === 0 || (this.grid.keysLength() === 0 && this.ignoredGrid.keysLength() === 0)) {
|
|
@@ -402,5 +398,3 @@ class CollisionIndex {
|
|
|
402
398
|
return m;
|
|
403
399
|
}
|
|
404
400
|
}
|
|
405
|
-
|
|
406
|
-
export default CollisionIndex;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import CrossTileSymbolIndex,
|
|
1
|
+
import {CrossTileSymbolIndex, KDBUSH_THRESHHOLD} from './cross_tile_symbol_index';
|
|
2
2
|
import {OverscaledTileID} from '../source/tile_id';
|
|
3
|
-
import StyleLayer from '../style/style_layer';
|
|
3
|
+
import {StyleLayer} from '../style/style_layer';
|
|
4
4
|
|
|
5
5
|
const styleLayer = {
|
|
6
6
|
id: 'test'
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import KDBush from 'kdbush';
|
|
2
|
-
import EXTENT from '../data/extent';
|
|
2
|
+
import {EXTENT} from '../data/extent';
|
|
3
3
|
|
|
4
4
|
import {SymbolInstanceArray} from '../data/array_types.g';
|
|
5
5
|
|
|
6
6
|
import type {SymbolInstance} from '../data/array_types.g';
|
|
7
7
|
import type {OverscaledTileID} from '../source/tile_id';
|
|
8
|
-
import type SymbolBucket from '../data/bucket/symbol_bucket';
|
|
9
|
-
import type StyleLayer from '../style/style_layer';
|
|
10
|
-
import type Tile from '../source/tile';
|
|
8
|
+
import type {SymbolBucket} from '../data/bucket/symbol_bucket';
|
|
9
|
+
import type {StyleLayer} from '../style/style_layer';
|
|
10
|
+
import type {Tile} from '../source/tile';
|
|
11
11
|
|
|
12
12
|
/*
|
|
13
13
|
The CrossTileSymbolIndex generally works on the assumption that
|
|
@@ -307,7 +307,7 @@ class CrossTileSymbolLayerIndex {
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
class CrossTileSymbolIndex {
|
|
310
|
+
export class CrossTileSymbolIndex {
|
|
311
311
|
layerIndexes: {[layerId: string]: CrossTileSymbolLayerIndex};
|
|
312
312
|
crossTileIDs: CrossTileIDs;
|
|
313
313
|
maxBucketInstanceId: number;
|
|
@@ -365,5 +365,3 @@ class CrossTileSymbolIndex {
|
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
|
|
369
|
-
export default CrossTileSymbolIndex;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {interpolates} from '@maplibre/maplibre-gl-style-spec';
|
|
2
2
|
|
|
3
|
-
import Anchor from '../symbol/anchor';
|
|
4
|
-
import checkMaxAngle from './check_max_angle';
|
|
3
|
+
import {Anchor} from '../symbol/anchor';
|
|
4
|
+
import {checkMaxAngle} from './check_max_angle';
|
|
5
5
|
|
|
6
6
|
import type Point from '@mapbox/point-geometry';
|
|
7
7
|
import type {Shaping, PositionedIcon} from './shaping';
|
package/src/symbol/grid_index.ts
CHANGED
|
@@ -26,6 +26,9 @@ type QueryResult<T> = {
|
|
|
26
26
|
y2: number;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* A key for the grid
|
|
31
|
+
*/
|
|
29
32
|
export type GridKey = {
|
|
30
33
|
overlapMode?: OverlapMode;
|
|
31
34
|
}
|
|
@@ -54,10 +57,8 @@ function overlapAllowed(overlapA: OverlapMode, overlapB: OverlapMode): boolean {
|
|
|
54
57
|
* at least one cell. As long as the geometries are relatively
|
|
55
58
|
* uniformly distributed across the plane, this greatly reduces
|
|
56
59
|
* the number of comparisons necessary.
|
|
57
|
-
*
|
|
58
|
-
* @private
|
|
59
60
|
*/
|
|
60
|
-
class GridIndex<T extends GridKey> {
|
|
61
|
+
export class GridIndex<T extends GridKey> {
|
|
61
62
|
circleKeys: Array<T>;
|
|
62
63
|
boxKeys: Array<T>;
|
|
63
64
|
boxCells: Array<Array<number>>;
|
|
@@ -410,5 +411,3 @@ class GridIndex<T extends GridKey> {
|
|
|
410
411
|
return (dx * dx + dy * dy <= (radius * radius));
|
|
411
412
|
}
|
|
412
413
|
}
|
|
413
|
-
|
|
414
|
-
export default GridIndex;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type {SymbolFeature} from '../data/bucket/symbol_bucket';
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export function mergeLines(features: Array<SymbolFeature>): Array<SymbolFeature> {
|
|
4
4
|
const leftIndex: {[_: string]: number} = {};
|
|
5
5
|
const rightIndex: {[_: string]: number} = {};
|
|
6
6
|
const mergedFeatures = [];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {register} from '../util/web_worker_transfer';
|
|
2
2
|
|
|
3
|
-
class OpacityState {
|
|
3
|
+
export class OpacityState {
|
|
4
4
|
opacity: number;
|
|
5
5
|
targetOpacity: number;
|
|
6
6
|
time: number;
|
|
@@ -21,5 +21,3 @@ class OpacityState {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
register('OpacityState', OpacityState);
|
|
24
|
-
|
|
25
|
-
export default OpacityState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {clamp} from '../util/util';
|
|
2
2
|
import Point from '@mapbox/point-geometry';
|
|
3
3
|
|
|
4
|
-
class PathInterpolator {
|
|
4
|
+
export class PathInterpolator {
|
|
5
5
|
points: Array<Point>;
|
|
6
6
|
length: number;
|
|
7
7
|
paddedLength: number;
|
|
@@ -53,5 +53,3 @@ class PathInterpolator {
|
|
|
53
53
|
return this.points[idxOfPrevPoint].mult(1.0 - segmentT).add(this.points[currentIndex].mult(segmentT));
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
export default PathInterpolator;
|
package/src/symbol/placement.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import CollisionIndex from './collision_index';
|
|
1
|
+
import {CollisionIndex} from './collision_index';
|
|
2
2
|
import type {FeatureKey} from './collision_index';
|
|
3
|
-
import EXTENT from '../data/extent';
|
|
3
|
+
import {EXTENT} from '../data/extent';
|
|
4
4
|
import * as symbolSize from './symbol_size';
|
|
5
5
|
import * as projection from './projection';
|
|
6
6
|
import {getAnchorJustification, evaluateVariableOffset} from './symbol_layout';
|
|
7
7
|
import {getAnchorAlignment, WritingMode} from './shaping';
|
|
8
8
|
import {mat4} from 'gl-matrix';
|
|
9
|
-
import pixelsToTileUnits from '../source/pixels_to_tile_units';
|
|
9
|
+
import {pixelsToTileUnits} from '../source/pixels_to_tile_units';
|
|
10
10
|
import Point from '@mapbox/point-geometry';
|
|
11
|
-
import type Transform from '../geo/transform';
|
|
12
|
-
import type StyleLayer from '../style/style_layer';
|
|
11
|
+
import type {Transform} from '../geo/transform';
|
|
12
|
+
import type {StyleLayer} from '../style/style_layer';
|
|
13
13
|
import {PossiblyEvaluated} from '../style/properties';
|
|
14
14
|
import type {SymbolLayoutProps, SymbolLayoutPropsPossiblyEvaluated} from '../style/style_layer/symbol_style_layer_properties.g';
|
|
15
15
|
import {getOverlapMode, OverlapMode} from '../style/style_layer/overlap_mode';
|
|
16
16
|
|
|
17
|
-
import type Tile from '../source/tile';
|
|
18
|
-
import SymbolBucket,
|
|
17
|
+
import type {Tile} from '../source/tile';
|
|
18
|
+
import {SymbolBucket, CollisionArrays, SingleCollisionBox} from '../data/bucket/symbol_bucket';
|
|
19
19
|
|
|
20
20
|
import type {CollisionBoxArray, CollisionVertexArray, SymbolInstance} from '../data/array_types.g';
|
|
21
|
-
import type FeatureIndex from '../data/feature_index';
|
|
21
|
+
import type {FeatureIndex} from '../data/feature_index';
|
|
22
22
|
import type {OverscaledTileID} from '../source/tile_id';
|
|
23
23
|
import type {TextAnchor} from './symbol_layout';
|
|
24
|
-
import Terrain from '../render/terrain';
|
|
24
|
+
import {Terrain} from '../render/terrain';
|
|
25
25
|
import {warnOnce} from '../util/util';
|
|
26
26
|
|
|
27
27
|
class OpacityState {
|
package/src/symbol/projection.ts
CHANGED
|
@@ -4,9 +4,9 @@ import {mat4, vec4} from 'gl-matrix';
|
|
|
4
4
|
import * as symbolSize from './symbol_size';
|
|
5
5
|
import {addDynamicAttributes} from '../data/bucket/symbol_bucket';
|
|
6
6
|
|
|
7
|
-
import type Painter from '../render/painter';
|
|
8
|
-
import type Transform from '../geo/transform';
|
|
9
|
-
import type SymbolBucket from '../data/bucket/symbol_bucket';
|
|
7
|
+
import type {Painter} from '../render/painter';
|
|
8
|
+
import type {Transform} from '../geo/transform';
|
|
9
|
+
import type {SymbolBucket} from '../data/bucket/symbol_bucket';
|
|
10
10
|
import type {
|
|
11
11
|
GlyphOffsetArray,
|
|
12
12
|
SymbolLineVertexArray,
|
|
@@ -377,45 +377,66 @@ type IndexToPointCache = { [lineIndex: number]: Point };
|
|
|
377
377
|
* Since we will use the same vertices for potentially many glyphs, cache the results for this bucket
|
|
378
378
|
* over the course of the render. Each vertex location also potentially has one offset equivalent
|
|
379
379
|
* for us to hold onto. The vertex indices are per-symbol-bucket.
|
|
380
|
-
*
|
|
381
|
-
* @typedef {Object} ProjectionCache
|
|
382
|
-
* @property {IndexToPointCache} projections tile-unit vertices projected into label-plane units
|
|
383
|
-
* @property {IndexToPointCache} offsets label-plane vertices which have been shifted to follow an offset line
|
|
384
380
|
*/
|
|
385
381
|
type ProjectionCache = {
|
|
382
|
+
/**
|
|
383
|
+
* tile-unit vertices projected into label-plane units
|
|
384
|
+
*/
|
|
386
385
|
projections: IndexToPointCache;
|
|
386
|
+
/**
|
|
387
|
+
* label-plane vertices which have been shifted to follow an offset line
|
|
388
|
+
*/
|
|
387
389
|
offsets: IndexToPointCache;
|
|
388
390
|
};
|
|
389
391
|
|
|
390
392
|
/**
|
|
391
393
|
* Arguments necessary to project a vertex to the label plane
|
|
392
|
-
* @typedef {Object} ProjectionArgs
|
|
393
|
-
* @property {ProjectionCache} projectionCache Used to cache results, save cost if projecting the same vertex multiple times
|
|
394
|
-
* @property {SymbolLineVertexArray} lineVertexArray The array of tile-unit vertices transferred from worker
|
|
395
|
-
* @property {mat4} labelPlaneMatrix Label plane projection matrix
|
|
396
|
-
* @property {Function} getElevation Function to get elevation at a point
|
|
397
|
-
* @property {Point} tileAnchorPoint Only for creating synthetic vertices if vertex would otherwise project behind plane of camera
|
|
398
|
-
* @property {number} distanceFromAnchor Only for creating synthetic vertices if vertex would otherwise project behind plane of camera
|
|
399
|
-
* @property {Point} previousVertex Only for creating synthetic vertices if vertex would otherwise project behind plane of camera
|
|
400
|
-
* @property {number} direction Only for creating synthetic vertices if vertex would otherwise project behind plane of camera
|
|
401
|
-
* @property {number} absOffsetX Only for creating synthetic vertices if vertex would otherwise project behind plane of camera
|
|
402
394
|
*/
|
|
403
395
|
type ProjectionArgs = {
|
|
396
|
+
/**
|
|
397
|
+
* Used to cache results, save cost if projecting the same vertex multiple times
|
|
398
|
+
*/
|
|
404
399
|
projectionCache: ProjectionCache;
|
|
400
|
+
/**
|
|
401
|
+
* The array of tile-unit vertices transferred from worker
|
|
402
|
+
*/
|
|
405
403
|
lineVertexArray: SymbolLineVertexArray;
|
|
404
|
+
/**
|
|
405
|
+
* Label plane projection matrix
|
|
406
|
+
*/
|
|
406
407
|
labelPlaneMatrix: mat4;
|
|
408
|
+
/**
|
|
409
|
+
* Function to get elevation at a point
|
|
410
|
+
* @param x - the x coordinate
|
|
411
|
+
* @param y - the y coordinate
|
|
412
|
+
*/
|
|
407
413
|
getElevation: (x: number, y: number) => number;
|
|
414
|
+
/**
|
|
415
|
+
* Only for creating synthetic vertices if vertex would otherwise project behind plane of camera
|
|
416
|
+
*/
|
|
408
417
|
tileAnchorPoint: Point;
|
|
418
|
+
/**
|
|
419
|
+
* Only for creating synthetic vertices if vertex would otherwise project behind plane of camera
|
|
420
|
+
*/
|
|
409
421
|
distanceFromAnchor: number;
|
|
422
|
+
/**
|
|
423
|
+
* Only for creating synthetic vertices if vertex would otherwise project behind plane of camera
|
|
424
|
+
*/
|
|
410
425
|
previousVertex: Point;
|
|
426
|
+
/**
|
|
427
|
+
* Only for creating synthetic vertices if vertex would otherwise project behind plane of camera
|
|
428
|
+
*/
|
|
411
429
|
direction: number;
|
|
430
|
+
/**
|
|
431
|
+
* Only for creating synthetic vertices if vertex would otherwise project behind plane of camera
|
|
432
|
+
*/
|
|
412
433
|
absOffsetX: number;
|
|
413
434
|
};
|
|
414
435
|
|
|
415
436
|
/**
|
|
416
437
|
* Transform a vertex from tile coordinates to label plane coordinates
|
|
417
|
-
* @param index index of vertex to project
|
|
418
|
-
* @param projectionArgs necessary data to project a vertex
|
|
438
|
+
* @param index - index of vertex to project
|
|
439
|
+
* @param projectionArgs - necessary data to project a vertex
|
|
419
440
|
* @returns the vertex projected to the label plane
|
|
420
441
|
*/
|
|
421
442
|
function projectVertexToViewport(index: number, projectionArgs: ProjectionArgs): Point {
|
|
@@ -442,9 +463,9 @@ function projectVertexToViewport(index: number, projectionArgs: ProjectionArgs):
|
|
|
442
463
|
|
|
443
464
|
/**
|
|
444
465
|
* Calculate the normal vector for a line segment
|
|
445
|
-
* @param segmentVector will be mutated as a tiny optimization
|
|
446
|
-
* @param offset magnitude of resulting vector
|
|
447
|
-
* @param direction direction of line traversal
|
|
466
|
+
* @param segmentVector - will be mutated as a tiny optimization
|
|
467
|
+
* @param offset - magnitude of resulting vector
|
|
468
|
+
* @param direction - direction of line traversal
|
|
448
469
|
* @returns a normal vector from the segment, with magnitude equal to offset amount
|
|
449
470
|
*/
|
|
450
471
|
function transformToOffsetNormal(segmentVector: Point, offset: number, direction: number): Point {
|
|
@@ -455,14 +476,14 @@ function transformToOffsetNormal(segmentVector: Point, offset: number, direction
|
|
|
455
476
|
* Construct offset line segments for the current segment and the next segment, then extend/shrink
|
|
456
477
|
* the segments until they intersect. If the segments are parallel, then they will touch with no modification.
|
|
457
478
|
*
|
|
458
|
-
* @param index Index of the current vertex
|
|
459
|
-
* @param prevToCurrentOffsetNormal Normal vector of the line segment from the previous vertex to the current vertex
|
|
460
|
-
* @param currentVertex Current (non-offset) vertex projected to the label plane
|
|
461
|
-
* @param lineStartIndex Beginning index for the line this label is on
|
|
462
|
-
* @param lineEndIndex End index for the line this label is on
|
|
463
|
-
* @param offsetPreviousVertex The previous vertex projected to the label plane, and then offset along the previous segments normal
|
|
464
|
-
* @param lineOffsetY Magnitude of the offset
|
|
465
|
-
* @param projectionArgs Necessary data for tile-to-label-plane projection
|
|
479
|
+
* @param index - Index of the current vertex
|
|
480
|
+
* @param prevToCurrentOffsetNormal - Normal vector of the line segment from the previous vertex to the current vertex
|
|
481
|
+
* @param currentVertex - Current (non-offset) vertex projected to the label plane
|
|
482
|
+
* @param lineStartIndex - Beginning index for the line this label is on
|
|
483
|
+
* @param lineEndIndex - End index for the line this label is on
|
|
484
|
+
* @param offsetPreviousVertex - The previous vertex projected to the label plane, and then offset along the previous segments normal
|
|
485
|
+
* @param lineOffsetY - Magnitude of the offset
|
|
486
|
+
* @param projectionArgs - Necessary data for tile-to-label-plane projection
|
|
466
487
|
* @returns The point at which the current and next line segments intersect, once offset and extended/shrunk to their meeting point
|
|
467
488
|
*/
|
|
468
489
|
function findOffsetIntersectionPoint(index: number, prevToCurrentOffsetNormal: Point, currentVertex: Point, lineStartIndex: number, lineEndIndex: number, offsetPreviousVertex: Point, lineOffsetY: number, projectionArgs: ProjectionArgs) {
|
|
@@ -492,14 +513,20 @@ function findOffsetIntersectionPoint(index: number, prevToCurrentOffsetNormal: P
|
|
|
492
513
|
}
|
|
493
514
|
|
|
494
515
|
/**
|
|
495
|
-
*
|
|
496
|
-
* @property {Point} point The point at which the glyph should be placed, in label plane coordinates
|
|
497
|
-
* @property {number} angle The angle at which the glyph should be placed
|
|
498
|
-
* @property {Array<Point>} path The label-plane path used to reach this glyph: used only for collision detection
|
|
516
|
+
* Placed Glyph type
|
|
499
517
|
*/
|
|
500
518
|
type PlacedGlyph = {
|
|
519
|
+
/**
|
|
520
|
+
* The point at which the glyph should be placed, in label plane coordinates
|
|
521
|
+
*/
|
|
501
522
|
point: Point;
|
|
523
|
+
/**
|
|
524
|
+
* The angle at which the glyph should be placed
|
|
525
|
+
*/
|
|
502
526
|
angle: number;
|
|
527
|
+
/**
|
|
528
|
+
* The label-plane path used to reach this glyph: used only for collision detection
|
|
529
|
+
*/
|
|
503
530
|
path: Array<Point>;
|
|
504
531
|
};
|
|
505
532
|
|
package/src/symbol/quads.ts
CHANGED
|
@@ -2,11 +2,11 @@ import Point from '@mapbox/point-geometry';
|
|
|
2
2
|
|
|
3
3
|
import {GLYPH_PBF_BORDER} from '../style/parse_glyph_pbf';
|
|
4
4
|
|
|
5
|
-
import type Anchor from './anchor';
|
|
5
|
+
import type {Anchor} from './anchor';
|
|
6
6
|
import type {PositionedIcon, Shaping} from './shaping';
|
|
7
7
|
import {SHAPING_DEFAULT_OFFSET} from './shaping';
|
|
8
8
|
import {IMAGE_PADDING} from '../render/image_atlas';
|
|
9
|
-
import type SymbolStyleLayer from '../style/style_layer/symbol_style_layer';
|
|
9
|
+
import type {SymbolStyleLayer} from '../style/style_layer/symbol_style_layer';
|
|
10
10
|
import type {Feature} from '@maplibre/maplibre-gl-style-spec';
|
|
11
11
|
import type {StyleImage} from '../style/style_image';
|
|
12
12
|
import ONE_EM from './one_em';
|
|
@@ -17,13 +17,11 @@ import {Rect} from '../render/glyph_atlas';
|
|
|
17
17
|
*
|
|
18
18
|
* The zoom range the glyph can be shown is defined by minScale and maxScale.
|
|
19
19
|
*
|
|
20
|
-
* @param tl The offset of the top left corner from the anchor.
|
|
21
|
-
* @param tr The offset of the top right corner from the anchor.
|
|
22
|
-
* @param bl The offset of the bottom left corner from the anchor.
|
|
23
|
-
* @param br The offset of the bottom right corner from the anchor.
|
|
24
|
-
* @param tex The texture coordinates.
|
|
25
|
-
*
|
|
26
|
-
* @private
|
|
20
|
+
* @param tl - The offset of the top left corner from the anchor.
|
|
21
|
+
* @param tr - The offset of the top right corner from the anchor.
|
|
22
|
+
* @param bl - The offset of the bottom left corner from the anchor.
|
|
23
|
+
* @param br - The offset of the bottom right corner from the anchor.
|
|
24
|
+
* @param tex - The texture coordinates.
|
|
27
25
|
*/
|
|
28
26
|
export type SymbolQuad = {
|
|
29
27
|
tl: Point;
|
|
@@ -53,7 +51,6 @@ const border = IMAGE_PADDING;
|
|
|
53
51
|
|
|
54
52
|
/**
|
|
55
53
|
* Create the quads used for rendering an icon.
|
|
56
|
-
* @private
|
|
57
54
|
*/
|
|
58
55
|
export function getIconQuads(
|
|
59
56
|
shapedIcon: PositionedIcon,
|
|
@@ -217,7 +214,6 @@ function getPxOffset(fixedOffset, fixedSize, stretchOffset, stretchSize) {
|
|
|
217
214
|
|
|
218
215
|
/**
|
|
219
216
|
* Create the quads used for rendering a text label.
|
|
220
|
-
* @private
|
|
221
217
|
*/
|
|
222
218
|
export function getGlyphQuads(
|
|
223
219
|
anchor: Anchor,
|
package/src/symbol/shaping.ts
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
charAllowsIdeographicBreaking,
|
|
4
4
|
charInComplexShapingScript
|
|
5
5
|
} from '../util/script_detection';
|
|
6
|
-
import verticalizePunctuation from '../util/verticalize_punctuation';
|
|
6
|
+
import {verticalizePunctuation} from '../util/verticalize_punctuation';
|
|
7
7
|
import {plugin as rtlTextPlugin} from '../source/rtl_text_plugin';
|
|
8
8
|
import ONE_EM from './one_em';
|
|
9
9
|
import {warnOnce} from '../util/util';
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import Anchor from './anchor';
|
|
1
|
+
import {Anchor} from './anchor';
|
|
2
2
|
|
|
3
3
|
import {getAnchors, getCenterAnchor} from './get_anchors';
|
|
4
|
-
import clipLine from './clip_line';
|
|
4
|
+
import {clipLine} from './clip_line';
|
|
5
5
|
import {shapeText, shapeIcon, WritingMode, fitIconToText} from './shaping';
|
|
6
6
|
import {getGlyphQuads, getIconQuads} from './quads';
|
|
7
|
-
import CollisionFeature from './collision_feature';
|
|
7
|
+
import {CollisionFeature} from './collision_feature';
|
|
8
8
|
import {warnOnce} from '../util/util';
|
|
9
9
|
import {
|
|
10
10
|
allowsVerticalWritingMode,
|
|
11
11
|
allowsLetterSpacing
|
|
12
12
|
} from '../util/script_detection';
|
|
13
|
-
import findPoleOfInaccessibility from '../util/find_pole_of_inaccessibility';
|
|
14
|
-
import classifyRings from '../util/classify_rings';
|
|
15
|
-
import EXTENT from '../data/extent';
|
|
16
|
-
import SymbolBucket from '../data/bucket/symbol_bucket';
|
|
17
|
-
import EvaluationParameters from '../style/evaluation_parameters';
|
|
13
|
+
import {findPoleOfInaccessibility} from '../util/find_pole_of_inaccessibility';
|
|
14
|
+
import {classifyRings} from '../util/classify_rings';
|
|
15
|
+
import {EXTENT} from '../data/extent';
|
|
16
|
+
import {SymbolBucket} from '../data/bucket/symbol_bucket';
|
|
17
|
+
import {EvaluationParameters} from '../style/evaluation_parameters';
|
|
18
18
|
import {SIZE_PACK_FACTOR, MAX_PACKED_SIZE, MAX_GLYPH_ICON_SIZE} from './symbol_size';
|
|
19
19
|
import ONE_EM from './one_em';
|
|
20
20
|
import type {CanonicalTileID} from '../source/tile_id';
|
|
@@ -23,7 +23,7 @@ import type {CollisionBoxArray} from '../data/array_types.g';
|
|
|
23
23
|
import type {SymbolFeature} from '../data/bucket/symbol_bucket';
|
|
24
24
|
import type {StyleImage} from '../style/style_image';
|
|
25
25
|
import type {StyleGlyph} from '../style/style_glyph';
|
|
26
|
-
import type SymbolStyleLayer from '../style/style_layer/symbol_style_layer';
|
|
26
|
+
import type {SymbolStyleLayer} from '../style/style_layer/symbol_style_layer';
|
|
27
27
|
import type {ImagePosition} from '../render/image_atlas';
|
|
28
28
|
import type {GlyphPosition} from '../render/glyph_atlas';
|
|
29
29
|
import type {PossiblyEvaluatedPropertyValue} from '../style/properties';
|
|
@@ -364,7 +364,6 @@ export function getAnchorJustification(anchor: TextAnchor): TextJustify {
|
|
|
364
364
|
* instance' for each _possible_ placement of the symbol feature.
|
|
365
365
|
* (At render timePlaceSymbols#place() selects which of these instances to
|
|
366
366
|
* show or hide based on collisions with symbols in other layers.)
|
|
367
|
-
* @private
|
|
368
367
|
*/
|
|
369
368
|
function addFeature(bucket: SymbolBucket,
|
|
370
369
|
feature: SymbolFeature,
|
|
@@ -564,8 +563,6 @@ function getDefaultHorizontalShaping(
|
|
|
564
563
|
|
|
565
564
|
/**
|
|
566
565
|
* Add a single label & icon placement.
|
|
567
|
-
*
|
|
568
|
-
* @private
|
|
569
566
|
*/
|
|
570
567
|
function addSymbol(bucket: SymbolBucket,
|
|
571
568
|
anchor: Anchor,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Interpolate, interpolates} from '@maplibre/maplibre-gl-style-spec';
|
|
2
2
|
import {clamp} from '../util/util';
|
|
3
|
-
import EvaluationParameters from '../style/evaluation_parameters';
|
|
3
|
+
import {EvaluationParameters} from '../style/evaluation_parameters';
|
|
4
4
|
|
|
5
5
|
import type {PropertyValue, PossiblyEvaluatedPropertyValue} from '../style/properties';
|
|
6
6
|
import type {InterpolationType} from '@maplibre/maplibre-gl-style-spec';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import SymbolStyleLayer from '../style/style_layer/symbol_style_layer';
|
|
2
|
-
import FormatSectionOverride from '../style/format_section_override';
|
|
1
|
+
import {SymbolStyleLayer} from '../style/style_layer/symbol_style_layer';
|
|
2
|
+
import {FormatSectionOverride} from '../style/format_section_override';
|
|
3
3
|
import properties, {SymbolPaintPropsPossiblyEvaluated} from '../style/style_layer/symbol_style_layer_properties.g';
|
|
4
|
-
import ZoomHistory from '../style/zoom_history';
|
|
5
|
-
import EvaluationParameters from '../style/evaluation_parameters';
|
|
4
|
+
import {ZoomHistory} from '../style/zoom_history';
|
|
5
|
+
import {EvaluationParameters} from '../style/evaluation_parameters';
|
|
6
6
|
|
|
7
7
|
function createSymbolLayer(layerProperties) {
|
|
8
8
|
const layer = new SymbolStyleLayer(layerProperties);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {plugin as rtlTextPlugin} from '../source/rtl_text_plugin';
|
|
2
2
|
|
|
3
|
-
import type SymbolStyleLayer from '../style/style_layer/symbol_style_layer';
|
|
3
|
+
import type {SymbolStyleLayer} from '../style/style_layer/symbol_style_layer';
|
|
4
4
|
import type {Feature} from '@maplibre/maplibre-gl-style-spec';
|
|
5
5
|
import {Formatted} from '@maplibre/maplibre-gl-style-spec';
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ function transformTextInternal(text: string, layer: SymbolStyleLayer, feature: F
|
|
|
19
19
|
return text;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export
|
|
22
|
+
export function transformText(text: Formatted, layer: SymbolStyleLayer, feature: Feature): Formatted {
|
|
23
23
|
text.sections.forEach(section => {
|
|
24
24
|
section.text = transformTextInternal(section.text, layer, feature);
|
|
25
25
|
});
|
package/src/types/callback.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A callback definition.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* asyncFunction((error, result) => {
|
|
7
|
+
* if (error) {
|
|
8
|
+
* // handle error
|
|
9
|
+
* } else if (result) {
|
|
10
|
+
* // handle success
|
|
11
|
+
* }
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
15
|
export type Callback<T> = (error?: Error | null, result?: T | null) => void;
|
package/src/types/cancelable.ts
CHANGED
package/src/ui/anchor.ts
CHANGED