maplibre-gl 2.0.2 → 2.1.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.
Files changed (132) hide show
  1. package/build/generate-struct-arrays.ts +1 -1
  2. package/build/post-ts-build.js +0 -9
  3. package/build/release-notes.js +7 -32
  4. package/dist/maplibre-gl.css +1 -1
  5. package/dist/maplibre-gl.d.ts +57 -219
  6. package/dist/maplibre-gl.js +4 -4
  7. package/dist/maplibre-gl.js.map +1 -1
  8. package/package.json +37 -53
  9. package/src/css/maplibre-gl.css +21 -21
  10. package/src/data/array_types.ts +1 -1
  11. package/src/data/bucket/circle_bucket.ts +1 -1
  12. package/src/data/bucket/fill_bucket.test.ts +1 -1
  13. package/src/data/bucket/fill_bucket.ts +1 -1
  14. package/src/data/bucket/fill_extrusion_bucket.ts +1 -1
  15. package/src/data/bucket/line_bucket.test.ts +1 -1
  16. package/src/data/bucket/line_bucket.ts +1 -1
  17. package/src/data/bucket/symbol_bucket.test.ts +1 -1
  18. package/src/data/bucket/symbol_bucket.ts +4 -4
  19. package/src/data/bucket.ts +1 -1
  20. package/src/data/evaluation_feature.ts +1 -1
  21. package/src/data/feature_index.ts +1 -1
  22. package/src/data/load_geometry.ts +1 -1
  23. package/src/data/program_configuration.ts +1 -1
  24. package/src/geo/edge_insets.ts +1 -1
  25. package/src/geo/transform.test.ts +1 -1
  26. package/src/geo/transform.ts +1 -1
  27. package/src/index.ts +1 -1
  28. package/src/render/draw_debug.ts +1 -1
  29. package/src/render/draw_symbol.ts +1 -1
  30. package/src/render/glyph_manager.ts +1 -1
  31. package/src/render/painter.ts +5 -3
  32. package/src/render/program/circle_program.ts +1 -1
  33. package/src/render/program/line_program.ts +3 -3
  34. package/src/render/program/symbol_program.ts +1 -1
  35. package/src/source/geojson_source.test.ts +29 -1
  36. package/src/source/geojson_source.ts +2 -4
  37. package/src/source/geojson_wrapper.ts +1 -1
  38. package/src/source/image_source.test.ts +153 -0
  39. package/src/source/query_features.test.ts +1 -1
  40. package/src/source/query_features.ts +1 -1
  41. package/src/source/raster_dem_tile_source.test.ts +2 -1
  42. package/src/source/raster_dem_tile_source.ts +1 -1
  43. package/src/source/raster_tile_source.test.ts +2 -1
  44. package/src/source/raster_tile_source.ts +1 -1
  45. package/src/source/source_cache.test.ts +2 -2
  46. package/src/source/source_cache.ts +1 -1
  47. package/src/source/tile.test.ts +1 -1
  48. package/src/source/tile.ts +1 -1
  49. package/src/source/tile_id.test.ts +10 -12
  50. package/src/source/tile_id.ts +3 -3
  51. package/src/source/vector_tile_source.test.ts +2 -1
  52. package/src/source/vector_tile_source.ts +2 -2
  53. package/src/source/vector_tile_worker_source.test.ts +306 -0
  54. package/src/style/load_sprite.ts +2 -1
  55. package/src/style/properties.ts +1 -1
  56. package/src/style/query_utils.ts +1 -1
  57. package/src/style/style.test.ts +4 -0
  58. package/src/style/style.ts +1 -1
  59. package/src/style/style_layer/circle_style_layer.ts +1 -1
  60. package/src/style/style_layer/custom_style_layer.ts +2 -2
  61. package/src/style/style_layer/fill_extrusion_style_layer.ts +2 -2
  62. package/src/style/style_layer/fill_style_layer.ts +1 -1
  63. package/src/style/style_layer/line_style_layer.ts +1 -1
  64. package/src/style/style_layer/symbol_style_layer.ts +19 -0
  65. package/src/style/style_layer/symbol_style_layer_properties.ts +6 -0
  66. package/src/style/style_layer.ts +1 -1
  67. package/src/style-spec/CHANGELOG.md +6 -0
  68. package/src/style-spec/expression/index.ts +1 -1
  69. package/src/style-spec/feature_filter/feature_filter.test.ts +1 -1
  70. package/src/style-spec/migrate.test.ts +112 -0
  71. package/src/style-spec/package.json +1 -1
  72. package/src/style-spec/reference/v8.json +68 -2
  73. package/src/style-spec/style-spec.ts +0 -3
  74. package/src/style-spec/types.ts +2 -0
  75. package/src/style-spec/validate_spec.test.ts +29 -0
  76. package/src/symbol/anchor.ts +1 -1
  77. package/src/symbol/check_max_angle.test.ts +1 -1
  78. package/src/symbol/check_max_angle.ts +1 -1
  79. package/src/symbol/clip_line.test.ts +1 -1
  80. package/src/symbol/clip_line.ts +1 -1
  81. package/src/symbol/collision_feature.test.ts +1 -1
  82. package/src/symbol/collision_feature.ts +1 -1
  83. package/src/symbol/collision_index.ts +20 -20
  84. package/src/symbol/get_anchors.test.ts +1 -1
  85. package/src/symbol/get_anchors.ts +1 -1
  86. package/src/symbol/grid_index.test.ts +42 -19
  87. package/src/symbol/grid_index.ts +62 -33
  88. package/src/symbol/mergelines.test.ts +1 -1
  89. package/src/symbol/path_interpolator.test.ts +1 -1
  90. package/src/symbol/path_interpolator.ts +1 -1
  91. package/src/symbol/placement.ts +83 -54
  92. package/src/symbol/projection.ts +1 -1
  93. package/src/symbol/quads.ts +1 -1
  94. package/src/symbol/symbol_layout.ts +1 -1
  95. package/src/symbol/symbol_style_layer.test.ts +48 -1
  96. package/src/ui/camera.test.ts +0 -8
  97. package/src/ui/camera.ts +13 -3
  98. package/src/ui/control/navigation_control.ts +1 -1
  99. package/src/ui/events.ts +1 -1
  100. package/src/ui/handler/box_zoom.ts +1 -1
  101. package/src/ui/handler/click_zoom.ts +1 -1
  102. package/src/ui/handler/handler_util.ts +1 -1
  103. package/src/ui/handler/map_event.ts +1 -1
  104. package/src/ui/handler/mouse.ts +1 -1
  105. package/src/ui/handler/scroll_zoom.ts +1 -1
  106. package/src/ui/handler/tap_drag_zoom.ts +1 -1
  107. package/src/ui/handler/tap_recognizer.ts +1 -1
  108. package/src/ui/handler/tap_zoom.ts +1 -1
  109. package/src/ui/handler/touch_pan.ts +1 -1
  110. package/src/ui/handler/touch_zoom_rotate.ts +1 -1
  111. package/src/ui/handler_inertia.ts +1 -1
  112. package/src/ui/handler_manager.ts +1 -1
  113. package/src/ui/map.test.ts +61 -0
  114. package/src/ui/map.ts +35 -10
  115. package/src/ui/marker.test.ts +1 -1
  116. package/src/ui/marker.ts +2 -1
  117. package/src/ui/popup.test.ts +1 -1
  118. package/src/ui/popup.ts +2 -2
  119. package/src/util/ajax.test.ts +206 -0
  120. package/src/util/classify_rings.test.ts +1 -1
  121. package/src/util/classify_rings.ts +1 -1
  122. package/src/util/dom.ts +1 -1
  123. package/src/util/find_pole_of_inaccessibility.test.ts +1 -1
  124. package/src/util/find_pole_of_inaccessibility.ts +1 -1
  125. package/src/util/intersection_tests.ts +1 -1
  126. package/src/util/smart_wrap.ts +1 -1
  127. package/src/util/test/util.ts +14 -0
  128. package/src/util/util.test.ts +1 -1
  129. package/src/util/util.ts +1 -1
  130. package/CHANGELOG.md +0 -2585
  131. package/src/types/packages-types/vector-tile/index.d.ts +0 -27
  132. package/src/util/point.ts +0 -349
@@ -1,27 +1,8 @@
1
- import type Pbf from 'pbf';
2
- export class VectorTileLayer {
3
- version?: number;
4
- name: string;
5
- extent: number;
6
- length: number;
7
- feature(i: number): VectorTileFeature;
8
- }
9
- export class VectorTile {
10
- constructor(pbf: Pbf);
11
- layers: {[_: string]: VectorTileLayer};
12
- }
13
- export class VectorTileFeature {
14
- static types: ['Unknown', 'Point', 'LineString', 'Polygon'];
15
- extent: number;
16
- type: 1 | 2 | 3;
17
- id: number;
18
- properties: {[_: string]: string | number | boolean};
19
- loadGeometry(): Array<Array<Point>>;
20
- toGeoJSON(x: number, y: number, z: number): GeoJSON.Feature;
21
- }
22
- // Generated by dts-bundle-generator v6.1.0
1
+ // Generated by dts-bundle-generator v6.4.0
23
2
 
3
+ import Point from '@mapbox/point-geometry';
24
4
  import TinySDF from '@mapbox/tiny-sdf';
5
+ import { VectorTileFeature, VectorTileLayer } from '@mapbox/vector-tile';
25
6
  import { mat2, mat4 } from 'gl-matrix';
26
7
  import { PotpackBox } from 'potpack';
27
8
 
@@ -579,6 +560,7 @@ export declare type SymbolLayerSpecification = {
579
560
  "symbol-sort-key"?: DataDrivenPropertyValueSpecification<number>;
580
561
  "symbol-z-order"?: PropertyValueSpecification<"auto" | "viewport-y" | "source">;
581
562
  "icon-allow-overlap"?: PropertyValueSpecification<boolean>;
563
+ "icon-overlap"?: PropertyValueSpecification<"never" | "always" | "cooperative">;
582
564
  "icon-ignore-placement"?: PropertyValueSpecification<boolean>;
583
565
  "icon-optional"?: PropertyValueSpecification<boolean>;
584
566
  "icon-rotation-alignment"?: PropertyValueSpecification<"map" | "viewport" | "auto">;
@@ -623,6 +605,7 @@ export declare type SymbolLayerSpecification = {
623
605
  number
624
606
  ]>;
625
607
  "text-allow-overlap"?: PropertyValueSpecification<boolean>;
608
+ "text-overlap"?: PropertyValueSpecification<"never" | "always" | "cooperative">;
626
609
  "text-ignore-placement"?: PropertyValueSpecification<boolean>;
627
610
  "text-optional"?: PropertyValueSpecification<boolean>;
628
611
  "visibility"?: "visible" | "none";
@@ -802,187 +785,6 @@ export declare class EvaluationParameters {
802
785
  crossFadingFactor(): number;
803
786
  getCrossfadeParameters(): CrossfadeParameters;
804
787
  }
805
- /**
806
- * A {@link Point} or an array of two numbers representing `x` and `y` screen coordinates in pixels.
807
- *
808
- * @typedef {(Point | [number, number])} PointLike
809
- * @example
810
- * var p1 = new maplibregl.Point(-77, 38); // a PointLike which is a Point
811
- * var p2 = [-77, 38]; // a PointLike which is an array of two numbers
812
- */
813
- export declare type PointLike = Point | [
814
- number,
815
- number
816
- ];
817
- export declare class Point {
818
- x: number;
819
- y: number;
820
- constructor(x: number, y: number);
821
- /**
822
- * Clone this point, returning a new point that can be modified
823
- * without affecting the old one.
824
- * @returns {Point} the clone
825
- */
826
- clone(): Point;
827
- /**
828
- * Add this point's x & y coordinates to another point,
829
- * yielding a new point.
830
- * @param {Point} p the other point
831
- * @returns {Point} output point
832
- */
833
- add(p: any): Point;
834
- /**
835
- * Subtract this point's x & y coordinates to from point,
836
- * yielding a new point.
837
- * @param {Point} p the other point
838
- * @returns {Point} output point
839
- */
840
- sub(p: any): Point;
841
- /**
842
- * Multiply this point's x & y coordinates by point,
843
- * yielding a new point.
844
- * @param {Point} p the other point
845
- * @returns {Point} output point
846
- */
847
- multByPoint(p: any): Point;
848
- /**
849
- * Divide this point's x & y coordinates by point,
850
- * yielding a new point.
851
- * @param {Point} p the other point
852
- * @returns {Point} output point
853
- */
854
- divByPoint(p: any): Point;
855
- /**
856
- * Multiply this point's x & y coordinates by a factor,
857
- * yielding a new point.
858
- * @param {Point} k factor
859
- * @returns {Point} output point
860
- */
861
- mult(k: any): Point;
862
- /**
863
- * Divide this point's x & y coordinates by a factor,
864
- * yielding a new point.
865
- * @param {Point} k factor
866
- * @returns {Point} output point
867
- */
868
- div(k: any): Point;
869
- /**
870
- * Rotate this point around the 0, 0 origin by an angle a,
871
- * given in radians
872
- * @param {Number} a angle to rotate around, in radians
873
- * @returns {Point} output point
874
- */
875
- rotate(a: any): Point;
876
- /**
877
- * Rotate this point around p point by an angle a,
878
- * given in radians
879
- * @param {Number} a angle to rotate around, in radians
880
- * @param {Point} p Point to rotate around
881
- * @returns {Point} output point
882
- */
883
- rotateAround(a: any, p: any): Point;
884
- /**
885
- * Multiply this point by a 4x1 transformation matrix
886
- * @param {Array<Number>} m transformation matrix
887
- * @returns {Point} output point
888
- */
889
- matMult(m: any): Point;
890
- /**
891
- * Calculate this point but as a unit vector from 0, 0, meaning
892
- * that the distance from the resulting point to the 0, 0
893
- * coordinate will be equal to 1 and the angle from the resulting
894
- * point to the 0, 0 coordinate will be the same as before.
895
- * @returns {Point} unit vector point
896
- */
897
- unit(): Point;
898
- /**
899
- * Compute a perpendicular point, where the new y coordinate
900
- * is the old x coordinate and the new x coordinate is the old y
901
- * coordinate multiplied by -1
902
- * @returns {Point} perpendicular point
903
- */
904
- perp(): Point;
905
- /**
906
- * Return a version of this point with the x & y coordinates
907
- * rounded to integers.
908
- * @returns {Point} rounded point
909
- */
910
- round(): Point;
911
- /**
912
- * Return the magitude of this point: this is the Euclidean
913
- * distance from the 0, 0 coordinate to this point's x and y
914
- * coordinates.
915
- * @returns {Number} magnitude
916
- */
917
- mag(): number;
918
- /**
919
- * Judge whether this point is equal to another point, returning
920
- * true or false.
921
- * @param {Point} other the other point
922
- * @returns {boolean} whether the points are equal
923
- */
924
- equals(other: any): boolean;
925
- /**
926
- * Calculate the distance from this point to another point
927
- * @param {Point} p the other point
928
- * @returns {Number} distance
929
- */
930
- dist(p: any): number;
931
- /**
932
- * Calculate the distance from this point to another point,
933
- * without the square root step. Useful if you're comparing
934
- * relative distances.
935
- * @param {Point} p the other point
936
- * @returns {Number} distance
937
- */
938
- distSqr(p: any): number;
939
- /**
940
- * Get the angle from the 0, 0 coordinate to this point, in radians
941
- * coordinates.
942
- * @returns {Number} angle
943
- */
944
- angle(): number;
945
- /**
946
- * Get the angle from this point to another point, in radians
947
- * @param {Point} b the other point
948
- * @returns {Number} angle
949
- */
950
- angleTo(b: any): number;
951
- /**
952
- * Get the angle between this point and another point, in radians
953
- * @param {Point} b the other point
954
- * @returns {Number} angle
955
- */
956
- angleWith(b: any): number;
957
- angleWithSep(x: any, y: any): number;
958
- _matMult(m: any): this;
959
- _add(p: any): this;
960
- _sub(p: any): this;
961
- _mult(k: any): this;
962
- _div(k: any): this;
963
- _multByPoint(p: any): this;
964
- _divByPoint(p: any): this;
965
- _unit(): this;
966
- _perp(): this;
967
- _rotate(angle: any): this;
968
- _rotateAround(angle: any, p: any): this;
969
- _round(): this;
970
- /**
971
- * Construct a point from an array if necessary, otherwise if the input
972
- * is already a Point, or an unknown type, return it unchanged
973
- * @param {Array<Number>|Point|*} a any kind of input value
974
- * @returns {Point} constructed point, or passed-through value.
975
- * @example
976
- * // this
977
- * var point = Point.convert([0, 1]);
978
- * // is equivalent to
979
- * var point = new Point(0, 1);
980
- */
981
- static convert(a: PointLike | {
982
- x: number;
983
- y: number;
984
- }): Point;
985
- }
986
788
  export declare class LngLatBounds {
987
789
  _ne: LngLat;
988
790
  _sw: LngLat;
@@ -1285,7 +1087,7 @@ export declare class CanonicalTileID {
1285
1087
  key: string;
1286
1088
  constructor(z: number, x: number, y: number);
1287
1089
  equals(id: CanonicalTileID): boolean;
1288
- url(urls: Array<string>, scheme?: string | null): string;
1090
+ url(urls: Array<string>, pixelRatio: number, scheme?: string | null): string;
1289
1091
  getTilePoint(coord: MercatorCoordinate): Point;
1290
1092
  toString(): string;
1291
1093
  }
@@ -4166,6 +3968,7 @@ export declare type SymbolLayoutProps = {
4166
3968
  "symbol-sort-key": DataDrivenProperty<number>;
4167
3969
  "symbol-z-order": DataConstantProperty<"auto" | "viewport-y" | "source">;
4168
3970
  "icon-allow-overlap": DataConstantProperty<boolean>;
3971
+ "icon-overlap": DataConstantProperty<"never" | "always" | "cooperative">;
4169
3972
  "icon-ignore-placement": DataConstantProperty<boolean>;
4170
3973
  "icon-optional": DataConstantProperty<boolean>;
4171
3974
  "icon-rotation-alignment": DataConstantProperty<"map" | "viewport" | "auto">;
@@ -4210,6 +4013,7 @@ export declare type SymbolLayoutProps = {
4210
4013
  number
4211
4014
  ]>;
4212
4015
  "text-allow-overlap": DataConstantProperty<boolean>;
4016
+ "text-overlap": DataConstantProperty<"never" | "always" | "cooperative">;
4213
4017
  "text-ignore-placement": DataConstantProperty<boolean>;
4214
4018
  "text-optional": DataConstantProperty<boolean>;
4215
4019
  };
@@ -4220,6 +4024,7 @@ export declare type SymbolLayoutPropsPossiblyEvaluated = {
4220
4024
  "symbol-sort-key": PossiblyEvaluatedPropertyValue<number>;
4221
4025
  "symbol-z-order": "auto" | "viewport-y" | "source";
4222
4026
  "icon-allow-overlap": boolean;
4027
+ "icon-overlap": "never" | "always" | "cooperative";
4223
4028
  "icon-ignore-placement": boolean;
4224
4029
  "icon-optional": boolean;
4225
4030
  "icon-rotation-alignment": "map" | "viewport" | "auto";
@@ -4264,6 +4069,7 @@ export declare type SymbolLayoutPropsPossiblyEvaluated = {
4264
4069
  number
4265
4070
  ]>;
4266
4071
  "text-allow-overlap": boolean;
4072
+ "text-overlap": "never" | "always" | "cooperative";
4267
4073
  "text-ignore-placement": boolean;
4268
4074
  "text-optional": boolean;
4269
4075
  };
@@ -4327,6 +4133,7 @@ export declare class SymbolStyleLayer extends StyleLayer {
4327
4133
  _handleOverridablePaintPropertyUpdate<T, R>(name: string, oldValue: PropertyValue<T, R>, newValue: PropertyValue<T, R>): boolean;
4328
4134
  static hasPaintOverride(layout: PossiblyEvaluated<SymbolLayoutProps, SymbolLayoutPropsPossiblyEvaluated>, propertyName: string): boolean;
4329
4135
  }
4136
+ export declare type OverlapMode = "never" | "always" | "cooperative";
4330
4137
  export declare type TypedStyleLayer = CircleStyleLayer | FillStyleLayer | FillExtrusionStyleLayer | HeatmapStyleLayer | HillshadeStyleLayer | LineStyleLayer | SymbolStyleLayer;
4331
4138
  export declare type BucketParameters<Layer extends TypedStyleLayer> = {
4332
4139
  index: number;
@@ -6289,7 +6096,10 @@ export declare type QueryResult<T> = {
6289
6096
  x2: number;
6290
6097
  y2: number;
6291
6098
  };
6292
- export declare class GridIndex<T> {
6099
+ export declare type GridKey = {
6100
+ overlapMode?: OverlapMode;
6101
+ };
6102
+ export declare class GridIndex<T extends GridKey> {
6293
6103
  circleKeys: Array<T>;
6294
6104
  boxKeys: Array<T>;
6295
6105
  boxCells: Array<Array<number>>;
@@ -6312,8 +6122,8 @@ export declare class GridIndex<T> {
6312
6122
  private _insertCircleCell;
6313
6123
  private _query;
6314
6124
  query(x1: number, y1: number, x2: number, y2: number): Array<QueryResult<T>>;
6315
- hitTest(x1: number, y1: number, x2: number, y2: number, predicate?: (key: T) => boolean): boolean;
6316
- hitTestCircle(x: number, y: number, radius: number, predicate?: (key: T) => boolean): boolean;
6125
+ hitTest(x1: number, y1: number, x2: number, y2: number, overlapMode: OverlapMode, predicate?: (key: T) => boolean): boolean;
6126
+ hitTestCircle(x: number, y: number, radius: number, overlapMode: OverlapMode, predicate?: (key: T) => boolean): boolean;
6317
6127
  private _queryCell;
6318
6128
  private _queryCellCircle;
6319
6129
  private _forEachCell;
@@ -6326,6 +6136,7 @@ export declare type FeatureKey = {
6326
6136
  bucketInstanceId: number;
6327
6137
  featureIndex: number;
6328
6138
  collisionGroupID: number;
6139
+ overlapMode: OverlapMode;
6329
6140
  };
6330
6141
  export declare class CollisionIndex {
6331
6142
  grid: GridIndex<FeatureKey>;
@@ -6337,11 +6148,11 @@ export declare class CollisionIndex {
6337
6148
  gridRightBoundary: number;
6338
6149
  gridBottomBoundary: number;
6339
6150
  constructor(transform: Transform, grid?: GridIndex<FeatureKey>, ignoredGrid?: GridIndex<FeatureKey>);
6340
- placeCollisionBox(collisionBox: SingleCollisionBox, allowOverlap: boolean, textPixelRatio: number, posMatrix: mat4, collisionGroupPredicate?: (key: FeatureKey) => boolean): {
6151
+ placeCollisionBox(collisionBox: SingleCollisionBox, overlapMode: OverlapMode, textPixelRatio: number, posMatrix: mat4, collisionGroupPredicate?: (key: FeatureKey) => boolean): {
6341
6152
  box: Array<number>;
6342
6153
  offscreen: boolean;
6343
6154
  };
6344
- placeCollisionCircles(allowOverlap: boolean, symbol: any, lineVertexArray: SymbolLineVertexArray, glyphOffsetArray: GlyphOffsetArray, fontSize: number, posMatrix: mat4, labelPlaneMatrix: mat4, labelToScreenMatrix: mat4, showCollisionCircles: boolean, pitchWithMap: boolean, collisionGroupPredicate: (key: FeatureKey) => boolean, circlePixelDiameter: number, textPixelPadding: number): {
6155
+ placeCollisionCircles(overlapMode: OverlapMode, symbol: any, lineVertexArray: SymbolLineVertexArray, glyphOffsetArray: GlyphOffsetArray, fontSize: number, posMatrix: mat4, labelPlaneMatrix: mat4, labelToScreenMatrix: mat4, showCollisionCircles: boolean, pitchWithMap: boolean, collisionGroupPredicate: (key: FeatureKey) => boolean, circlePixelDiameter: number, textPixelPadding: number): {
6345
6156
  circles: Array<number>;
6346
6157
  offscreen: boolean;
6347
6158
  collisionDetected: boolean;
@@ -6354,8 +6165,8 @@ export declare class CollisionIndex {
6354
6165
  * @private
6355
6166
  */
6356
6167
  queryRenderedSymbols(viewportQueryGeometry: Array<Point>): {};
6357
- insertCollisionBox(collisionBox: Array<number>, ignorePlacement: boolean, bucketInstanceId: number, featureIndex: number, collisionGroupID: number): void;
6358
- insertCollisionCircles(collisionCircles: Array<number>, ignorePlacement: boolean, bucketInstanceId: number, featureIndex: number, collisionGroupID: number): void;
6168
+ insertCollisionBox(collisionBox: Array<number>, overlapMode: OverlapMode, ignorePlacement: boolean, bucketInstanceId: number, featureIndex: number, collisionGroupID: number): void;
6169
+ insertCollisionCircles(collisionCircles: Array<number>, overlapMode: OverlapMode, ignorePlacement: boolean, bucketInstanceId: number, featureIndex: number, collisionGroupID: number): void;
6359
6170
  projectAndGetPerspectiveRatio(posMatrix: mat4, x: number, y: number): {
6360
6171
  point: Point;
6361
6172
  perspectiveRatio: number;
@@ -6400,7 +6211,7 @@ export declare class RetainedQueryData {
6400
6211
  }
6401
6212
  export declare type CollisionGroup = {
6402
6213
  ID: number;
6403
- predicate?: any;
6214
+ predicate?: (key: FeatureKey) => boolean;
6404
6215
  };
6405
6216
  export declare class CollisionGroups {
6406
6217
  collisionGroups: {
@@ -6476,7 +6287,7 @@ export declare class Placement {
6476
6287
  };
6477
6288
  constructor(transform: Transform, fadeDuration: number, crossSourceCollisions: boolean, prevPlacement?: Placement);
6478
6289
  getBucketParts(results: Array<BucketPart>, styleLayer: StyleLayer, tile: Tile, sortAcrossTiles: boolean): void;
6479
- attemptAnchorPlacement(anchor: TextAnchor, textBox: SingleCollisionBox, width: number, height: number, textBoxScale: number, rotateWithMap: boolean, pitchWithMap: boolean, textPixelRatio: number, posMatrix: mat4, collisionGroup: CollisionGroup, textAllowOverlap: boolean, symbolInstance: SymbolInstance, bucket: SymbolBucket, orientation: number, iconBox?: SingleCollisionBox | null): {
6290
+ attemptAnchorPlacement(anchor: TextAnchor, 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): {
6480
6291
  shift: Point;
6481
6292
  placedGlyphBoxes: {
6482
6293
  box: Array<number>;
@@ -6840,6 +6651,7 @@ export declare class Painter {
6840
6651
  emptyProgramConfiguration: ProgramConfiguration;
6841
6652
  width: number;
6842
6653
  height: number;
6654
+ pixelRatio: number;
6843
6655
  tileExtentBuffer: VertexBuffer;
6844
6656
  tileExtentSegments: SegmentVector;
6845
6657
  debugBuffer: VertexBuffer;
@@ -6879,7 +6691,7 @@ export declare class Painter {
6879
6691
  debugOverlayTexture: Texture;
6880
6692
  debugOverlayCanvas: HTMLCanvasElement;
6881
6693
  constructor(gl: WebGLRenderingContext, transform: Transform);
6882
- resize(width: number, height: number): void;
6694
+ resize(width: number, height: number, pixelRatio: number): void;
6883
6695
  setup(): void;
6884
6696
  clearStencil(): void;
6885
6697
  _renderTileClippingMasks(layer: StyleLayer, tileIDs: Array<OverscaledTileID>): void;
@@ -7193,6 +7005,18 @@ export declare class TaskQueue {
7193
7005
  run(timeStamp?: number): void;
7194
7006
  clear(): void;
7195
7007
  }
7008
+ /**
7009
+ * A [Point](https://github.com/mapbox/point-geometry) or an array of two numbers representing `x` and `y` screen coordinates in pixels.
7010
+ *
7011
+ * @typedef {(Point | [number, number])} PointLike
7012
+ * @example
7013
+ * var p1 = new Point(-77, 38); // a PointLike which is a Point
7014
+ * var p2 = [-77, 38]; // a PointLike which is an array of two numbers
7015
+ */
7016
+ export declare type PointLike = Point | [
7017
+ number,
7018
+ number
7019
+ ];
7196
7020
  export declare type RequireAtLeastOne<T> = {
7197
7021
  [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;
7198
7022
  }[keyof T];
@@ -7614,7 +7438,7 @@ declare abstract class Camera extends Evented {
7614
7438
  * @memberof Map#
7615
7439
  * @param bounds Center these bounds in the viewport and use the highest
7616
7440
  * zoom level up to and including `Map#getMaxZoom()` that fits them in the viewport.
7617
- * @param {Object} [options] Options supports all properties from {@link AnimationOptions} and {@link CameraOptions} in addition to the fields below.
7441
+ * @param {FitBoundsOptions} [options] Options supports all properties from {@link AnimationOptions} and {@link CameraOptions} in addition to the fields below.
7618
7442
  * @param {number | PaddingOptions} [options.padding] The amount of padding in pixels to add to the given bounds.
7619
7443
  * @param {boolean} [options.linear=false] If `true`, the map transitions using
7620
7444
  * {@link Map#easeTo}. If `false`, the map transitions using {@link Map#flyTo}. See
@@ -7741,7 +7565,7 @@ declare abstract class Camera extends Evented {
7741
7565
  * unless 'options' includes `essential: true`.
7742
7566
  *
7743
7567
  * @memberof Map#
7744
- * @param {Object} options Options describing the destination and animation of the transition.
7568
+ * @param {FlyToOptions} options Options describing the destination and animation of the transition.
7745
7569
  * Accepts {@link CameraOptions}, {@link AnimationOptions},
7746
7570
  * and the following additional options.
7747
7571
  * @param {number} [options.curve=1.42] The zooming "curve" that will occur along the
@@ -8443,6 +8267,7 @@ export declare type MapOptions = {
8443
8267
  localIdeographFontFamily?: string;
8444
8268
  style: StyleSpecification | string;
8445
8269
  pitchWithRotate?: boolean;
8270
+ pixelRatio?: number;
8446
8271
  };
8447
8272
  export declare type Complete<T> = {
8448
8273
  [P in keyof Required<T>]: Pick<T, P> extends Required<Pick<T, P>> ? T[P] : (T[P] | undefined);
@@ -8492,6 +8317,7 @@ export declare class Map extends Camera {
8492
8317
  _locale: any;
8493
8318
  _removed: boolean;
8494
8319
  _clickTolerance: number;
8320
+ _pixelRatio: number;
8495
8321
  /**
8496
8322
  * The map's {@link ScrollZoomHandler}, which implements zooming in and out with a scroll wheel or trackpad.
8497
8323
  * Find more details and examples using `scrollZoom` in the {@link ScrollZoomHandler} section.
@@ -8595,6 +8421,18 @@ export declare class Map extends Camera {
8595
8421
  * if (mapDiv.style.visibility === true) map.resize();
8596
8422
  */
8597
8423
  resize(eventData?: any): this;
8424
+ /**
8425
+ * Returns the map's pixel ratio.
8426
+ * @returns {number} The pixel ratio.
8427
+ */
8428
+ getPixelRatio(): number;
8429
+ /**
8430
+ * Sets the map's pixel ratio. This allows to override `devicePixelRatio`.
8431
+ * After this call, the canvas' `width` attribute will be `container.clientWidth * pixelRatio`
8432
+ * and its height attribute will be `container.clientHeight * pixelRatio`.
8433
+ * @param pixelRatio {number} The pixel ratio.
8434
+ */
8435
+ setPixelRatio(pixelRatio: number): void;
8598
8436
  /**
8599
8437
  * Returns the map's geographical bounds. When the bearing or pitch is non-zero, the visible region is not
8600
8438
  * an axis-aligned rectangle, and the result is the smallest bounds that encompasses the visible region.
@@ -8738,11 +8576,11 @@ export declare class Map extends Camera {
8738
8576
  */
8739
8577
  setRenderWorldCopies(renderWorldCopies?: boolean | null): this;
8740
8578
  /**
8741
- * Returns a {@link Point} representing pixel coordinates, relative to the map's `container`,
8579
+ * Returns a [Point](https://github.com/mapbox/point-geometry) representing pixel coordinates, relative to the map's `container`,
8742
8580
  * that correspond to the specified geographical location.
8743
8581
  *
8744
8582
  * @param {LngLatLike} lnglat The geographical location to project.
8745
- * @returns {Point} The {@link Point} corresponding to `lnglat`, relative to the map's `container`.
8583
+ * @returns {Point} The [Point](https://github.com/mapbox/point-geometry) corresponding to `lnglat`, relative to the map's `container`.
8746
8584
  * @example
8747
8585
  * var coordinate = [-122.420679, 37.772537];
8748
8586
  * var point = map.project(coordinate);
@@ -9792,7 +9630,7 @@ export declare class Map extends Camera {
9792
9630
  getCanvas(): HTMLCanvasElement;
9793
9631
  _containerDimensions(): number[];
9794
9632
  _setupContainer(): void;
9795
- _resizeCanvas(width: number, height: number): void;
9633
+ _resizeCanvas(width: number, height: number, pixelRatio: number): void;
9796
9634
  _setupPainter(): void;
9797
9635
  _contextLost(event: any): void;
9798
9636
  _contextRestored(event: any): void;