maplibre-gl 3.2.2 → 3.3.1
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/LICENSE.txt +1 -1
- package/README.md +2 -1
- package/build/generate-dist-package.js +7 -2
- package/build/generate-struct-arrays.ts +3 -1
- package/build/generate-style-code.ts +7 -8
- package/build/generate-typings.ts +1 -1
- package/dist/LICENSE.txt +116 -0
- 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 +472 -195
- package/dist/maplibre-gl-dev.js.map +1 -1
- package/dist/maplibre-gl.d.ts +58 -16
- package/dist/maplibre-gl.js +3 -3
- package/dist/maplibre-gl.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +24 -23
- package/src/data/array_types.g.ts +78 -14
- package/src/data/bucket/symbol_attributes.ts +7 -1
- package/src/data/bucket/symbol_bucket.ts +4 -1
- package/src/render/draw_symbol.ts +8 -9
- package/src/render/program.ts +15 -0
- package/src/source/vector_tile_source.ts +0 -1
- package/src/source/video_source.ts +4 -0
- package/src/style/properties.ts +4 -0
- package/src/style/style.ts +14 -8
- package/src/style/style_layer/background_style_layer_properties.g.ts +1 -6
- package/src/style/style_layer/circle_style_layer_properties.g.ts +1 -6
- package/src/style/style_layer/fill_extrusion_style_layer_properties.g.ts +1 -6
- package/src/style/style_layer/fill_style_layer_properties.g.ts +1 -6
- package/src/style/style_layer/heatmap_style_layer_properties.g.ts +1 -6
- package/src/style/style_layer/hillshade_style_layer_properties.g.ts +1 -6
- package/src/style/style_layer/line_style_layer_properties.g.ts +1 -6
- package/src/style/style_layer/raster_style_layer_properties.g.ts +1 -6
- package/src/style/style_layer/symbol_style_layer_properties.g.ts +4 -6
- package/src/style/style_layer/variable_text_anchor.test.ts +117 -0
- package/src/style/style_layer/variable_text_anchor.ts +163 -0
- package/src/symbol/placement.ts +52 -40
- package/src/symbol/symbol_layout.ts +42 -116
- package/src/ui/control/navigation_control.ts +0 -1
- package/src/ui/map.test.ts +37 -8
- package/src/ui/map.ts +14 -13
- package/src/ui/marker.ts +1 -1
- package/src/ui/popup.ts +1 -1
- package/src/util/throttle.ts +7 -3
package/dist/maplibre-gl.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Point from '@mapbox/point-geometry';
|
|
4
4
|
import TinySDF from '@mapbox/tiny-sdf';
|
|
5
5
|
import { VectorTileFeature, VectorTileLayer } from '@mapbox/vector-tile';
|
|
6
|
-
import { Color, CompositeExpression, Feature, FeatureFilter, FeatureState, FilterSpecification, Formatted, FormattedSection, GeoJSONSourceSpecification, GlobalProperties, ICanonicalTileID, IMercatorCoordinate, ImageSourceSpecification, InterpolationType, LayerSpecification, LightSpecification, Padding, PromoteIdSpecification, PropertyValueSpecification, RasterDEMSourceSpecification, RasterSourceSpecification, ResolvedImage, SourceExpression, SourceSpecification, SpriteSpecification, StylePropertyExpression, StylePropertySpecification, StyleSpecification, TerrainSpecification, TransitionSpecification, VectorSourceSpecification, VideoSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
6
|
+
import { Color, CompositeExpression, Feature, FeatureFilter, FeatureState, FilterSpecification, Formatted, FormattedSection, GeoJSONSourceSpecification, GlobalProperties, ICanonicalTileID, IMercatorCoordinate, ImageSourceSpecification, InterpolationType, LayerSpecification, LightSpecification, Padding, PromoteIdSpecification, PropertyValueSpecification, RasterDEMSourceSpecification, RasterSourceSpecification, ResolvedImage, SourceExpression, SourceSpecification, SpriteSpecification, StylePropertyExpression, StylePropertySpecification, StyleSpecification, TerrainSpecification, TransitionSpecification, VariableAnchorOffsetCollection, VectorSourceSpecification, VideoSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
7
7
|
import { mat2, mat4, vec4 } from 'gl-matrix';
|
|
8
8
|
import KDBush from 'kdbush';
|
|
9
9
|
import { PotpackBox } from 'potpack';
|
|
@@ -509,6 +509,7 @@ export declare class Layout<Props> {
|
|
|
509
509
|
[K in keyof Props]: PropertyValue<any, PossiblyEvaluatedPropertyValue<any>>;
|
|
510
510
|
};
|
|
511
511
|
constructor(properties: Properties<Props>);
|
|
512
|
+
hasValue<S extends keyof Props>(name: S): boolean;
|
|
512
513
|
getValue<S extends keyof Props>(name: S): any;
|
|
513
514
|
setValue<S extends keyof Props>(name: S, value: any): void;
|
|
514
515
|
serialize(): any;
|
|
@@ -791,7 +792,7 @@ export declare class StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48 extends StructArra
|
|
|
791
792
|
emplaceBack(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, v16: number): number;
|
|
792
793
|
emplace(i: number, v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number, v16: number): number;
|
|
793
794
|
}
|
|
794
|
-
export declare class
|
|
795
|
+
export declare class StructArrayLayout8i15ui1ul2f2ui64 extends StructArray {
|
|
795
796
|
uint8: Uint8Array;
|
|
796
797
|
int16: Int16Array;
|
|
797
798
|
uint16: Uint16Array;
|
|
@@ -808,6 +809,14 @@ export declare class StructArrayLayout1f4 extends StructArray {
|
|
|
808
809
|
emplaceBack(v0: number): number;
|
|
809
810
|
emplace(i: number, v0: number): number;
|
|
810
811
|
}
|
|
812
|
+
export declare class StructArrayLayout1ui2f12 extends StructArray {
|
|
813
|
+
uint8: Uint8Array;
|
|
814
|
+
uint16: Uint16Array;
|
|
815
|
+
float32: Float32Array;
|
|
816
|
+
_refreshViews(): void;
|
|
817
|
+
emplaceBack(v0: number, v1: number, v2: number): number;
|
|
818
|
+
emplace(i: number, v0: number, v1: number, v2: number): number;
|
|
819
|
+
}
|
|
811
820
|
export declare class StructArrayLayout1ul2ui8 extends StructArray {
|
|
812
821
|
uint8: Uint8Array;
|
|
813
822
|
uint32: Uint32Array;
|
|
@@ -908,12 +917,12 @@ export declare class SymbolInstanceStruct extends Struct {
|
|
|
908
917
|
get crossTileID(): number;
|
|
909
918
|
set crossTileID(x: number);
|
|
910
919
|
get textBoxScale(): number;
|
|
911
|
-
get textOffset0(): number;
|
|
912
|
-
get textOffset1(): number;
|
|
913
920
|
get collisionCircleDiameter(): number;
|
|
921
|
+
get textAnchorOffsetStartIndex(): number;
|
|
922
|
+
get textAnchorOffsetEndIndex(): number;
|
|
914
923
|
}
|
|
915
924
|
export type SymbolInstance = SymbolInstanceStruct;
|
|
916
|
-
export declare class SymbolInstanceArray extends
|
|
925
|
+
export declare class SymbolInstanceArray extends StructArrayLayout8i15ui1ul2f2ui64 {
|
|
917
926
|
/**
|
|
918
927
|
* Return the SymbolInstanceStruct at the given location in the array.
|
|
919
928
|
* @param index The index of the element.
|
|
@@ -928,6 +937,20 @@ export declare class SymbolLineVertexArray extends StructArrayLayout3i6 {
|
|
|
928
937
|
gety(index: number): number;
|
|
929
938
|
gettileUnitDistanceFromAnchor(index: number): number;
|
|
930
939
|
}
|
|
940
|
+
export declare class TextAnchorOffsetStruct extends Struct {
|
|
941
|
+
_structArray: TextAnchorOffsetArray;
|
|
942
|
+
get textAnchor(): number;
|
|
943
|
+
get textOffset0(): number;
|
|
944
|
+
get textOffset1(): number;
|
|
945
|
+
}
|
|
946
|
+
export type TextAnchorOffset = TextAnchorOffsetStruct;
|
|
947
|
+
export declare class TextAnchorOffsetArray extends StructArrayLayout1ui2f12 {
|
|
948
|
+
/**
|
|
949
|
+
* Return the TextAnchorOffsetStruct at the given location in the array.
|
|
950
|
+
* @param index The index of the element.
|
|
951
|
+
*/
|
|
952
|
+
get(index: number): TextAnchorOffsetStruct;
|
|
953
|
+
}
|
|
931
954
|
export declare class FeatureIndexStruct extends Struct {
|
|
932
955
|
_structArray: FeatureIndexArray;
|
|
933
956
|
get featureIndex(): number;
|
|
@@ -2779,6 +2802,7 @@ export type SymbolLayoutProps = {
|
|
|
2779
2802
|
"text-justify": DataDrivenProperty<"auto" | "left" | "center" | "right">;
|
|
2780
2803
|
"text-radial-offset": DataDrivenProperty<number>;
|
|
2781
2804
|
"text-variable-anchor": DataConstantProperty<Array<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">>;
|
|
2805
|
+
"text-variable-anchor-offset": DataDrivenProperty<VariableAnchorOffsetCollection>;
|
|
2782
2806
|
"text-anchor": DataDrivenProperty<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">;
|
|
2783
2807
|
"text-max-angle": DataConstantProperty<number>;
|
|
2784
2808
|
"text-writing-mode": DataConstantProperty<Array<"horizontal" | "vertical">>;
|
|
@@ -2835,6 +2859,7 @@ export type SymbolLayoutPropsPossiblyEvaluated = {
|
|
|
2835
2859
|
"text-justify": PossiblyEvaluatedPropertyValue<"auto" | "left" | "center" | "right">;
|
|
2836
2860
|
"text-radial-offset": PossiblyEvaluatedPropertyValue<number>;
|
|
2837
2861
|
"text-variable-anchor": Array<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">;
|
|
2862
|
+
"text-variable-anchor-offset": PossiblyEvaluatedPropertyValue<VariableAnchorOffsetCollection>;
|
|
2838
2863
|
"text-anchor": PossiblyEvaluatedPropertyValue<"center" | "left" | "right" | "top" | "bottom" | "top-left" | "top-right" | "bottom-left" | "bottom-right">;
|
|
2839
2864
|
"text-max-angle": number;
|
|
2840
2865
|
"text-writing-mode": Array<"horizontal" | "vertical">;
|
|
@@ -3058,6 +3083,7 @@ export declare class SymbolBucket implements Bucket {
|
|
|
3058
3083
|
lineVertexArray: SymbolLineVertexArray;
|
|
3059
3084
|
features: Array<SymbolFeature>;
|
|
3060
3085
|
symbolInstances: SymbolInstanceArray;
|
|
3086
|
+
textAnchorOffsets: TextAnchorOffsetArray;
|
|
3061
3087
|
collisionArrays: Array<CollisionArrays>;
|
|
3062
3088
|
sortKeyRanges: Array<SortKeyRange>;
|
|
3063
3089
|
pixelRatio: number;
|
|
@@ -5127,7 +5153,18 @@ export declare class CollisionIndex {
|
|
|
5127
5153
|
isInsideGrid(x1: number, y1: number, x2: number, y2: number): boolean;
|
|
5128
5154
|
getViewportMatrix(): mat4;
|
|
5129
5155
|
}
|
|
5130
|
-
|
|
5156
|
+
declare enum TextAnchorEnum {
|
|
5157
|
+
"center" = 1,
|
|
5158
|
+
"left" = 2,
|
|
5159
|
+
"right" = 3,
|
|
5160
|
+
"top" = 4,
|
|
5161
|
+
"bottom" = 5,
|
|
5162
|
+
"top-left" = 6,
|
|
5163
|
+
"top-right" = 7,
|
|
5164
|
+
"bottom-left" = 8,
|
|
5165
|
+
"bottom-right" = 9
|
|
5166
|
+
}
|
|
5167
|
+
export type TextAnchor = keyof typeof TextAnchorEnum;
|
|
5131
5168
|
export declare class OpacityState {
|
|
5132
5169
|
opacity: number;
|
|
5133
5170
|
placed: boolean;
|
|
@@ -5240,7 +5277,7 @@ export declare class Placement {
|
|
|
5240
5277
|
};
|
|
5241
5278
|
constructor(transform: Transform, terrain: Terrain, fadeDuration: number, crossSourceCollisions: boolean, prevPlacement?: Placement);
|
|
5242
5279
|
getBucketParts(results: Array<BucketPart>, styleLayer: StyleLayer, tile: Tile, sortAcrossTiles: boolean): void;
|
|
5243
|
-
attemptAnchorPlacement(
|
|
5280
|
+
attemptAnchorPlacement(textAnchorOffset: TextAnchorOffset, textBox: SingleCollisionBox, width: number, height: number, textBoxScale: number, rotateWithMap: boolean, pitchWithMap: boolean, textPixelRatio: number, posMatrix: mat4, collisionGroup: CollisionGroup, textOverlapMode: OverlapMode, symbolInstance: SymbolInstance, bucket: SymbolBucket, orientation: number, iconBox?: SingleCollisionBox | null, getElevation?: (x: number, y: number) => number): {
|
|
5244
5281
|
shift: Point;
|
|
5245
5282
|
placedGlyphBoxes: {
|
|
5246
5283
|
box: Array<number>;
|
|
@@ -5451,6 +5488,13 @@ export type StyleSwapOptions = {
|
|
|
5451
5488
|
*/
|
|
5452
5489
|
transformStyle?: TransformStyleFunction;
|
|
5453
5490
|
};
|
|
5491
|
+
/**
|
|
5492
|
+
* Specifies a layer to be added to a {@link Style}. In addition to a standard {@link LayerSpecification}
|
|
5493
|
+
* or a {@link CustomLayerInterface}, a {@link LayerSpecification} with an embedded {@link SourceSpecification} can also be provided.
|
|
5494
|
+
*/
|
|
5495
|
+
export type AddLayerObject = LayerSpecification | (Omit<LayerSpecification, "source"> & {
|
|
5496
|
+
source: SourceSpecification;
|
|
5497
|
+
}) | CustomLayerInterface;
|
|
5454
5498
|
export declare class Style extends Evented {
|
|
5455
5499
|
map: Map;
|
|
5456
5500
|
stylesheet: StyleSpecification;
|
|
@@ -5577,7 +5621,7 @@ export declare class Style extends Evented {
|
|
|
5577
5621
|
* @param options - Style setter options.
|
|
5578
5622
|
* @returns `this`.
|
|
5579
5623
|
*/
|
|
5580
|
-
addLayer(layerObject:
|
|
5624
|
+
addLayer(layerObject: AddLayerObject, before?: string, options?: StyleSetterOptions): this;
|
|
5581
5625
|
/**
|
|
5582
5626
|
* Moves a layer to a different z-position. The layer will be inserted before the layer with
|
|
5583
5627
|
* ID `before`, or appended if `before` is omitted.
|
|
@@ -5600,7 +5644,7 @@ export declare class Style extends Evented {
|
|
|
5600
5644
|
* @param id - id of the desired layer
|
|
5601
5645
|
* @returns a layer, if one with the given `id` exists
|
|
5602
5646
|
*/
|
|
5603
|
-
getLayer(id: string): StyleLayer;
|
|
5647
|
+
getLayer(id: string): StyleLayer | undefined;
|
|
5604
5648
|
/**
|
|
5605
5649
|
* checks if a specific layer is present within the style.
|
|
5606
5650
|
*
|
|
@@ -9280,7 +9324,7 @@ export declare class Map extends Camera {
|
|
|
9280
9324
|
* map.setTerrain({ source: 'terrain' });
|
|
9281
9325
|
* ```
|
|
9282
9326
|
*/
|
|
9283
|
-
setTerrain(options: TerrainSpecification): this;
|
|
9327
|
+
setTerrain(options: TerrainSpecification | null): this;
|
|
9284
9328
|
/**
|
|
9285
9329
|
* Get the terrain-options if terrain is loaded
|
|
9286
9330
|
* @returns the TerrainSpecification passed to setTerrain
|
|
@@ -9289,7 +9333,7 @@ export declare class Map extends Camera {
|
|
|
9289
9333
|
* map.getTerrain(); // { source: 'terrain' };
|
|
9290
9334
|
* ```
|
|
9291
9335
|
*/
|
|
9292
|
-
getTerrain(): TerrainSpecification;
|
|
9336
|
+
getTerrain(): TerrainSpecification | null;
|
|
9293
9337
|
/**
|
|
9294
9338
|
* Returns a Boolean indicating whether all tiles in the viewport from all sources on
|
|
9295
9339
|
* the style are loaded.
|
|
@@ -9501,7 +9545,7 @@ export declare class Map extends Camera {
|
|
|
9501
9545
|
*
|
|
9502
9546
|
* @param layer - The layer to add,
|
|
9503
9547
|
* conforming to either the MapLibre Style Specification's [layer definition](https://maplibre.org/maplibre-style-spec/layers) or,
|
|
9504
|
-
* less commonly, the {@link CustomLayerInterface} specification.
|
|
9548
|
+
* less commonly, the {@link CustomLayerInterface} specification. Can also be a layer definition with an embedded source definition.
|
|
9505
9549
|
* The MapLibre Style Specification's layer definition is appropriate for most layers.
|
|
9506
9550
|
*
|
|
9507
9551
|
* @param beforeId - The ID of an existing layer to insert the new layer before,
|
|
@@ -9573,9 +9617,7 @@ export declare class Map extends Camera {
|
|
|
9573
9617
|
* @see [Add a vector tile source](https://maplibre.org/maplibre-gl-js/docs/examples/vector-source/)
|
|
9574
9618
|
* @see [Add a WMS source](https://maplibre.org/maplibre-gl-js/docs/examples/wms/)
|
|
9575
9619
|
*/
|
|
9576
|
-
addLayer(layer:
|
|
9577
|
-
source?: string | SourceSpecification;
|
|
9578
|
-
}) | CustomLayerInterface, beforeId?: string): this;
|
|
9620
|
+
addLayer(layer: AddLayerObject, beforeId?: string): this;
|
|
9579
9621
|
/**
|
|
9580
9622
|
* Moves a layer to a different z-position.
|
|
9581
9623
|
*
|
|
@@ -9619,7 +9661,7 @@ export declare class Map extends Camera {
|
|
|
9619
9661
|
* @see [Filter symbols by toggling a list](https://maplibre.org/maplibre-gl-js/docs/examples/filter-markers/)
|
|
9620
9662
|
* @see [Filter symbols by text input](https://maplibre.org/maplibre-gl-js/docs/examples/filter-markers-by-input/)
|
|
9621
9663
|
*/
|
|
9622
|
-
getLayer(id: string): StyleLayer;
|
|
9664
|
+
getLayer(id: string): StyleLayer | undefined;
|
|
9623
9665
|
/**
|
|
9624
9666
|
* Sets the zoom extent for the specified style layer. The zoom extent includes the
|
|
9625
9667
|
* [minimum zoom level](https://maplibre.org/maplibre-style-spec/layers/#minzoom)
|