maplibre-gl 2.0.1 → 2.0.5
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 +4 -4
- package/build/post-ts-build.js +1 -0
- package/build/release-notes.js +7 -32
- package/dist/maplibre-gl.d.ts +76 -192
- package/dist/maplibre-gl.js +4 -4
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +22 -27
- package/src/data/array_types.ts +21 -21
- package/src/data/bucket/circle_bucket.ts +1 -1
- package/src/data/bucket/fill_bucket.test.ts +2 -2
- package/src/data/bucket/fill_bucket.ts +1 -1
- package/src/data/bucket/fill_extrusion_bucket.ts +1 -1
- package/src/data/bucket/line_bucket.test.ts +2 -2
- package/src/data/bucket/line_bucket.ts +1 -1
- package/src/data/bucket/symbol_bucket.ts +1 -1
- package/src/data/bucket.ts +1 -1
- package/src/data/evaluation_feature.ts +1 -1
- package/src/data/feature_index.ts +3 -3
- package/src/data/load_geometry.ts +1 -1
- package/src/geo/edge_insets.ts +1 -1
- package/src/geo/transform.test.ts +1 -1
- package/src/geo/transform.ts +1 -1
- package/src/index.ts +1 -2
- package/src/render/draw_symbol.ts +1 -1
- package/src/source/geojson_source.test.ts +27 -0
- package/src/source/geojson_source.ts +1 -3
- package/src/source/geojson_wrapper.ts +1 -1
- package/src/source/image_source.test.ts +153 -0
- package/src/source/query_features.test.ts +1 -1
- package/src/source/query_features.ts +1 -1
- package/src/source/source.ts +2 -2
- package/src/source/source_cache.test.ts +3 -3
- package/src/source/source_cache.ts +1 -1
- package/src/source/tile.ts +1 -1
- package/src/source/tile_id.ts +1 -1
- package/src/source/vector_tile_worker_source.test.ts +306 -0
- package/src/source/worker_tile.test.ts +2 -1
- package/src/style/query_utils.ts +1 -1
- package/src/style/style.ts +1 -1
- package/src/style/style_layer/circle_style_layer.ts +1 -1
- package/src/style/style_layer/fill_extrusion_style_layer.ts +1 -1
- package/src/style/style_layer/fill_style_layer.ts +1 -1
- package/src/style/style_layer/line_style_layer.ts +1 -1
- package/src/style/style_layer.ts +13 -16
- package/src/style-spec/expression/index.ts +1 -1
- package/src/style-spec/feature_filter/feature_filter.test.ts +1 -1
- package/src/style-spec/migrate.test.ts +112 -0
- package/src/style-spec/style-spec.ts +0 -3
- package/src/style-spec/validate_spec.test.ts +29 -0
- package/src/symbol/anchor.ts +1 -1
- package/src/symbol/check_max_angle.test.ts +1 -1
- package/src/symbol/check_max_angle.ts +1 -1
- package/src/symbol/clip_line.test.ts +1 -1
- package/src/symbol/clip_line.ts +1 -1
- package/src/symbol/collision_feature.test.ts +1 -1
- package/src/symbol/collision_feature.ts +1 -1
- package/src/symbol/collision_index.ts +1 -1
- package/src/symbol/get_anchors.test.ts +1 -1
- package/src/symbol/get_anchors.ts +1 -1
- package/src/symbol/mergelines.test.ts +1 -1
- package/src/symbol/path_interpolator.test.ts +1 -1
- package/src/symbol/path_interpolator.ts +1 -1
- package/src/symbol/placement.ts +1 -1
- package/src/symbol/projection.ts +1 -1
- package/src/symbol/quads.ts +1 -1
- package/src/symbol/symbol_layout.ts +1 -1
- package/src/ui/camera.test.ts +0 -8
- package/src/ui/camera.ts +13 -3
- package/src/ui/control/navigation_control.ts +1 -1
- package/src/ui/events.ts +1 -1
- package/src/ui/handler/box_zoom.ts +1 -1
- package/src/ui/handler/click_zoom.ts +1 -1
- package/src/ui/handler/handler_util.ts +1 -1
- package/src/ui/handler/map_event.ts +1 -1
- package/src/ui/handler/mouse.ts +1 -1
- package/src/ui/handler/scroll_zoom.ts +1 -1
- package/src/ui/handler/tap_drag_zoom.ts +1 -1
- package/src/ui/handler/tap_recognizer.ts +1 -1
- package/src/ui/handler/tap_zoom.ts +1 -1
- package/src/ui/handler/touch_pan.ts +1 -1
- package/src/ui/handler/touch_zoom_rotate.ts +1 -1
- package/src/ui/handler_inertia.ts +1 -1
- package/src/ui/handler_manager.ts +1 -1
- package/src/ui/map.ts +4 -4
- package/src/ui/marker.test.ts +1 -1
- package/src/ui/marker.ts +2 -1
- package/src/ui/popup.test.ts +1 -1
- package/src/ui/popup.ts +2 -2
- package/src/util/ajax.test.ts +206 -0
- package/src/util/classify_rings.test.ts +1 -1
- package/src/util/classify_rings.ts +1 -1
- package/src/util/dom.ts +1 -1
- package/src/util/find_pole_of_inaccessibility.test.ts +1 -1
- package/src/util/find_pole_of_inaccessibility.ts +1 -1
- package/src/util/intersection_tests.ts +1 -1
- package/src/util/smart_wrap.ts +1 -1
- package/src/util/test/util.ts +14 -0
- package/src/util/transferable_grid_index.test.ts +56 -0
- package/src/util/transferable_grid_index.ts +216 -0
- package/src/util/util.test.ts +1 -1
- package/src/util/util.ts +1 -1
- package/src/util/web_worker_transfer.ts +1 -17
- package/CHANGELOG.md +0 -2578
- package/src/types/non-typed-modules.d.ts +0 -47
- package/src/util/point.ts +0 -349
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {isCounterClockwise} from './util';
|
|
2
2
|
|
|
3
|
-
import Point from '
|
|
3
|
+
import Point from '@mapbox/point-geometry';
|
|
4
4
|
|
|
5
5
|
export {polygonIntersectsBufferedPoint, polygonIntersectsMultiPolygon, polygonIntersectsBufferedMultiLine, polygonIntersectsPolygon, distToSegmentSquared, polygonIntersectsBox};
|
|
6
6
|
|
package/src/util/smart_wrap.ts
CHANGED
package/src/util/test/util.ts
CHANGED
|
@@ -99,3 +99,17 @@ export function getMockDispatcher() {
|
|
|
99
99
|
|
|
100
100
|
return mockDispatcher;
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
export function stubAjaxGetImage(createImageBitmap) {
|
|
104
|
+
global.createImageBitmap = createImageBitmap;
|
|
105
|
+
|
|
106
|
+
global.URL.revokeObjectURL = () => {};
|
|
107
|
+
global.URL.createObjectURL = (_) => { return null; };
|
|
108
|
+
|
|
109
|
+
// eslint-disable-next-line accessor-pairs
|
|
110
|
+
Object.defineProperty(global.Image.prototype, 'src', {
|
|
111
|
+
set(_) {
|
|
112
|
+
this.onload();
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import TransferableGridIndex from './transferable_grid_index';
|
|
2
|
+
|
|
3
|
+
describe('TransferableGridIndex', () => {
|
|
4
|
+
|
|
5
|
+
test('indexes features', () => {
|
|
6
|
+
const grid = new TransferableGridIndex(100, 4, 1);
|
|
7
|
+
grid.insert(0, 4, 10, 6, 30);
|
|
8
|
+
grid.insert(1, 4, 10, 30, 12);
|
|
9
|
+
grid.insert(2, -10, 30, -5, 35);
|
|
10
|
+
|
|
11
|
+
expect(grid.query(4, 10, 5, 11).sort()).toEqual([0, 1]);
|
|
12
|
+
expect(grid.query(24, 10, 25, 11).sort()).toEqual([1]);
|
|
13
|
+
expect(grid.query(40, 40, 100, 100)).toEqual([]);
|
|
14
|
+
expect(grid.query(-6, 0, -7, 100)).toEqual([2]);
|
|
15
|
+
expect(grid.query(-Infinity, -Infinity, Infinity, Infinity).sort()).toEqual([0, 1, 2]);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('returns multiple copies of a key if multiple boxes were inserted with the same key', () => {
|
|
19
|
+
const grid = new TransferableGridIndex(100, 4, 0);
|
|
20
|
+
const key = 123;
|
|
21
|
+
grid.insert(key, 3, 3, 4, 4);
|
|
22
|
+
grid.insert(key, 13, 13, 14, 14);
|
|
23
|
+
grid.insert(key, 23, 23, 24, 24);
|
|
24
|
+
expect(grid.query(0, 0, 30, 30)).toEqual([key, key, key]);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test('serializing to an arraybuffer', () => {
|
|
28
|
+
const originalGrid = new TransferableGridIndex(100, 4, 1);
|
|
29
|
+
originalGrid.insert(0, 4, 10, 6, 30);
|
|
30
|
+
originalGrid.insert(1, 4, 10, 30, 12);
|
|
31
|
+
originalGrid.insert(2, -10, 30, -5, 35);
|
|
32
|
+
|
|
33
|
+
const arrayBuffer = originalGrid.toArrayBuffer();
|
|
34
|
+
const grid = new TransferableGridIndex(arrayBuffer);
|
|
35
|
+
|
|
36
|
+
expect(grid.query(4, 10, 5, 11).sort()).toEqual([0, 1]);
|
|
37
|
+
expect(grid.query(24, 10, 25, 11).sort()).toEqual([1]);
|
|
38
|
+
expect(grid.query(40, 40, 100, 100)).toEqual([]);
|
|
39
|
+
expect(grid.query(-6, 0, -7, 100)).toEqual([2]);
|
|
40
|
+
expect(grid.query(-Infinity, -Infinity, Infinity, Infinity).sort()).toEqual([0, 1, 2]);
|
|
41
|
+
|
|
42
|
+
expect(() => grid.insert(3, 0, 0, 0, 0)).toThrow();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test('serialize round trip', () => {
|
|
46
|
+
const grid = new TransferableGridIndex(100, 4, 0);
|
|
47
|
+
const key = 123;
|
|
48
|
+
grid.insert(key, 3, 3, 4, 4);
|
|
49
|
+
grid.insert(key, 13, 13, 14, 14);
|
|
50
|
+
grid.insert(key, 23, 23, 24, 24);
|
|
51
|
+
const serializedGrid = TransferableGridIndex.serialize(grid);
|
|
52
|
+
const deserializedGrid = TransferableGridIndex.deserialize(serializedGrid);
|
|
53
|
+
expect(deserializedGrid.query(0, 0, 30, 30)).toEqual([key, key, key]);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
});
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/*
|
|
2
|
+
This file was copied from https://github.com/mapbox/grid-index and was
|
|
3
|
+
migrated from JavaScript to TypeScript.
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2016, Mapbox
|
|
6
|
+
|
|
7
|
+
Permission to use, copy, modify, and/or distribute this software for any purpose
|
|
8
|
+
with or without fee is hereby granted, provided that the above copyright notice
|
|
9
|
+
and this permission notice appear in all copies.
|
|
10
|
+
|
|
11
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
|
13
|
+
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
15
|
+
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
16
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|
17
|
+
THIS SOFTWARE.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const NUM_PARAMS = 3;
|
|
21
|
+
|
|
22
|
+
export type SerializedGrid = {
|
|
23
|
+
buffer: ArrayBuffer;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
class TransferableGridIndex {
|
|
27
|
+
cells: number[][];
|
|
28
|
+
arrayBuffer: ArrayBuffer;
|
|
29
|
+
d: number;
|
|
30
|
+
keys: number[];
|
|
31
|
+
bboxes: number[];
|
|
32
|
+
n: number;
|
|
33
|
+
extent: number;
|
|
34
|
+
padding: number;
|
|
35
|
+
scale: any;
|
|
36
|
+
uid: number;
|
|
37
|
+
min: number;
|
|
38
|
+
max: number;
|
|
39
|
+
|
|
40
|
+
constructor(extent: number | ArrayBuffer, n?: number, padding?: number) {
|
|
41
|
+
const cells = this.cells = [];
|
|
42
|
+
|
|
43
|
+
if (extent instanceof ArrayBuffer) {
|
|
44
|
+
this.arrayBuffer = extent;
|
|
45
|
+
const array = new Int32Array(this.arrayBuffer);
|
|
46
|
+
extent = array[0];
|
|
47
|
+
n = array[1];
|
|
48
|
+
padding = array[2];
|
|
49
|
+
|
|
50
|
+
this.d = n + 2 * padding;
|
|
51
|
+
for (let k = 0; k < this.d * this.d; k++) {
|
|
52
|
+
const start = array[NUM_PARAMS + k];
|
|
53
|
+
const end = array[NUM_PARAMS + k + 1];
|
|
54
|
+
cells.push(start === end ? null : array.subarray(start, end));
|
|
55
|
+
}
|
|
56
|
+
const keysOffset = array[NUM_PARAMS + cells.length];
|
|
57
|
+
const bboxesOffset = array[NUM_PARAMS + cells.length + 1];
|
|
58
|
+
this.keys = array.subarray(keysOffset, bboxesOffset) as any as number[];
|
|
59
|
+
this.bboxes = array.subarray(bboxesOffset) as any as number[];
|
|
60
|
+
|
|
61
|
+
this.insert = this._insertReadonly;
|
|
62
|
+
|
|
63
|
+
} else {
|
|
64
|
+
this.d = n + 2 * padding;
|
|
65
|
+
for (let i = 0; i < this.d * this.d; i++) {
|
|
66
|
+
cells.push([]);
|
|
67
|
+
}
|
|
68
|
+
this.keys = [];
|
|
69
|
+
this.bboxes = [];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
this.n = n;
|
|
73
|
+
this.extent = extent;
|
|
74
|
+
this.padding = padding;
|
|
75
|
+
this.scale = n / extent;
|
|
76
|
+
this.uid = 0;
|
|
77
|
+
|
|
78
|
+
const p = (padding / n) * extent;
|
|
79
|
+
this.min = -p;
|
|
80
|
+
this.max = extent + p;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
insert(key: number, x1: number, y1: number, x2: number, y2: number) {
|
|
84
|
+
this._forEachCell(x1, y1, x2, y2, this._insertCell, this.uid++, undefined, undefined);
|
|
85
|
+
this.keys.push(key);
|
|
86
|
+
this.bboxes.push(x1);
|
|
87
|
+
this.bboxes.push(y1);
|
|
88
|
+
this.bboxes.push(x2);
|
|
89
|
+
this.bboxes.push(y2);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_insertReadonly() {
|
|
93
|
+
throw new Error('Cannot insert into a GridIndex created from an ArrayBuffer.');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
_insertCell(x1: number, y1: number, x2: number, y2: number, cellIndex: number, uid: number) {
|
|
97
|
+
this.cells[cellIndex].push(uid);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
query(x1: number, y1: number, x2: number, y2: number, intersectionTest?: Function): number[] {
|
|
101
|
+
const min = this.min;
|
|
102
|
+
const max = this.max;
|
|
103
|
+
if (x1 <= min && y1 <= min && max <= x2 && max <= y2 && !intersectionTest) {
|
|
104
|
+
// We use `Array#slice` because `this.keys` may be a `Int32Array` and
|
|
105
|
+
// some browsers (Safari and IE) do not support `TypedArray#slice`
|
|
106
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice#Browser_compatibility
|
|
107
|
+
return Array.prototype.slice.call(this.keys);
|
|
108
|
+
|
|
109
|
+
} else {
|
|
110
|
+
const result = [];
|
|
111
|
+
const seenUids = {};
|
|
112
|
+
this._forEachCell(x1, y1, x2, y2, this._queryCell, result, seenUids, intersectionTest);
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
_queryCell(x1: number, y1: number, x2: number, y2:number, cellIndex:number, result, seenUids, intersectionTest: Function) {
|
|
118
|
+
const cell = this.cells[cellIndex];
|
|
119
|
+
if (cell !== null) {
|
|
120
|
+
const keys = this.keys;
|
|
121
|
+
const bboxes = this.bboxes;
|
|
122
|
+
for (let u = 0; u < cell.length; u++) {
|
|
123
|
+
const uid = cell[u];
|
|
124
|
+
if (seenUids[uid] === undefined) {
|
|
125
|
+
const offset = uid * 4;
|
|
126
|
+
if (intersectionTest ?
|
|
127
|
+
intersectionTest(bboxes[offset + 0], bboxes[offset + 1], bboxes[offset + 2], bboxes[offset + 3]) :
|
|
128
|
+
((x1 <= bboxes[offset + 2]) &&
|
|
129
|
+
(y1 <= bboxes[offset + 3]) &&
|
|
130
|
+
(x2 >= bboxes[offset + 0]) &&
|
|
131
|
+
(y2 >= bboxes[offset + 1]))) {
|
|
132
|
+
seenUids[uid] = true;
|
|
133
|
+
result.push(keys[uid]);
|
|
134
|
+
} else {
|
|
135
|
+
seenUids[uid] = false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
_forEachCell(x1: number, y1: number, x2:number, y2:number, fn: Function, arg1, arg2, intersectionTest) {
|
|
143
|
+
const cx1 = this._convertToCellCoord(x1);
|
|
144
|
+
const cy1 = this._convertToCellCoord(y1);
|
|
145
|
+
const cx2 = this._convertToCellCoord(x2);
|
|
146
|
+
const cy2 = this._convertToCellCoord(y2);
|
|
147
|
+
for (let x = cx1; x <= cx2; x++) {
|
|
148
|
+
for (let y = cy1; y <= cy2; y++) {
|
|
149
|
+
const cellIndex = this.d * y + x;
|
|
150
|
+
if (intersectionTest && !intersectionTest(
|
|
151
|
+
this._convertFromCellCoord(x),
|
|
152
|
+
this._convertFromCellCoord(y),
|
|
153
|
+
this._convertFromCellCoord(x + 1),
|
|
154
|
+
this._convertFromCellCoord(y + 1))) continue;
|
|
155
|
+
if (fn.call(this, x1, y1, x2, y2, cellIndex, arg1, arg2, intersectionTest)) return;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
_convertFromCellCoord (x) {
|
|
161
|
+
return (x - this.padding) / this.scale;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
_convertToCellCoord(x) {
|
|
165
|
+
return Math.max(0, Math.min(this.d - 1, Math.floor(x * this.scale) + this.padding));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
toArrayBuffer(): ArrayBuffer {
|
|
169
|
+
if (this.arrayBuffer) return this.arrayBuffer;
|
|
170
|
+
|
|
171
|
+
const cells = this.cells;
|
|
172
|
+
|
|
173
|
+
const metadataLength = NUM_PARAMS + this.cells.length + 1 + 1;
|
|
174
|
+
let totalCellLength = 0;
|
|
175
|
+
for (let i = 0; i < this.cells.length; i++) {
|
|
176
|
+
totalCellLength += this.cells[i].length;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const array = new Int32Array(metadataLength + totalCellLength + this.keys.length + this.bboxes.length);
|
|
180
|
+
array[0] = this.extent;
|
|
181
|
+
array[1] = this.n;
|
|
182
|
+
array[2] = this.padding;
|
|
183
|
+
|
|
184
|
+
let offset = metadataLength;
|
|
185
|
+
for (let k = 0; k < cells.length; k++) {
|
|
186
|
+
const cell = cells[k];
|
|
187
|
+
array[NUM_PARAMS + k] = offset;
|
|
188
|
+
array.set(cell, offset);
|
|
189
|
+
offset += cell.length;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
array[NUM_PARAMS + cells.length] = offset;
|
|
193
|
+
array.set(this.keys, offset);
|
|
194
|
+
offset += this.keys.length;
|
|
195
|
+
|
|
196
|
+
array[NUM_PARAMS + cells.length + 1] = offset;
|
|
197
|
+
array.set(this.bboxes, offset);
|
|
198
|
+
offset += this.bboxes.length;
|
|
199
|
+
|
|
200
|
+
return array.buffer;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
public static serialize(grid: TransferableGridIndex, transferables?: Array<Transferable>): SerializedGrid {
|
|
204
|
+
const buffer = grid.toArrayBuffer();
|
|
205
|
+
if (transferables) {
|
|
206
|
+
transferables.push(buffer);
|
|
207
|
+
}
|
|
208
|
+
return {buffer};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
public static deserialize(serialized: SerializedGrid): TransferableGridIndex {
|
|
212
|
+
return new TransferableGridIndex(serialized.buffer);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export default TransferableGridIndex;
|
package/src/util/util.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {easeCubicInOut, keysDifference, extend, pick, uniqueId, bindAll, asyncAll, clamp, wrap, bezier, mapObject, filterObject, deepEqual, clone, arraysIntersect, isCounterClockwise, isClosedPolygon, parseCacheControl, nextPowerOfTwo, isPowerOfTwo} from './util';
|
|
2
|
-
import Point from '
|
|
2
|
+
import Point from '@mapbox/point-geometry';
|
|
3
3
|
|
|
4
4
|
describe('util', () => {
|
|
5
5
|
expect(easeCubicInOut(0)).toBe(0);
|
package/src/util/util.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from 'assert';
|
|
2
2
|
|
|
3
|
-
import TransferableGridIndex from '
|
|
3
|
+
import TransferableGridIndex from './transferable_grid_index';
|
|
4
4
|
import Color from '../style-spec/util/color';
|
|
5
5
|
import {StylePropertyFunction, StyleExpression, ZoomDependentExpression, ZoomConstantExpression} from '../style-spec/expression';
|
|
6
6
|
import CompoundExpression from '../style-spec/expression/compound_expression';
|
|
@@ -63,22 +63,6 @@ export function register<T extends any>(
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
register('Object', Object);
|
|
66
|
-
|
|
67
|
-
type SerializedGrid = {
|
|
68
|
-
buffer: ArrayBuffer;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
TransferableGridIndex.serialize = function serialize(grid: TransferableGridIndex, transferables?: Array<Transferable>): SerializedGrid {
|
|
72
|
-
const buffer = grid.toArrayBuffer();
|
|
73
|
-
if (transferables) {
|
|
74
|
-
transferables.push(buffer);
|
|
75
|
-
}
|
|
76
|
-
return {buffer};
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
TransferableGridIndex.deserialize = function deserialize(serialized: SerializedGrid): TransferableGridIndex {
|
|
80
|
-
return new TransferableGridIndex(serialized.buffer);
|
|
81
|
-
};
|
|
82
66
|
register('TransferableGridIndex', TransferableGridIndex);
|
|
83
67
|
|
|
84
68
|
register('Color', Color);
|