maplibre-gl 2.2.0 → 2.3.1-pre.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/build/generate-struct-arrays.ts +0 -2
- package/build/generate-style-spec.ts +2 -3
- package/build/generate-typings.ts +12 -2
- package/build/rollup_plugins.ts +0 -4
- package/dist/maplibre-gl-csp-worker.js +1 -1
- package/dist/maplibre-gl-csp.js +1 -1
- package/dist/maplibre-gl-dev.js +368 -1404
- package/dist/maplibre-gl.d.ts +19 -11
- package/dist/maplibre-gl.js +4 -4
- package/dist/style-spec/index.d.ts +1779 -0
- package/package.json +10 -12
- package/src/data/array_types.g.ts +0 -5
- package/src/data/bucket/fill_bucket.ts +0 -2
- package/src/data/bucket/fill_extrusion_bucket.ts +0 -2
- package/src/data/bucket/symbol_bucket.test.ts +30 -19
- package/src/data/feature_position_map.ts +1 -2
- package/src/gl/framebuffer.ts +3 -2
- package/src/gl/index_buffer.ts +1 -2
- package/src/gl/vertex_buffer.ts +1 -2
- package/src/index.test.ts +9 -0
- package/src/index.ts +12 -4
- package/src/render/image_manager.ts +5 -7
- package/src/render/program/pattern.ts +0 -2
- package/src/render/program.ts +0 -4
- package/src/render/vertex_array_object.ts +1 -3
- package/src/source/geojson_worker_source.ts +0 -4
- package/src/source/query_features.ts +0 -3
- package/src/source/rtl_text_plugin.ts +3 -4
- package/src/source/source_cache.ts +0 -2
- package/src/source/tile_id.ts +8 -8
- package/src/source/worker.ts +2 -11
- package/src/source/worker_tile.ts +12 -3
- package/src/style/format_section_override.ts +1 -2
- package/src/style/properties.ts +1 -3
- package/src/style/style.ts +5 -5
- package/src/style/style_layer/custom_style_layer.ts +1 -2
- package/src/style/style_layer/symbol_style_layer.ts +1 -3
- package/src/style-spec/CHANGELOG.md +10 -0
- package/src/style-spec/composite.test.ts +7 -8
- package/src/style-spec/expression/compound_expression.ts +0 -4
- package/src/style-spec/expression/definitions/assertion.ts +2 -4
- package/src/style-spec/expression/definitions/case.ts +1 -2
- package/src/style-spec/expression/definitions/coalesce.ts +1 -3
- package/src/style-spec/expression/definitions/coercion.ts +2 -4
- package/src/style-spec/expression/definitions/match.ts +0 -3
- package/src/style-spec/expression/index.ts +13 -15
- package/src/style-spec/expression/parsing_context.ts +4 -4
- package/src/style-spec/expression/parsing_error.ts +2 -2
- package/src/style-spec/expression/values.ts +0 -2
- package/src/style-spec/feature_filter/feature_filter.test.ts +7 -0
- package/src/style-spec/function/convert.ts +1 -3
- package/src/style-spec/migrate/v8.test.ts +12 -14
- package/src/style-spec/migrate/v9.test.ts +2 -4
- package/src/style-spec/migrate.test.ts +6 -8
- package/src/style-spec/package.json +2 -1
- package/src/style-spec/reference/latest.ts +1 -1
- package/src/style-spec/style-spec.ts +11 -10
- package/src/style-spec/types.g.ts +2 -3
- package/src/symbol/collision_index.ts +0 -3
- package/src/symbol/path_interpolator.ts +0 -2
- package/src/symbol/placement.ts +14 -9
- package/src/symbol/shaping.ts +0 -4
- package/src/symbol/symbol_layout.ts +56 -56
- package/src/ui/camera.ts +0 -10
- package/src/ui/control/geolocate_control.ts +4 -6
- package/src/ui/handler/handler_util.ts +1 -2
- package/src/ui/handler/scroll_zoom.ts +0 -2
- package/src/ui/handler_manager.ts +0 -2
- package/src/ui/map.test.ts +11 -0
- package/src/ui/map.ts +11 -0
- package/src/util/ajax.ts +1 -2
- package/src/util/color_ramp.ts +1 -2
- package/src/util/dictionary_coder.ts +1 -3
- package/src/util/dispatcher.ts +1 -4
- package/src/util/dom.ts +0 -3
- package/src/util/image.ts +1 -3
- package/src/util/struct_array.ts +0 -5
- package/src/util/task_queue.ts +1 -3
- package/src/util/util.ts +2 -3
- package/src/util/web_worker_transfer.ts +5 -6
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
|
|
3
1
|
import migrate from './v8';
|
|
4
2
|
|
|
5
3
|
describe('migrate v8', () => {
|
|
@@ -23,7 +21,7 @@ describe('migrate v8', () => {
|
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
23
|
]
|
|
26
|
-
};
|
|
24
|
+
} as any;
|
|
27
25
|
|
|
28
26
|
const output = {
|
|
29
27
|
'version': 8,
|
|
@@ -68,7 +66,7 @@ describe('migrate v8', () => {
|
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
68
|
]
|
|
71
|
-
};
|
|
69
|
+
} as any;
|
|
72
70
|
|
|
73
71
|
const output = {
|
|
74
72
|
'version': 8,
|
|
@@ -103,7 +101,7 @@ describe('migrate v8', () => {
|
|
|
103
101
|
}
|
|
104
102
|
},
|
|
105
103
|
'layers': []
|
|
106
|
-
};
|
|
104
|
+
} as any;
|
|
107
105
|
|
|
108
106
|
const output = {
|
|
109
107
|
'version': 8,
|
|
@@ -140,7 +138,7 @@ describe('migrate v8', () => {
|
|
|
140
138
|
}
|
|
141
139
|
}
|
|
142
140
|
}]
|
|
143
|
-
};
|
|
141
|
+
} as any;
|
|
144
142
|
|
|
145
143
|
const output = {
|
|
146
144
|
'version': 8,
|
|
@@ -187,7 +185,7 @@ describe('migrate v8', () => {
|
|
|
187
185
|
}
|
|
188
186
|
}
|
|
189
187
|
}]
|
|
190
|
-
};
|
|
188
|
+
} as any;
|
|
191
189
|
|
|
192
190
|
const output = {
|
|
193
191
|
'version': 8,
|
|
@@ -233,7 +231,7 @@ describe('migrate v8', () => {
|
|
|
233
231
|
}
|
|
234
232
|
}
|
|
235
233
|
]
|
|
236
|
-
};
|
|
234
|
+
} as any;
|
|
237
235
|
|
|
238
236
|
const output = {
|
|
239
237
|
'version': 8,
|
|
@@ -276,7 +274,7 @@ describe('migrate v8', () => {
|
|
|
276
274
|
}
|
|
277
275
|
}
|
|
278
276
|
]
|
|
279
|
-
};
|
|
277
|
+
} as any;
|
|
280
278
|
|
|
281
279
|
const output = {
|
|
282
280
|
'version': 8,
|
|
@@ -328,7 +326,7 @@ describe('migrate v8', () => {
|
|
|
328
326
|
}
|
|
329
327
|
}
|
|
330
328
|
]
|
|
331
|
-
};
|
|
329
|
+
} as any;
|
|
332
330
|
|
|
333
331
|
const output = {
|
|
334
332
|
'version': 8,
|
|
@@ -389,7 +387,7 @@ describe('migrate v8', () => {
|
|
|
389
387
|
}
|
|
390
388
|
}
|
|
391
389
|
]
|
|
392
|
-
};
|
|
390
|
+
} as any;
|
|
393
391
|
|
|
394
392
|
const output = {
|
|
395
393
|
'version': 8,
|
|
@@ -445,7 +443,7 @@ describe('migrate v8', () => {
|
|
|
445
443
|
}
|
|
446
444
|
}
|
|
447
445
|
]
|
|
448
|
-
};
|
|
446
|
+
} as any;
|
|
449
447
|
|
|
450
448
|
const output = {
|
|
451
449
|
'version': 8,
|
|
@@ -479,7 +477,7 @@ describe('migrate v8', () => {
|
|
|
479
477
|
'version': 7,
|
|
480
478
|
'glyphs': 'mapbox://fontstack/{fontstack}/{range}.pbf',
|
|
481
479
|
'layers': []
|
|
482
|
-
};
|
|
480
|
+
} as any;
|
|
483
481
|
|
|
484
482
|
const output = {
|
|
485
483
|
'version': 8,
|
|
@@ -495,7 +493,7 @@ describe('migrate v8', () => {
|
|
|
495
493
|
'version': 7,
|
|
496
494
|
'glyphs': 'mapbox://fonts/v1/boxmap/{fontstack}/{range}.pbf',
|
|
497
495
|
'layers': []
|
|
498
|
-
};
|
|
496
|
+
} as any;
|
|
499
497
|
|
|
500
498
|
const output = {
|
|
501
499
|
'version': 8,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
|
|
3
1
|
import migrate from './v9';
|
|
4
2
|
|
|
5
3
|
describe('migrate v9', () => {
|
|
@@ -18,7 +16,7 @@ describe('migrate v9', () => {
|
|
|
18
16
|
id: 'child',
|
|
19
17
|
ref: 'parent'
|
|
20
18
|
}]
|
|
21
|
-
};
|
|
19
|
+
} as any;
|
|
22
20
|
|
|
23
21
|
expect(migrate(input)).toEqual({
|
|
24
22
|
version: 9,
|
|
@@ -58,7 +56,7 @@ describe('migrate v9', () => {
|
|
|
58
56
|
'fill-color': 'blue'
|
|
59
57
|
}
|
|
60
58
|
}]
|
|
61
|
-
};
|
|
59
|
+
} as any;
|
|
62
60
|
|
|
63
61
|
expect(migrate(input)).toEqual({
|
|
64
62
|
version: 9,
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
|
|
3
1
|
import migrate from './migrate';
|
|
4
2
|
import * as spec from './style-spec';
|
|
5
3
|
import v8 from './reference/v8.json';
|
|
@@ -8,18 +6,18 @@ import validate from './validate_style';
|
|
|
8
6
|
describe('migrate', () => {
|
|
9
7
|
test('does not migrate from version 5', () => {
|
|
10
8
|
expect(() => {
|
|
11
|
-
migrate({version: 5, layers: []});
|
|
9
|
+
migrate({version: 5, layers: []} as any);
|
|
12
10
|
}).toThrow(new Error('Cannot migrate from 5'));
|
|
13
11
|
});
|
|
14
12
|
|
|
15
13
|
test('does not migrate from version 6', () => {
|
|
16
14
|
expect(() => {
|
|
17
|
-
migrate({version: 6, layers: []});
|
|
15
|
+
migrate({version: 6, layers: []} as any);
|
|
18
16
|
}).toThrow(new Error('Cannot migrate from 6'));
|
|
19
17
|
});
|
|
20
18
|
|
|
21
19
|
test('migrates to latest version from version 7', () => {
|
|
22
|
-
expect(migrate({version: 7, layers: []}).version).toEqual(spec.latest.$version);
|
|
20
|
+
expect(migrate({version: 7, layers: []} as any).version).toEqual(spec.latest.$version);
|
|
23
21
|
});
|
|
24
22
|
|
|
25
23
|
test('converts token strings to expressions', () => {
|
|
@@ -30,7 +28,7 @@ describe('migrate', () => {
|
|
|
30
28
|
type: 'symbol',
|
|
31
29
|
layout: {'text-field': 'a{x}', 'icon-image': '{y}'}
|
|
32
30
|
}]
|
|
33
|
-
});
|
|
31
|
+
} as any);
|
|
34
32
|
expect(migrated.layers[0].layout['text-field']).toEqual(['concat', 'a', ['get', 'x']]);
|
|
35
33
|
expect(migrated.layers[0].layout['icon-image']).toEqual(['to-string', ['get', 'y']]);
|
|
36
34
|
});
|
|
@@ -57,7 +55,7 @@ describe('migrate', () => {
|
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
57
|
}]
|
|
60
|
-
});
|
|
58
|
+
} as any);
|
|
61
59
|
expect(migrated.layers[0].paint['background-opacity']).toEqual([
|
|
62
60
|
'interpolate',
|
|
63
61
|
['linear'],
|
|
@@ -101,7 +99,7 @@ describe('migrate', () => {
|
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
}]
|
|
104
|
-
});
|
|
102
|
+
} as any);
|
|
105
103
|
expect(migrated.layers[0].layout['icon-image']).toEqual([
|
|
106
104
|
'match',
|
|
107
105
|
['get', 'type'],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maplibre/maplibre-gl-style-spec",
|
|
3
3
|
"description": "a specification for maplibre gl styles",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "17.0.1",
|
|
5
5
|
"author": "MapLibre",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mapbox",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"main": "./dist/index.cjs",
|
|
16
16
|
"module": "./dist/index.mjs",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
17
18
|
"type": "module",
|
|
18
19
|
"scripts": {
|
|
19
20
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type ExpressionType = 'data-driven' | 'cross-faded' | 'cross-faded-data-driven' | 'color-ramp' | 'data-constant' | 'constant';
|
|
2
2
|
type ExpressionParameters = Array<'zoom' | 'feature' | 'feature-state' | 'heatmap-density' | 'line-progress'>;
|
|
3
3
|
|
|
4
|
-
type
|
|
4
|
+
type ExpressionSpecificationDefinition = {
|
|
5
5
|
interpolated: boolean;
|
|
6
6
|
parameters: ExpressionParameters;
|
|
7
7
|
};
|
|
@@ -9,33 +9,33 @@ type ExpressionSpecification = {
|
|
|
9
9
|
export type StylePropertySpecification = {
|
|
10
10
|
type: 'number';
|
|
11
11
|
'property-type': ExpressionType;
|
|
12
|
-
expression?:
|
|
12
|
+
expression?: ExpressionSpecificationDefinition;
|
|
13
13
|
transition: boolean;
|
|
14
14
|
default?: number;
|
|
15
15
|
} | {
|
|
16
16
|
type: 'string';
|
|
17
17
|
'property-type': ExpressionType;
|
|
18
|
-
expression?:
|
|
18
|
+
expression?: ExpressionSpecificationDefinition;
|
|
19
19
|
transition: boolean;
|
|
20
20
|
default?: string;
|
|
21
21
|
tokens?: boolean;
|
|
22
22
|
} | {
|
|
23
23
|
type: 'boolean';
|
|
24
24
|
'property-type': ExpressionType;
|
|
25
|
-
expression?:
|
|
25
|
+
expression?: ExpressionSpecificationDefinition;
|
|
26
26
|
transition: boolean;
|
|
27
27
|
default?: boolean;
|
|
28
28
|
} | {
|
|
29
29
|
type: 'enum';
|
|
30
30
|
'property-type': ExpressionType;
|
|
31
|
-
expression?:
|
|
31
|
+
expression?: ExpressionSpecificationDefinition;
|
|
32
32
|
values: {[_: string]: {}};
|
|
33
33
|
transition: boolean;
|
|
34
34
|
default?: string;
|
|
35
35
|
} | {
|
|
36
36
|
type: 'color';
|
|
37
37
|
'property-type': ExpressionType;
|
|
38
|
-
expression?:
|
|
38
|
+
expression?: ExpressionSpecificationDefinition;
|
|
39
39
|
transition: boolean;
|
|
40
40
|
default?: string;
|
|
41
41
|
overridable: boolean;
|
|
@@ -43,7 +43,7 @@ export type StylePropertySpecification = {
|
|
|
43
43
|
type: 'array';
|
|
44
44
|
value: 'number';
|
|
45
45
|
'property-type': ExpressionType;
|
|
46
|
-
expression?:
|
|
46
|
+
expression?: ExpressionSpecificationDefinition;
|
|
47
47
|
length?: number;
|
|
48
48
|
transition: boolean;
|
|
49
49
|
default?: Array<number>;
|
|
@@ -51,19 +51,20 @@ export type StylePropertySpecification = {
|
|
|
51
51
|
type: 'array';
|
|
52
52
|
value: 'string';
|
|
53
53
|
'property-type': ExpressionType;
|
|
54
|
-
expression?:
|
|
54
|
+
expression?: ExpressionSpecificationDefinition;
|
|
55
55
|
length?: number;
|
|
56
56
|
transition: boolean;
|
|
57
57
|
default?: Array<string>;
|
|
58
58
|
} | {
|
|
59
59
|
type: 'padding';
|
|
60
60
|
'property-type': ExpressionType;
|
|
61
|
-
expression?:
|
|
61
|
+
expression?: ExpressionSpecificationDefinition;
|
|
62
62
|
transition: boolean;
|
|
63
63
|
default?: number | Array<number>;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
import
|
|
66
|
+
import v8Spec from './reference/v8.json' assert {type: 'json'};
|
|
67
|
+
const v8 = v8Spec as any;
|
|
67
68
|
import latest from './reference/latest';
|
|
68
69
|
import format from './format';
|
|
69
70
|
import migrate from './migrate';
|
|
@@ -24,7 +24,7 @@ export type InterpolationSpecification =
|
|
|
24
24
|
| ['linear']
|
|
25
25
|
| ['exponential', number | ExpressionSpecification]
|
|
26
26
|
| ['cubic-bezier', number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification]
|
|
27
|
-
|
|
27
|
+
|
|
28
28
|
export type ExpressionSpecification =
|
|
29
29
|
// types
|
|
30
30
|
| ['array', unknown | ExpressionSpecification] // array
|
|
@@ -79,8 +79,7 @@ export type ExpressionSpecification =
|
|
|
79
79
|
| ['within', unknown | ExpressionSpecification]
|
|
80
80
|
// Ramps, scales, curves
|
|
81
81
|
| ['interpolate', InterpolationSpecification,
|
|
82
|
-
number | ExpressionSpecification, number |
|
|
83
|
-
...(number | ExpressionInputType | ExpressionSpecification)[]]
|
|
82
|
+
number | ExpressionSpecification, ...(number | ExpressionInputType | ExpressionSpecification)[]]
|
|
84
83
|
| ['interpolate-hcl', InterpolationSpecification,
|
|
85
84
|
number | ExpressionSpecification, number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
|
|
86
85
|
...(number | ColorSpecification | ExpressionSpecification)[]]
|
|
@@ -6,7 +6,6 @@ import * as intersectionTests from '../util/intersection_tests';
|
|
|
6
6
|
import GridIndex from './grid_index';
|
|
7
7
|
import {mat4, vec4} from 'gl-matrix';
|
|
8
8
|
import ONE_EM from '../symbol/one_em';
|
|
9
|
-
import assert from 'assert';
|
|
10
9
|
|
|
11
10
|
import * as projection from '../symbol/projection';
|
|
12
11
|
|
|
@@ -181,7 +180,6 @@ class CollisionIndex {
|
|
|
181
180
|
for (let i = 1; i < last.path.length; i++) {
|
|
182
181
|
projectedPath.push(last.path[i]);
|
|
183
182
|
}
|
|
184
|
-
assert(projectedPath.length >= 2);
|
|
185
183
|
|
|
186
184
|
// Tolerate a slightly longer distance than one diameter between two adjacent circles
|
|
187
185
|
const circleDist = radius * 2.5;
|
|
@@ -229,7 +227,6 @@ class CollisionIndex {
|
|
|
229
227
|
|
|
230
228
|
for (const seg of segments) {
|
|
231
229
|
// interpolate positions for collision circles. Add a small padding to both ends of the segment
|
|
232
|
-
assert(seg.length > 0);
|
|
233
230
|
interpolator.reset(seg, radius * 0.25);
|
|
234
231
|
|
|
235
232
|
let numCircles = 0;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {clamp} from '../util/util';
|
|
2
2
|
import Point from '@mapbox/point-geometry';
|
|
3
|
-
import assert from 'assert';
|
|
4
3
|
|
|
5
4
|
class PathInterpolator {
|
|
6
5
|
points: Array<Point>;
|
|
@@ -30,7 +29,6 @@ class PathInterpolator {
|
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
lerp(t: number): Point {
|
|
33
|
-
assert(this.points.length > 0);
|
|
34
32
|
if (this.points.length === 1) {
|
|
35
33
|
return this.points[0];
|
|
36
34
|
}
|
package/src/symbol/placement.ts
CHANGED
|
@@ -6,7 +6,6 @@ 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 assert from 'assert';
|
|
10
9
|
import pixelsToTileUnits from '../source/pixels_to_tile_units';
|
|
11
10
|
import Point from '@mapbox/point-geometry';
|
|
12
11
|
import type Transform from '../geo/transform';
|
|
@@ -23,6 +22,7 @@ import type FeatureIndex from '../data/feature_index';
|
|
|
23
22
|
import type {OverscaledTileID} from '../source/tile_id';
|
|
24
23
|
import type {TextAnchor} from './symbol_layout';
|
|
25
24
|
import Terrain from '../render/terrain';
|
|
25
|
+
import {warnOnce} from '../util/util';
|
|
26
26
|
|
|
27
27
|
class OpacityState {
|
|
28
28
|
opacity: number;
|
|
@@ -391,7 +391,7 @@ export class Placement {
|
|
|
391
391
|
this.prevPlacement.placements[symbolInstance.crossTileID].text) {
|
|
392
392
|
prevAnchor = this.prevPlacement.variableOffsets[symbolInstance.crossTileID].anchor;
|
|
393
393
|
}
|
|
394
|
-
|
|
394
|
+
if (symbolInstance.crossTileID === 0) throw new Error('symbolInstance.crossTileID can\'t be 0');
|
|
395
395
|
this.variableOffsets[symbolInstance.crossTileID] = {
|
|
396
396
|
textOffset,
|
|
397
397
|
width,
|
|
@@ -676,7 +676,10 @@ export class Placement {
|
|
|
676
676
|
getElevation
|
|
677
677
|
);
|
|
678
678
|
|
|
679
|
-
|
|
679
|
+
if (placedGlyphCircles.circles.length && placedGlyphCircles.collisionDetected && !showCollisionBoxes) {
|
|
680
|
+
warnOnce('Collisions detected, but collision boxes are not shown');
|
|
681
|
+
}
|
|
682
|
+
|
|
680
683
|
// If text-overlap is set to 'always', force "placedCircles" to true
|
|
681
684
|
// In theory there should always be at least one circle placed
|
|
682
685
|
// in this case, but for now quirks in text-anchor
|
|
@@ -781,15 +784,15 @@ export class Placement {
|
|
|
781
784
|
}
|
|
782
785
|
}
|
|
783
786
|
|
|
784
|
-
|
|
785
|
-
|
|
787
|
+
if (symbolInstance.crossTileID === 0) throw new Error('symbolInstance.crossTileID can\'t be 0');
|
|
788
|
+
if (bucket.bucketInstanceId === 0) throw new Error('bucket.bucketInstanceId can\'t be 0');
|
|
786
789
|
|
|
787
790
|
this.placements[symbolInstance.crossTileID] = new JointPlacement(placeText || alwaysShowText, placeIcon || alwaysShowIcon, offscreen || bucket.justReloaded);
|
|
788
791
|
seenCrossTileIDs[symbolInstance.crossTileID] = true;
|
|
789
792
|
};
|
|
790
793
|
|
|
791
794
|
if (zOrderByViewportY) {
|
|
792
|
-
|
|
795
|
+
if (bucketPart.symbolInstanceStart !== 0) throw new Error('bucket.bucketInstanceId should be 0');
|
|
793
796
|
const symbolIndexes = bucket.getSortedSymbolIndexes(this.transform.angle);
|
|
794
797
|
for (let i = symbolIndexes.length - 1; i >= 0; --i) {
|
|
795
798
|
const symbolIndex = symbolIndexes[i];
|
|
@@ -920,7 +923,9 @@ export class Placement {
|
|
|
920
923
|
// this.lastPlacementChangeTime is the time of the last commit() that
|
|
921
924
|
// resulted in a placement change -- in other words, the start time of
|
|
922
925
|
// the last symbol fade animation
|
|
923
|
-
|
|
926
|
+
if (prevPlacement && prevPlacement.lastPlacementChangeTime === undefined) {
|
|
927
|
+
throw new Error('Last placement time for previous placement is not defined');
|
|
928
|
+
}
|
|
924
929
|
if (placementChanged) {
|
|
925
930
|
this.lastPlacementChangeTime = now;
|
|
926
931
|
} else if (typeof this.lastPlacementChangeTime !== 'number') {
|
|
@@ -1133,8 +1138,8 @@ export class Placement {
|
|
|
1133
1138
|
bucket.textCollisionBox.collisionVertexBuffer.updateData(bucket.textCollisionBox.collisionVertexArray);
|
|
1134
1139
|
}
|
|
1135
1140
|
|
|
1136
|
-
|
|
1137
|
-
|
|
1141
|
+
if (bucket.text.opacityVertexArray.length !== bucket.text.layoutVertexArray.length / 4) throw new Error(`bucket.text.opacityVertexArray.length (= ${bucket.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${bucket.text.layoutVertexArray.length}) / 4`);
|
|
1142
|
+
if (bucket.icon.opacityVertexArray.length !== bucket.icon.layoutVertexArray.length / 4) throw new Error(`bucket.icon.opacityVertexArray.length (= ${bucket.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${bucket.icon.layoutVertexArray.length}) / 4`);
|
|
1138
1143
|
|
|
1139
1144
|
// Push generated collision circles to the bucket for debug rendering
|
|
1140
1145
|
if (bucket.bucketInstanceId in this.collisionCircleArrays) {
|
package/src/symbol/shaping.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import assert from 'assert';
|
|
2
1
|
import {
|
|
3
2
|
charHasUprightVerticalOrientation,
|
|
4
3
|
charAllowsIdeographicBreaking,
|
|
@@ -811,9 +810,6 @@ function fitIconToText(
|
|
|
811
810
|
iconOffset: [number, number],
|
|
812
811
|
fontScale: number
|
|
813
812
|
): PositionedIcon {
|
|
814
|
-
assert(textFit !== 'none');
|
|
815
|
-
assert(Array.isArray(padding) && padding.length === 4);
|
|
816
|
-
assert(Array.isArray(iconOffset) && iconOffset.length === 2);
|
|
817
813
|
|
|
818
814
|
const image = shapedIcon.image;
|
|
819
815
|
|