@mapwhit/tilerenderer 0.47.1 → 0.48.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 (76) hide show
  1. package/build/min/package.json +1 -1
  2. package/package.json +1 -2
  3. package/src/data/array_types.js +1 -1
  4. package/src/data/bucket/circle_bucket.js +1 -1
  5. package/src/data/bucket/fill_bucket.js +1 -1
  6. package/src/data/bucket/fill_extrusion_bucket.js +1 -1
  7. package/src/data/bucket/heatmap_bucket.js +1 -1
  8. package/src/data/bucket/line_bucket.js +1 -1
  9. package/src/data/bucket/symbol_bucket.js +26 -12
  10. package/src/data/dem_data.js +1 -1
  11. package/src/data/feature_index.js +43 -82
  12. package/src/data/program_configuration.js +19 -11
  13. package/src/data/segment.js +2 -2
  14. package/src/geo/transform.js +4 -2
  15. package/src/gl/color_mode.js +6 -6
  16. package/src/index.js +3 -1
  17. package/src/render/glyph_atlas.js +1 -1
  18. package/src/render/glyph_manager.js +43 -48
  19. package/src/render/image_atlas.js +1 -1
  20. package/src/render/image_manager.js +9 -37
  21. package/src/source/geojson_source.js +49 -93
  22. package/src/source/geojson_worker_source.js +33 -134
  23. package/src/source/image_source.js +9 -14
  24. package/src/source/load_tilejson.js +27 -34
  25. package/src/source/raster_dem_tile_source.js +27 -40
  26. package/src/source/raster_tile_source.js +53 -62
  27. package/src/source/rtl_text_plugin.js +3 -1
  28. package/src/source/source_cache.js +23 -21
  29. package/src/source/source_state.js +17 -26
  30. package/src/source/tile.js +6 -5
  31. package/src/source/tile_id.js +1 -1
  32. package/src/source/vector_tile_source.js +56 -73
  33. package/src/source/vector_tile_worker_source.js +20 -85
  34. package/src/source/worker.js +37 -103
  35. package/src/source/worker_tile.js +39 -84
  36. package/src/style/load_sprite.js +14 -17
  37. package/src/style/properties.js +1 -1
  38. package/src/style/style.js +22 -37
  39. package/src/style/style_layer/symbol_style_layer_properties.js +1 -1
  40. package/src/style/style_layer_index.js +17 -23
  41. package/src/style-spec/expression/compound_expression.js +30 -16
  42. package/src/style-spec/expression/definitions/coercion.js +13 -0
  43. package/src/style-spec/expression/definitions/comparison.js +193 -0
  44. package/src/style-spec/expression/definitions/formatted.js +123 -0
  45. package/src/style-spec/expression/definitions/index.js +10 -60
  46. package/src/style-spec/expression/definitions/interpolate.js +17 -7
  47. package/src/style-spec/expression/definitions/literal.js +5 -0
  48. package/src/style-spec/expression/parsing_context.js +4 -0
  49. package/src/style-spec/expression/types.js +12 -1
  50. package/src/style-spec/feature_filter/index.js +1 -1
  51. package/src/style-spec/reference/v8.json +120 -49
  52. package/src/symbol/anchor.js +1 -1
  53. package/src/symbol/collision_index.js +23 -16
  54. package/src/symbol/get_anchors.js +11 -22
  55. package/src/symbol/grid_index.js +176 -182
  56. package/src/symbol/mergelines.js +51 -48
  57. package/src/symbol/opacity_state.js +1 -1
  58. package/src/symbol/placement.js +8 -2
  59. package/src/symbol/quads.js +7 -6
  60. package/src/symbol/shaping.js +185 -40
  61. package/src/symbol/symbol_layout.js +9 -6
  62. package/src/symbol/transform_text.js +12 -1
  63. package/src/ui/camera.js +82 -85
  64. package/src/ui/map.js +13 -57
  65. package/src/util/actor.js +46 -42
  66. package/src/util/browser.js +6 -0
  67. package/src/util/dictionary_coder.js +13 -21
  68. package/src/util/dispatcher.js +14 -17
  69. package/src/util/image.js +1 -1
  70. package/src/util/loader/image.js +11 -11
  71. package/src/util/polyfill.js +16 -0
  72. package/src/util/task_queue.js +39 -43
  73. package/src/util/transfer_registry.js +167 -0
  74. package/src/util/web_worker_transfer.js +5 -190
  75. package/src/source/raster_dem_tile_worker_source.js +0 -26
  76. package/src/style-spec/expression/definitions/equals.js +0 -93
@@ -7,6 +7,7 @@ const ObjectType = { kind: 'object' };
7
7
  const ValueType = { kind: 'value' };
8
8
  const ErrorType = { kind: 'error' };
9
9
  const CollatorType = { kind: 'collator' };
10
+ const FormattedType = { kind: 'formatted' };
10
11
 
11
12
  function array(itemType, N) {
12
13
  return {
@@ -28,7 +29,16 @@ function toString(type) {
28
29
  return type.kind;
29
30
  }
30
31
 
31
- const valueMemberTypes = [NullType, NumberType, StringType, BooleanType, ColorType, ObjectType, array(ValueType)];
32
+ const valueMemberTypes = [
33
+ NullType,
34
+ NumberType,
35
+ StringType,
36
+ BooleanType,
37
+ ColorType,
38
+ FormattedType,
39
+ ObjectType,
40
+ array(ValueType)
41
+ ];
32
42
 
33
43
  /**
34
44
  * Returns null if `t` is a subtype of `expected`; otherwise returns an
@@ -67,6 +77,7 @@ module.exports = {
67
77
  StringType,
68
78
  BooleanType,
69
79
  ColorType,
80
+ FormattedType,
70
81
  ObjectType,
71
82
  ValueType,
72
83
  ErrorType,
@@ -24,7 +24,7 @@ function isExpressionFilter(filter) {
24
24
  case '>=':
25
25
  case '<':
26
26
  case '<=':
27
- return filter.length === 3 && (Array.isArray(filter[1]) || Array.isArray(filter[2]));
27
+ return filter.length !== 3 || Array.isArray(filter[1]) || Array.isArray(filter[2]);
28
28
 
29
29
  case 'any':
30
30
  case 'all':
@@ -80,7 +80,7 @@
80
80
  },
81
81
  "transition": {
82
82
  "type": "transition",
83
- "doc": "A global transition definition to use as a default across properties.",
83
+ "doc": "A global transition definition to use as a default across properties, to be used for timing transitions between one value and the next when no property-specific transition is set. Collision-based symbol fading is controlled independently of the style's `transition` property.",
84
84
  "example": {
85
85
  "duration": 300,
86
86
  "delay": 0
@@ -144,12 +144,25 @@
144
144
  "length": 4,
145
145
  "default": [
146
146
  -180,
147
- -85.0511,
147
+ -85.051129,
148
148
  180,
149
- 85.0511
149
+ 85.051129
150
150
  ],
151
151
  "doc": "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL."
152
152
  },
153
+ "scheme": {
154
+ "type": "enum",
155
+ "values": {
156
+ "xyz": {
157
+ "doc": "Slippy map tilenames scheme."
158
+ },
159
+ "tms": {
160
+ "doc": "OSGeo spec scheme."
161
+ }
162
+ },
163
+ "default": "xyz",
164
+ "doc": "Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed."
165
+ },
153
166
  "minzoom": {
154
167
  "type": "number",
155
168
  "default": 0,
@@ -195,9 +208,9 @@
195
208
  "length": 4,
196
209
  "default": [
197
210
  -180,
198
- -85.0511,
211
+ -85.051129,
199
212
  180,
200
- 85.0511
213
+ 85.051129
201
214
  ],
202
215
  "doc": "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL."
203
216
  },
@@ -265,9 +278,9 @@
265
278
  "length": 4,
266
279
  "default": [
267
280
  -180,
268
- -85.0511,
281
+ -85.051129,
269
282
  180,
270
- 85.0511
283
+ 85.051129
271
284
  ],
272
285
  "doc": "An array containing the longitude and latitude of the southwest and northeast corners of the source's bounding box in the following order: `[sw.lng, sw.lat, ne.lng, ne.lat]`. When this property is included in a source, no tiles outside of the given bounds are requested by Mapbox GL."
273
286
  },
@@ -559,7 +572,7 @@
559
572
  },
560
573
  "filter": {
561
574
  "type": "filter",
562
- "doc": "A expression specifying conditions on source features. Only features that match the filter are displayed."
575
+ "doc": "A expression specifying conditions on source features. Only features that match the filter are displayed. The `feature-state` expression is not supported in filter expressions."
563
576
  },
564
577
  "layout": {
565
578
  "type": "layout",
@@ -1488,10 +1501,10 @@
1488
1501
  "property-type": "data-constant"
1489
1502
  },
1490
1503
  "text-field": {
1491
- "type": "string",
1504
+ "type": "formatted",
1492
1505
  "default": "",
1493
1506
  "tokens": true,
1494
- "doc": "Value to use for a text label.",
1507
+ "doc": "Value to use for a text label. If a plain `string` is provided, it will be treated as a `formatted` with default/inherited formatting options.",
1495
1508
  "sdk-support": {
1496
1509
  "basic functionality": {
1497
1510
  "js": "0.10.0",
@@ -2383,6 +2396,24 @@
2383
2396
  }
2384
2397
  }
2385
2398
  },
2399
+ "interpolate-hcl": {
2400
+ "doc": "Produces continuous, smooth results by interpolating between pairs of input and output values (\"stops\"). Works like `interpolate`, but the output type must be `color`, and the interpolation is performed in the Hue-Chroma-Luminance color space.",
2401
+ "group": "Ramps, scales, curves",
2402
+ "sdk-support": {
2403
+ "basic functionality": {
2404
+ "js": "0.49.0"
2405
+ }
2406
+ }
2407
+ },
2408
+ "interpolate-lab": {
2409
+ "doc": "Produces continuous, smooth results by interpolating between pairs of input and output values (\"stops\"). Works like `interpolate`, but the output type must be `color`, and the interpolation is performed in the CIELAB color space.",
2410
+ "group": "Ramps, scales, curves",
2411
+ "sdk-support": {
2412
+ "basic functionality": {
2413
+ "js": "0.49.0"
2414
+ }
2415
+ }
2416
+ },
2386
2417
  "ln2": {
2387
2418
  "doc": "Returns mathematical constant ln(2).",
2388
2419
  "group": "Math",
@@ -2488,6 +2519,15 @@
2488
2519
  }
2489
2520
  }
2490
2521
  },
2522
+ "format": {
2523
+ "doc": "Returns `formatted` text containing annotations for use in mixed-format `text-field` entries. If set, the `text-font` argument overrides the font specified by the root layout properties. If set, the `font-scale` argument specifies a scaling factor relative to the `text-size` specified in the root layout properties.",
2524
+ "group": "Types",
2525
+ "sdk-support": {
2526
+ "basic functionality": {
2527
+ "js": "0.48.0"
2528
+ }
2529
+ }
2530
+ },
2491
2531
  "to-string": {
2492
2532
  "doc": "Converts the input value to a string. If the input is `null`, the result is `\"\"`. If the input is a boolean, the result is `\"true\"` or `\"false\"`. If the input is a number, it is converted to a string as specified by the [\"NumberToString\" algorithm](https://tc39.github.io/ecma262/#sec-tostring-applied-to-the-number-type) of the ECMAScript Language Specification. If the input is a color, it is converted to a string of the form `\"rgba(r,g,b,a)\"`, where `r`, `g`, and `b` are numerals ranging from 0 to 255, and `a` ranges from 0 to 1. Otherwise, the input is converted to a string in the format specified by the [`JSON.stringify`](https://tc39.github.io/ecma262/#sec-json.stringify) function of the ECMAScript Language Specification.",
2493
2533
  "group": "Types",
@@ -2621,7 +2661,7 @@
2621
2661
  }
2622
2662
  },
2623
2663
  "feature-state": {
2624
- "doc": "Retrieves a property value from the current feature's state. Returns null if the requested property is not present on the feature's state object.",
2664
+ "doc": "Retrieves a property value from the current feature's state. Returns null if the requested property is not present on the feature's state. A feature's state is not part of the GeoJSON or vector tile data, and must be set programmatically on each feature. Note that [\"feature-state\"] can only be used with paint properties that support data-driven styling.",
2625
2665
  "group": "Feature data",
2626
2666
  "sdk-support": {
2627
2667
  "basic functionality": {
@@ -2946,7 +2986,7 @@
2946
2986
  }
2947
2987
  },
2948
2988
  "==": {
2949
- "doc": "Returns `true` if the input values are equal, `false` otherwise. Equality is strictly typed: values of different types are always considered not equal. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
2989
+ "doc": "Returns `true` if the input values are equal, `false` otherwise. The comparison is strictly typed: values of different runtime types are always considered unequal. Cases where the types are known to be different at parse time are considered invalid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
2950
2990
  "group": "Decision",
2951
2991
  "sdk-support": {
2952
2992
  "basic functionality": {
@@ -2958,7 +2998,7 @@
2958
2998
  }
2959
2999
  },
2960
3000
  "!=": {
2961
- "doc": "Returns `true` if the input values are not equal, `false` otherwise. Equality is strictly typed: values of different types are always considered not equal. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
3001
+ "doc": "Returns `true` if the input values are not equal, `false` otherwise. The comparison is strictly typed: values of different runtime types are always considered unequal. Cases where the types are known to be different at parse time are considered invalid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
2962
3002
  "group": "Decision",
2963
3003
  "sdk-support": {
2964
3004
  "basic functionality": {
@@ -2970,7 +3010,7 @@
2970
3010
  }
2971
3011
  },
2972
3012
  ">": {
2973
- "doc": "Returns `true` if the first input is strictly greater than the second, `false` otherwise. The inputs must be numbers or strings, and both of the same type. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
3013
+ "doc": "Returns `true` if the first input is strictly greater than the second, `false` otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
2974
3014
  "group": "Decision",
2975
3015
  "sdk-support": {
2976
3016
  "basic functionality": {
@@ -2982,7 +3022,7 @@
2982
3022
  }
2983
3023
  },
2984
3024
  "<": {
2985
- "doc": "Returns `true` if the first input is strictly less than the second, `false` otherwise. The inputs must be numbers or strings, and both of the same type. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
3025
+ "doc": "Returns `true` if the first input is strictly less than the second, `false` otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
2986
3026
  "group": "Decision",
2987
3027
  "sdk-support": {
2988
3028
  "basic functionality": {
@@ -2994,7 +3034,7 @@
2994
3034
  }
2995
3035
  },
2996
3036
  ">=": {
2997
- "doc": "Returns `true` if the first input is greater than or equal to the second, `false` otherwise. The inputs must be numbers or strings, and both of the same type. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
3037
+ "doc": "Returns `true` if the first input is greater than or equal to the second, `false` otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
2998
3038
  "group": "Decision",
2999
3039
  "sdk-support": {
3000
3040
  "basic functionality": {
@@ -3006,7 +3046,7 @@
3006
3046
  }
3007
3047
  },
3008
3048
  "<=": {
3009
- "doc": "Returns `true` if the first input is less than or equal to the second, `false` otherwise. The inputs must be numbers or strings, and both of the same type. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
3049
+ "doc": "Returns `true` if the first input is less than or equal to the second, `false` otherwise. The arguments are required to be either both strings or both numbers; if during evaluation they are not, expression evaluation produces an error. Cases where this constraint is known not to hold at parse time are considered in valid and will produce a parse error. Accepts an optional `collator` argument to control locale-dependent string comparisons.",
3010
3050
  "group": "Decision",
3011
3051
  "sdk-support": {
3012
3052
  "basic functionality": {
@@ -3082,7 +3122,7 @@
3082
3122
  }
3083
3123
  },
3084
3124
  "concat": {
3085
- "doc": "Returns a string consisting of the concatenation of the inputs.",
3125
+ "doc": "Returns a `string` consisting of the concatenation of the inputs. If any inputs are `formatted`, returns a `formatted` with default formatting options for all unformatted inputs.",
3086
3126
  "group": "String",
3087
3127
  "sdk-support": {
3088
3128
  "basic functionality": {
@@ -3270,7 +3310,8 @@
3270
3310
  "interpolated": true,
3271
3311
  "parameters": [
3272
3312
  "zoom",
3273
- "feature"
3313
+ "feature",
3314
+ "feature-state"
3274
3315
  ]
3275
3316
  },
3276
3317
  "property-type": "data-driven"
@@ -3303,7 +3344,8 @@
3303
3344
  "interpolated": true,
3304
3345
  "parameters": [
3305
3346
  "zoom",
3306
- "feature"
3347
+ "feature",
3348
+ "feature-state"
3307
3349
  ]
3308
3350
  },
3309
3351
  "property-type": "data-driven"
@@ -3338,7 +3380,8 @@
3338
3380
  "interpolated": true,
3339
3381
  "parameters": [
3340
3382
  "zoom",
3341
- "feature"
3383
+ "feature",
3384
+ "feature-state"
3342
3385
  ]
3343
3386
  },
3344
3387
  "property-type": "data-driven"
@@ -3480,7 +3523,8 @@
3480
3523
  "interpolated": true,
3481
3524
  "parameters": [
3482
3525
  "zoom",
3483
- "feature"
3526
+ "feature",
3527
+ "feature-state"
3484
3528
  ]
3485
3529
  },
3486
3530
  "property-type": "data-driven"
@@ -3592,7 +3636,8 @@
3592
3636
  "interpolated": true,
3593
3637
  "parameters": [
3594
3638
  "zoom",
3595
- "feature"
3639
+ "feature",
3640
+ "feature-state"
3596
3641
  ]
3597
3642
  },
3598
3643
  "property-type": "data-driven"
@@ -3625,7 +3670,8 @@
3625
3670
  "interpolated": true,
3626
3671
  "parameters": [
3627
3672
  "zoom",
3628
- "feature"
3673
+ "feature",
3674
+ "feature-state"
3629
3675
  ]
3630
3676
  },
3631
3677
  "property-type": "data-driven"
@@ -3673,7 +3719,8 @@
3673
3719
  "interpolated": true,
3674
3720
  "parameters": [
3675
3721
  "zoom",
3676
- "feature"
3722
+ "feature",
3723
+ "feature-state"
3677
3724
  ]
3678
3725
  },
3679
3726
  "property-type": "data-driven"
@@ -3706,7 +3753,8 @@
3706
3753
  "interpolated": true,
3707
3754
  "parameters": [
3708
3755
  "zoom",
3709
- "feature"
3756
+ "feature",
3757
+ "feature-state"
3710
3758
  ]
3711
3759
  },
3712
3760
  "property-type": "data-driven"
@@ -3793,7 +3841,8 @@
3793
3841
  "interpolated": true,
3794
3842
  "parameters": [
3795
3843
  "zoom",
3796
- "feature"
3844
+ "feature",
3845
+ "feature-state"
3797
3846
  ]
3798
3847
  },
3799
3848
  "property-type": "data-driven"
@@ -3823,7 +3872,8 @@
3823
3872
  "interpolated": true,
3824
3873
  "parameters": [
3825
3874
  "zoom",
3826
- "feature"
3875
+ "feature",
3876
+ "feature-state"
3827
3877
  ]
3828
3878
  },
3829
3879
  "property-type": "data-driven"
@@ -3852,7 +3902,8 @@
3852
3902
  "interpolated": true,
3853
3903
  "parameters": [
3854
3904
  "zoom",
3855
- "feature"
3905
+ "feature",
3906
+ "feature-state"
3856
3907
  ]
3857
3908
  },
3858
3909
  "property-type": "data-driven"
@@ -3882,7 +3933,8 @@
3882
3933
  "interpolated": true,
3883
3934
  "parameters": [
3884
3935
  "zoom",
3885
- "feature"
3936
+ "feature",
3937
+ "feature-state"
3886
3938
  ]
3887
3939
  },
3888
3940
  "property-type": "data-driven"
@@ -3999,7 +4051,8 @@
3999
4051
  "interpolated": true,
4000
4052
  "parameters": [
4001
4053
  "zoom",
4002
- "feature"
4054
+ "feature",
4055
+ "feature-state"
4003
4056
  ]
4004
4057
  },
4005
4058
  "property-type": "data-driven"
@@ -4027,7 +4080,8 @@
4027
4080
  "interpolated": true,
4028
4081
  "parameters": [
4029
4082
  "zoom",
4030
- "feature"
4083
+ "feature",
4084
+ "feature-state"
4031
4085
  ]
4032
4086
  },
4033
4087
  "property-type": "data-driven"
@@ -4055,7 +4109,8 @@
4055
4109
  "interpolated": true,
4056
4110
  "parameters": [
4057
4111
  "zoom",
4058
- "feature"
4112
+ "feature",
4113
+ "feature-state"
4059
4114
  ]
4060
4115
  },
4061
4116
  "property-type": "data-driven"
@@ -4085,7 +4140,8 @@
4085
4140
  "interpolated": true,
4086
4141
  "parameters": [
4087
4142
  "zoom",
4088
- "feature"
4143
+ "feature",
4144
+ "feature-state"
4089
4145
  ]
4090
4146
  },
4091
4147
  "property-type": "data-driven"
@@ -4233,7 +4289,8 @@
4233
4289
  "interpolated": true,
4234
4290
  "parameters": [
4235
4291
  "zoom",
4236
- "feature"
4292
+ "feature",
4293
+ "feature-state"
4237
4294
  ]
4238
4295
  },
4239
4296
  "property-type": "data-driven"
@@ -4261,7 +4318,8 @@
4261
4318
  "interpolated": true,
4262
4319
  "parameters": [
4263
4320
  "zoom",
4264
- "feature"
4321
+ "feature",
4322
+ "feature-state"
4265
4323
  ]
4266
4324
  },
4267
4325
  "property-type": "data-driven"
@@ -4291,7 +4349,8 @@
4291
4349
  "interpolated": true,
4292
4350
  "parameters": [
4293
4351
  "zoom",
4294
- "feature"
4352
+ "feature",
4353
+ "feature-state"
4295
4354
  ]
4296
4355
  },
4297
4356
  "property-type": "data-driven"
@@ -4323,7 +4382,8 @@
4323
4382
  "interpolated": true,
4324
4383
  "parameters": [
4325
4384
  "zoom",
4326
- "feature"
4385
+ "feature",
4386
+ "feature-state"
4327
4387
  ]
4328
4388
  },
4329
4389
  "property-type": "data-driven"
@@ -4352,7 +4412,8 @@
4352
4412
  "interpolated": true,
4353
4413
  "parameters": [
4354
4414
  "zoom",
4355
- "feature"
4415
+ "feature",
4416
+ "feature-state"
4356
4417
  ]
4357
4418
  },
4358
4419
  "property-type": "data-driven"
@@ -4476,7 +4537,8 @@
4476
4537
  "interpolated": true,
4477
4538
  "parameters": [
4478
4539
  "zoom",
4479
- "feature"
4540
+ "feature",
4541
+ "feature-state"
4480
4542
  ]
4481
4543
  },
4482
4544
  "property-type": "data-driven"
@@ -4507,7 +4569,8 @@
4507
4569
  "interpolated": true,
4508
4570
  "parameters": [
4509
4571
  "zoom",
4510
- "feature"
4572
+ "feature",
4573
+ "feature-state"
4511
4574
  ]
4512
4575
  },
4513
4576
  "property-type": "data-driven"
@@ -4538,7 +4601,8 @@
4538
4601
  "interpolated": true,
4539
4602
  "parameters": [
4540
4603
  "zoom",
4541
- "feature"
4604
+ "feature",
4605
+ "feature-state"
4542
4606
  ]
4543
4607
  },
4544
4608
  "property-type": "data-driven"
@@ -4571,7 +4635,8 @@
4571
4635
  "interpolated": true,
4572
4636
  "parameters": [
4573
4637
  "zoom",
4574
- "feature"
4638
+ "feature",
4639
+ "feature-state"
4575
4640
  ]
4576
4641
  },
4577
4642
  "property-type": "data-driven"
@@ -4604,7 +4669,8 @@
4604
4669
  "interpolated": true,
4605
4670
  "parameters": [
4606
4671
  "zoom",
4607
- "feature"
4672
+ "feature",
4673
+ "feature-state"
4608
4674
  ]
4609
4675
  },
4610
4676
  "property-type": "data-driven"
@@ -4701,7 +4767,8 @@
4701
4767
  "interpolated": true,
4702
4768
  "parameters": [
4703
4769
  "zoom",
4704
- "feature"
4770
+ "feature",
4771
+ "feature-state"
4705
4772
  ]
4706
4773
  },
4707
4774
  "property-type": "data-driven"
@@ -4732,7 +4799,8 @@
4732
4799
  "interpolated": true,
4733
4800
  "parameters": [
4734
4801
  "zoom",
4735
- "feature"
4802
+ "feature",
4803
+ "feature-state"
4736
4804
  ]
4737
4805
  },
4738
4806
  "property-type": "data-driven"
@@ -4763,7 +4831,8 @@
4763
4831
  "interpolated": true,
4764
4832
  "parameters": [
4765
4833
  "zoom",
4766
- "feature"
4834
+ "feature",
4835
+ "feature-state"
4767
4836
  ]
4768
4837
  },
4769
4838
  "property-type": "data-driven"
@@ -4796,7 +4865,8 @@
4796
4865
  "interpolated": true,
4797
4866
  "parameters": [
4798
4867
  "zoom",
4799
- "feature"
4868
+ "feature",
4869
+ "feature-state"
4800
4870
  ]
4801
4871
  },
4802
4872
  "property-type": "data-driven"
@@ -4829,7 +4899,8 @@
4829
4899
  "interpolated": true,
4830
4900
  "parameters": [
4831
4901
  "zoom",
4832
- "feature"
4902
+ "feature",
4903
+ "feature-state"
4833
4904
  ]
4834
4905
  },
4835
4906
  "property-type": "data-driven"
@@ -1,6 +1,6 @@
1
1
  const Point = require('@mapbox/point-geometry');
2
2
 
3
- const { register } = require('../util/web_worker_transfer');
3
+ const { register } = require('../util/transfer_registry');
4
4
 
5
5
  class Anchor extends Point {
6
6
  constructor(x, y, angle, segment) {
@@ -39,6 +39,8 @@ class CollisionIndex {
39
39
 
40
40
  this.screenRightBoundary = transform.width + viewportPadding;
41
41
  this.screenBottomBoundary = transform.height + viewportPadding;
42
+ this.gridRightBoundary = transform.width + 2 * viewportPadding;
43
+ this.gridBottomBoundary = transform.height + 2 * viewportPadding;
42
44
  }
43
45
 
44
46
  placeCollisionBox(collisionBox, allowOverlap, textPixelRatio, posMatrix, collisionGroupPredicate) {
@@ -53,14 +55,16 @@ class CollisionIndex {
53
55
  const brX = collisionBox.x2 * tileToViewport + projectedPoint.point.x;
54
56
  const brY = collisionBox.y2 * tileToViewport + projectedPoint.point.y;
55
57
 
56
- if (!allowOverlap) {
57
- if (this.grid.hitTest(tlX, tlY, brX, brY, collisionGroupPredicate)) {
58
- return {
59
- box: [],
60
- offscreen: false
61
- };
62
- }
58
+ if (
59
+ !this.isInsideGrid(tlX, tlY, brX, brY) ||
60
+ (!allowOverlap && this.grid.hitTest(tlX, tlY, brX, brY, collisionGroupPredicate))
61
+ ) {
62
+ return {
63
+ box: [],
64
+ offscreen: false
65
+ };
63
66
  }
67
+
64
68
  return {
65
69
  box: [tlX, tlY, brX, brY],
66
70
  offscreen: this.isOffscreen(tlX, tlY, brX, brY)
@@ -135,6 +139,7 @@ class CollisionIndex {
135
139
  );
136
140
 
137
141
  let collisionDetected = false;
142
+ let inGrid = false;
138
143
  let entirelyOffscreen = true;
139
144
 
140
145
  const tileToViewport = projectedAnchor.perspectiveRatio * textPixelRatio;
@@ -211,14 +216,12 @@ class CollisionIndex {
211
216
  placedCollisionCircles.push(projectedPoint.x, projectedPoint.y, radius, collisionBoxArrayIndex);
212
217
  markCollisionCircleUsed(collisionCircles, k, true);
213
218
 
214
- entirelyOffscreen =
215
- entirelyOffscreen &&
216
- this.isOffscreen(
217
- projectedPoint.x - radius,
218
- projectedPoint.y - radius,
219
- projectedPoint.x + radius,
220
- projectedPoint.y + radius
221
- );
219
+ const x1 = projectedPoint.x - radius;
220
+ const y1 = projectedPoint.y - radius;
221
+ const x2 = projectedPoint.x + radius;
222
+ const y2 = projectedPoint.y + radius;
223
+ entirelyOffscreen = entirelyOffscreen && this.isOffscreen(x1, y1, x2, y2);
224
+ inGrid = inGrid || this.isInsideGrid(x1, y1, x2, y2);
222
225
 
223
226
  if (!allowOverlap) {
224
227
  if (this.grid.hitTestCircle(projectedPoint.x, projectedPoint.y, radius, collisionGroupPredicate)) {
@@ -236,7 +239,7 @@ class CollisionIndex {
236
239
  }
237
240
 
238
241
  return {
239
- circles: collisionDetected ? [] : placedCollisionCircles,
242
+ circles: collisionDetected || !inGrid ? [] : placedCollisionCircles,
240
243
  offscreen: entirelyOffscreen
241
244
  };
242
245
  }
@@ -370,6 +373,10 @@ class CollisionIndex {
370
373
  x2 < viewportPadding || x1 >= this.screenRightBoundary || y2 < viewportPadding || y1 > this.screenBottomBoundary
371
374
  );
372
375
  }
376
+
377
+ isInsideGrid(x1, y1, x2, y2) {
378
+ return x2 >= 0 && x1 < this.gridRightBoundary && y2 >= 0 && y1 < this.gridBottomBoundary;
379
+ }
373
380
  }
374
381
 
375
382
  function markCollisionCircleUsed(collisionCircles, index, used) {