maplibre-gl 3.2.2 → 3.3.0
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/generate-struct-arrays.ts +3 -1
- package/build/generate-style-code.ts +7 -8
- 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 +424 -168
- package/dist/maplibre-gl-dev.js.map +1 -1
- package/dist/maplibre-gl.d.ts +44 -7
- package/dist/maplibre-gl.js +3 -3
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +10 -10
- 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/style/properties.ts +4 -0
- 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/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>;
|