maplibre-gl 3.2.1 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/generate-struct-arrays.ts +3 -2
- package/dist/maplibre-gl-csp-worker.js +1 -1
- package/dist/maplibre-gl-csp-worker.js.map +1 -1
- package/dist/maplibre-gl-csp.js +1 -1
- package/dist/maplibre-gl-csp.js.map +1 -1
- package/dist/maplibre-gl-dev.js +150 -84
- package/dist/maplibre-gl-dev.js.map +1 -1
- package/dist/maplibre-gl.d.ts +67 -50
- package/dist/maplibre-gl.js +4 -4
- package/dist/maplibre-gl.js.map +1 -1
- package/package.json +18 -18
- package/src/data/array_types.g.ts +32 -10
- package/src/data/bucket/circle_bucket.ts +1 -0
- package/src/data/bucket/line_bucket.ts +1 -0
- package/src/data/bucket/symbol_bucket.ts +1 -0
- package/src/data/feature_index.ts +1 -0
- package/src/data/program_configuration.ts +1 -0
- package/src/data/segment.ts +2 -0
- package/src/geo/transform.ts +1 -0
- package/src/gl/context.ts +1 -0
- package/src/gl/framebuffer.ts +1 -0
- package/src/gl/index_buffer.ts +1 -0
- package/src/gl/render_pool.ts +2 -1
- package/src/gl/vertex_buffer.ts +1 -0
- package/src/render/image_atlas.ts +1 -0
- package/src/render/line_atlas.ts +1 -0
- package/src/render/painter.ts +1 -0
- package/src/render/program.ts +1 -0
- package/src/render/render_to_texture.ts +31 -14
- package/src/render/terrain.ts +3 -0
- package/src/render/texture.ts +1 -0
- package/src/render/uniform_binding.ts +2 -0
- package/src/render/vertex_array_object.ts +1 -0
- package/src/shaders/symbol_sdf.fragment.glsl +9 -3
- package/src/shaders/symbol_sdf.fragment.glsl.g.ts +1 -1
- package/src/source/canvas_source.ts +1 -3
- package/src/source/geojson_source.ts +1 -3
- package/src/source/image_source.ts +2 -4
- package/src/source/source_cache.ts +1 -0
- package/src/source/source_state.ts +1 -0
- package/src/source/terrain_source_cache.ts +1 -0
- package/src/source/tile.ts +1 -0
- package/src/source/tile_cache.ts +1 -1
- package/src/source/tile_id.ts +1 -0
- package/src/source/vector_tile_worker_source.test.ts +79 -0
- package/src/source/vector_tile_worker_source.ts +26 -1
- package/src/source/worker_source.ts +1 -0
- package/src/style/evaluation_parameters.ts +1 -0
- package/src/style/properties.ts +14 -0
- package/src/style/style.ts +1 -0
- package/src/style/style_glyph.ts +1 -0
- package/src/symbol/collision_index.ts +1 -0
- package/src/symbol/grid_index.ts +1 -0
- package/src/ui/camera.ts +8 -8
- package/src/ui/handler/box_zoom.ts +1 -3
- package/src/ui/handler/click_zoom.ts +1 -3
- package/src/ui/handler/keyboard.ts +1 -3
- package/src/ui/handler/scroll_zoom.ts +1 -3
- package/src/ui/handler/shim/dblclick_zoom.ts +1 -3
- package/src/ui/handler/shim/drag_pan.ts +1 -3
- package/src/ui/handler/shim/drag_rotate.ts +1 -3
- package/src/ui/handler/shim/two_fingers_touch.ts +1 -3
- package/src/ui/handler/transform-provider.ts +1 -0
- package/src/ui/handler/two_fingers_touch.ts +1 -3
- package/src/ui/map.ts +7 -6
- package/src/util/ajax.test.ts +33 -0
- package/src/util/ajax.ts +5 -0
- package/src/util/image.ts +1 -0
- package/src/util/image_request.ts +2 -2
- package/src/util/performance.ts +1 -2
- package/src/util/struct_array.ts +5 -1
- package/src/util/test/mock_fetch.ts +51 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// This file is generated. Edit build/generate-shaders.ts, then run `npm run codegen`.
|
|
2
|
-
export default '#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float
|
|
2
|
+
export default '#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}';
|
|
@@ -81,9 +81,7 @@ export class CanvasSource extends ImageSource {
|
|
|
81
81
|
pause: () => void;
|
|
82
82
|
_playing: boolean;
|
|
83
83
|
|
|
84
|
-
/**
|
|
85
|
-
* @hidden
|
|
86
|
-
*/
|
|
84
|
+
/** @internal */
|
|
87
85
|
constructor(id: string, options: CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {
|
|
88
86
|
super(id, options, dispatcher, eventedParent);
|
|
89
87
|
|
|
@@ -138,9 +138,7 @@ export class GeoJSONSource extends Evented implements Source {
|
|
|
138
138
|
_collectResourceTiming: boolean;
|
|
139
139
|
_removed: boolean;
|
|
140
140
|
|
|
141
|
-
/**
|
|
142
|
-
* @hidden
|
|
143
|
-
*/
|
|
141
|
+
/** @internal */
|
|
144
142
|
constructor(id: string, options: GeoJSONSourceOptions, dispatcher: Dispatcher, eventedParent: Evented) {
|
|
145
143
|
super();
|
|
146
144
|
|
|
@@ -109,9 +109,7 @@ export class ImageSource extends Evented implements Source {
|
|
|
109
109
|
_loaded: boolean;
|
|
110
110
|
_request: Cancelable;
|
|
111
111
|
|
|
112
|
-
/**
|
|
113
|
-
* @hidden
|
|
114
|
-
*/
|
|
112
|
+
/** @internal */
|
|
115
113
|
constructor(id: string, options: ImageSourceSpecification | VideoSourceSpecification | CanvasSourceSpecification, dispatcher: Dispatcher, eventedParent: Evented) {
|
|
116
114
|
super();
|
|
117
115
|
this.id = id;
|
|
@@ -317,7 +315,7 @@ export class ImageSource extends Evented implements Source {
|
|
|
317
315
|
* Given a list of coordinates, get their center as a coordinate.
|
|
318
316
|
*
|
|
319
317
|
* @returns centerpoint
|
|
320
|
-
* @
|
|
318
|
+
* @internal
|
|
321
319
|
*/
|
|
322
320
|
export function getCoordinatesCenterTileID(coords: Array<MercatorCoordinate>) {
|
|
323
321
|
let minX = Infinity;
|
|
@@ -6,6 +6,7 @@ export type FeatureStates = {[featureId: string]: FeatureState};
|
|
|
6
6
|
export type LayerFeatureStates = {[layer: string]: FeatureStates};
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
+
* @internal
|
|
9
10
|
* SourceFeatureState manages the state and pending changes
|
|
10
11
|
* to features in a source, separated by source layer.
|
|
11
12
|
* stateChanges and deletedStates batch all changes to the tile (updates and removes, respectively)
|
package/src/source/tile.ts
CHANGED
|
@@ -47,6 +47,7 @@ import {ExpiryData} from '../util/ajax';
|
|
|
47
47
|
export type TileState = 'loading' | 'loaded' | 'reloading' | 'unloaded' | 'errored' | 'expired';
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
|
+
* @internal
|
|
50
51
|
* A tile object is the combination of a Coordinate, which defines
|
|
51
52
|
* its place, as well as a unique ID and data tracking for its content
|
|
52
53
|
*/
|
package/src/source/tile_cache.ts
CHANGED
|
@@ -2,10 +2,10 @@ import {OverscaledTileID} from './tile_id';
|
|
|
2
2
|
import type {Tile} from './tile';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
+
* @internal
|
|
5
6
|
* A [least-recently-used cache](http://en.wikipedia.org/wiki/Cache_algorithms)
|
|
6
7
|
* with hash lookup made possible by keeping a list of keys in parallel to
|
|
7
8
|
* an array of dictionary of values
|
|
8
|
-
*
|
|
9
9
|
*/
|
|
10
10
|
export class TileCache {
|
|
11
11
|
max: number;
|
package/src/source/tile_id.ts
CHANGED
|
@@ -87,6 +87,85 @@ describe('vector tile worker source', () => {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
test('VectorTileWorkerSource#loadTile reparses tile if the reloadTile has been called during parsing', (done) => {
|
|
90
|
+
const rawTileData = new Uint8Array([]);
|
|
91
|
+
function loadVectorData(params, callback) {
|
|
92
|
+
return callback(null, {
|
|
93
|
+
vectorTile: {
|
|
94
|
+
layers: {
|
|
95
|
+
test: {
|
|
96
|
+
version: 2,
|
|
97
|
+
name: 'test',
|
|
98
|
+
extent: 8192,
|
|
99
|
+
length: 1,
|
|
100
|
+
feature: (featureIndex: number) => ({
|
|
101
|
+
extent: 8192,
|
|
102
|
+
type: 1,
|
|
103
|
+
id: featureIndex,
|
|
104
|
+
properties: {
|
|
105
|
+
name: 'test'
|
|
106
|
+
},
|
|
107
|
+
loadGeometry () {
|
|
108
|
+
return [[{x: 0, y: 0}]];
|
|
109
|
+
}
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
} as any as vt.VectorTile,
|
|
114
|
+
rawData: rawTileData
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const layerIndex = new StyleLayerIndex([{
|
|
119
|
+
id: 'test',
|
|
120
|
+
source: 'source',
|
|
121
|
+
'source-layer': 'test',
|
|
122
|
+
type: 'symbol',
|
|
123
|
+
layout: {
|
|
124
|
+
'icon-image': 'hello',
|
|
125
|
+
'text-font': ['StandardFont-Bold'],
|
|
126
|
+
'text-field': '{name}'
|
|
127
|
+
}
|
|
128
|
+
}]);
|
|
129
|
+
|
|
130
|
+
const send = jest.fn().mockImplementation((type: string, data: unknown, callback: Function) => {
|
|
131
|
+
const res = setTimeout(() => callback(null,
|
|
132
|
+
type === 'getImages' ?
|
|
133
|
+
{'hello': {width: 1, height: 1, data: new Uint8Array([0])}} :
|
|
134
|
+
{'StandardFont-Bold': {width: 1, height: 1, data: new Uint8Array([0])}}
|
|
135
|
+
));
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
cancel: () => clearTimeout(res)
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const actor = {
|
|
143
|
+
send
|
|
144
|
+
} as unknown as Actor;
|
|
145
|
+
const source = new VectorTileWorkerSource(actor, layerIndex, ['hello'], loadVectorData);
|
|
146
|
+
source.loadTile({
|
|
147
|
+
source: 'source',
|
|
148
|
+
uid: 0,
|
|
149
|
+
tileID: {overscaledZ: 0, wrap: 0, canonical: {x: 0, y: 0, z: 0, w: 0}},
|
|
150
|
+
request: {url: 'http://localhost:2900/faketile.pbf'}
|
|
151
|
+
} as any as WorkerTileParameters, () => {
|
|
152
|
+
done.fail('should not be called');
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
source.reloadTile({
|
|
156
|
+
source: 'source',
|
|
157
|
+
uid: '0',
|
|
158
|
+
tileID: {overscaledZ: 0, wrap: 0, canonical: {x: 0, y: 0, z: 0, w: 0}},
|
|
159
|
+
} as any as WorkerTileParameters, (err, res) => {
|
|
160
|
+
expect(err).toBeFalsy();
|
|
161
|
+
expect(res).toBeDefined();
|
|
162
|
+
expect(res.rawTileData).toBeDefined();
|
|
163
|
+
expect(res.rawTileData).toStrictEqual(rawTileData);
|
|
164
|
+
done();
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test('VectorTileWorkerSource#loadTile reparses tile if reloadTile is called during reparsing', (done) => {
|
|
90
169
|
const rawTileData = new Uint8Array([]);
|
|
91
170
|
function loadVectorData(params, callback) {
|
|
92
171
|
return callback(null, {
|
|
@@ -24,6 +24,12 @@ export type LoadVectorTileResult = {
|
|
|
24
24
|
resourceTiming?: Array<PerformanceResourceTiming>;
|
|
25
25
|
} & ExpiryData;
|
|
26
26
|
|
|
27
|
+
type FetchingState = {
|
|
28
|
+
rawTileData: ArrayBuffer;
|
|
29
|
+
cacheControl: ExpiryData;
|
|
30
|
+
resourceTiming: any;
|
|
31
|
+
}
|
|
32
|
+
|
|
27
33
|
/**
|
|
28
34
|
* The callback when finished loading vector data
|
|
29
35
|
*/
|
|
@@ -66,6 +72,7 @@ export class VectorTileWorkerSource implements WorkerSource {
|
|
|
66
72
|
layerIndex: StyleLayerIndex;
|
|
67
73
|
availableImages: Array<string>;
|
|
68
74
|
loadVectorData: LoadVectorData;
|
|
75
|
+
fetching: {[_: string]: FetchingState };
|
|
69
76
|
loading: {[_: string]: WorkerTile};
|
|
70
77
|
loaded: {[_: string]: WorkerTile};
|
|
71
78
|
|
|
@@ -80,6 +87,7 @@ export class VectorTileWorkerSource implements WorkerSource {
|
|
|
80
87
|
this.layerIndex = layerIndex;
|
|
81
88
|
this.availableImages = availableImages;
|
|
82
89
|
this.loadVectorData = loadVectorData || loadVectorTile;
|
|
90
|
+
this.fetching = {};
|
|
83
91
|
this.loading = {};
|
|
84
92
|
this.loaded = {};
|
|
85
93
|
}
|
|
@@ -124,6 +132,7 @@ export class VectorTileWorkerSource implements WorkerSource {
|
|
|
124
132
|
|
|
125
133
|
workerTile.vectorTile = response.vectorTile;
|
|
126
134
|
workerTile.parse(response.vectorTile, this.layerIndex, this.availableImages, this.actor, (err, result) => {
|
|
135
|
+
delete this.fetching[uid];
|
|
127
136
|
if (err || !result) return callback(err);
|
|
128
137
|
|
|
129
138
|
// Transferring a copy of rawTileData because the worker needs to retain its copy.
|
|
@@ -132,6 +141,8 @@ export class VectorTileWorkerSource implements WorkerSource {
|
|
|
132
141
|
|
|
133
142
|
this.loaded = this.loaded || {};
|
|
134
143
|
this.loaded[uid] = workerTile;
|
|
144
|
+
// keep the original fetching state so that reload tile can pick it up if the original parse is cancelled by reloads' parse
|
|
145
|
+
this.fetching[uid] = {rawTileData, cacheControl, resourceTiming};
|
|
135
146
|
}) as AbortVectorData;
|
|
136
147
|
}
|
|
137
148
|
|
|
@@ -145,7 +156,21 @@ export class VectorTileWorkerSource implements WorkerSource {
|
|
|
145
156
|
const workerTile = loaded[uid];
|
|
146
157
|
workerTile.showCollisionBoxes = params.showCollisionBoxes;
|
|
147
158
|
if (workerTile.status === 'parsing') {
|
|
148
|
-
workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor,
|
|
159
|
+
workerTile.parse(workerTile.vectorTile, this.layerIndex, this.availableImages, this.actor, (err, result) => {
|
|
160
|
+
if (err || !result) return callback(err, result);
|
|
161
|
+
|
|
162
|
+
// if we have cancelled the original parse, make sure to pass the rawTileData from the original fetch
|
|
163
|
+
let parseResult;
|
|
164
|
+
if (this.fetching[uid]) {
|
|
165
|
+
const {rawTileData, cacheControl, resourceTiming} = this.fetching[uid];
|
|
166
|
+
delete this.fetching[uid];
|
|
167
|
+
parseResult = extend({rawTileData: rawTileData.slice(0)}, result, cacheControl, resourceTiming);
|
|
168
|
+
} else {
|
|
169
|
+
parseResult = result;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
callback(null, parseResult);
|
|
173
|
+
});
|
|
149
174
|
} else if (workerTile.status === 'done') {
|
|
150
175
|
// if there was no vector tile data on the initial load, don't try and re-parse tile
|
|
151
176
|
if (workerTile.vectorTile) {
|
package/src/style/properties.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type CrossFaded<T> = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
|
+
* @internal
|
|
25
26
|
* Implementations of the `Property` interface:
|
|
26
27
|
*
|
|
27
28
|
* * Hold metadata about a property that's independent of any specific value: stuff like the type of the value,
|
|
@@ -49,6 +50,7 @@ export interface Property<T, R> {
|
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
/**
|
|
53
|
+
* @internal
|
|
52
54
|
* `PropertyValue` represents the value part of a property key-value unit. It's used to represent both
|
|
53
55
|
* paint and layout property values, and regardless of whether or not their property supports data-driven
|
|
54
56
|
* expressions.
|
|
@@ -95,6 +97,7 @@ export type TransitionParameters = {
|
|
|
95
97
|
};
|
|
96
98
|
|
|
97
99
|
/**
|
|
100
|
+
* @internal
|
|
98
101
|
* Paint properties are _transitionable_: they can change in a fluid manner, interpolating or cross-fading between
|
|
99
102
|
* old and new value. The duration of the transition, and the delay before it begins, is configurable.
|
|
100
103
|
*
|
|
@@ -125,6 +128,7 @@ class TransitionablePropertyValue<T, R> {
|
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
/**
|
|
131
|
+
* @internal
|
|
128
132
|
* `Transitionable` stores a map of all (property name, `TransitionablePropertyValue`) pairs for paint properties of a
|
|
129
133
|
* given layer type. It can calculate the `TransitioningPropertyValue`s for all of them at once, producing a
|
|
130
134
|
* `Transitioning` instance for the same set of properties.
|
|
@@ -196,6 +200,7 @@ export class Transitionable<Props> {
|
|
|
196
200
|
}
|
|
197
201
|
|
|
198
202
|
/**
|
|
203
|
+
* @internal
|
|
199
204
|
* `TransitioningPropertyValue` implements the first of two intermediate steps in the evaluation chain of a paint
|
|
200
205
|
* property value. In this step, transitions between old and new values are handled: as long as the transition is in
|
|
201
206
|
* progress, `TransitioningPropertyValue` maintains a reference to the prior value, and interpolates between it and
|
|
@@ -256,6 +261,7 @@ class TransitioningPropertyValue<T, R> {
|
|
|
256
261
|
}
|
|
257
262
|
|
|
258
263
|
/**
|
|
264
|
+
* @internal
|
|
259
265
|
* `Transitioning` stores a map of all (property name, `TransitioningPropertyValue`) pairs for paint properties of a
|
|
260
266
|
* given layer type. It can calculate the possibly-evaluated values for all of them at once, producing a
|
|
261
267
|
* `PossiblyEvaluated` instance for the same set of properties.
|
|
@@ -370,6 +376,7 @@ type PossiblyEvaluatedValue<T> = {
|
|
|
370
376
|
} | SourceExpression | CompositeExpression;
|
|
371
377
|
|
|
372
378
|
/**
|
|
379
|
+
* @internal
|
|
373
380
|
* `PossiblyEvaluatedPropertyValue` is used for data-driven paint and layout property values. It holds a
|
|
374
381
|
* `PossiblyEvaluatedValue` and the `GlobalProperties` that were used to generate it. You're not allowed to supply
|
|
375
382
|
* a different set of `GlobalProperties` when performing the final evaluation because they would be ignored in the
|
|
@@ -409,6 +416,7 @@ export class PossiblyEvaluatedPropertyValue<T> {
|
|
|
409
416
|
}
|
|
410
417
|
|
|
411
418
|
/**
|
|
419
|
+
* @internal
|
|
412
420
|
* `PossiblyEvaluated` stores a map of all (property name, `R`) pairs for paint or layout properties of a
|
|
413
421
|
* given layer type.
|
|
414
422
|
*/
|
|
@@ -427,6 +435,7 @@ export class PossiblyEvaluated<Props, PossibleEvaluatedProps> {
|
|
|
427
435
|
}
|
|
428
436
|
|
|
429
437
|
/**
|
|
438
|
+
* @internal
|
|
430
439
|
* An implementation of `Property` for properties that do not permit data-driven (source or composite) expressions.
|
|
431
440
|
* This restriction allows us to declare statically that the result of possibly evaluating this kind of property
|
|
432
441
|
* is in fact always the scalar type `T`, and can be used without further evaluating the value on a per-feature basis.
|
|
@@ -455,6 +464,7 @@ export class DataConstantProperty<T> implements Property<T, T> {
|
|
|
455
464
|
}
|
|
456
465
|
|
|
457
466
|
/**
|
|
467
|
+
* @internal
|
|
458
468
|
* An implementation of `Property` for properties that permit data-driven (source or composite) expressions.
|
|
459
469
|
* The result of possibly evaluating this kind of property is `PossiblyEvaluatedPropertyValue<T>`; obtaining
|
|
460
470
|
* a scalar value `T` requires further evaluation on a per-feature basis.
|
|
@@ -529,6 +539,7 @@ export class DataDrivenProperty<T> implements Property<T, PossiblyEvaluatedPrope
|
|
|
529
539
|
}
|
|
530
540
|
|
|
531
541
|
/**
|
|
542
|
+
* @internal
|
|
532
543
|
* An implementation of `Property` for data driven `line-pattern` which are transitioned by cross-fading
|
|
533
544
|
* rather than interpolation.
|
|
534
545
|
*/
|
|
@@ -594,6 +605,7 @@ export class CrossFadedDataDrivenProperty<T> extends DataDrivenProperty<CrossFad
|
|
|
594
605
|
}
|
|
595
606
|
}
|
|
596
607
|
/**
|
|
608
|
+
* @internal
|
|
597
609
|
* An implementation of `Property` for `*-pattern` and `line-dasharray`, which are transitioned by cross-fading
|
|
598
610
|
* rather than interpolation.
|
|
599
611
|
*/
|
|
@@ -635,6 +647,7 @@ export class CrossFadedProperty<T> implements Property<T, CrossFaded<T>> {
|
|
|
635
647
|
}
|
|
636
648
|
|
|
637
649
|
/**
|
|
650
|
+
* @internal
|
|
638
651
|
* An implementation of `Property` for `heatmap-color` and `line-gradient`. Interpolation is a no-op, and
|
|
639
652
|
* evaluation returns a boolean value in order to indicate its presence, but the real
|
|
640
653
|
* evaluation happens in StyleLayer classes.
|
|
@@ -660,6 +673,7 @@ export class ColorRampProperty implements Property<Color, boolean> {
|
|
|
660
673
|
}
|
|
661
674
|
|
|
662
675
|
/**
|
|
676
|
+
* @internal
|
|
663
677
|
* `Properties` holds objects containing default values for the layout or paint property set of a given
|
|
664
678
|
* layer type. These objects are immutable, and they are used as the prototypes for the `_values` members of
|
|
665
679
|
* `Transitionable`, `Transitioning`, `Layout`, and `PossiblyEvaluated`. This allows these classes to avoid
|
package/src/style/style.ts
CHANGED
package/src/style/style_glyph.ts
CHANGED
|
@@ -33,6 +33,7 @@ export type FeatureKey = {
|
|
|
33
33
|
};
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
+
* @internal
|
|
36
37
|
* A collision index used to prevent symbols from overlapping. It keep tracks of
|
|
37
38
|
* where previous symbols have been placed and is used to check if a new
|
|
38
39
|
* symbol overlaps with any previously added symbols.
|
package/src/symbol/grid_index.ts
CHANGED
|
@@ -48,6 +48,7 @@ function overlapAllowed(overlapA: OverlapMode, overlapB: OverlapMode): boolean {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
+
* @internal
|
|
51
52
|
* GridIndex is a data structure for testing the intersection of
|
|
52
53
|
* circles and rectangles in a 2d plane.
|
|
53
54
|
* It is optimized for rapid insertion and querying.
|
package/src/ui/camera.ts
CHANGED
|
@@ -263,30 +263,30 @@ export abstract class Camera extends Evented {
|
|
|
263
263
|
_easeFrameId: TaskID;
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
|
-
* @
|
|
266
|
+
* @internal
|
|
267
267
|
* holds the geographical coordinate of the target
|
|
268
268
|
*/
|
|
269
269
|
_elevationCenter: LngLat;
|
|
270
270
|
/**
|
|
271
|
-
* @
|
|
271
|
+
* @internal
|
|
272
272
|
* holds the targ altitude value, = center elevation of the target.
|
|
273
273
|
* This value may changes during flight, because new terrain-tiles loads during flight.
|
|
274
274
|
*/
|
|
275
275
|
_elevationTarget: number;
|
|
276
276
|
/**
|
|
277
|
-
* @
|
|
277
|
+
* @internal
|
|
278
278
|
* holds the start altitude value, = center elevation before animation begins
|
|
279
279
|
* this value will recalculated during flight in respect of changing _elevationTarget values,
|
|
280
280
|
* so the linear interpolation between start and target keeps smooth and without jumps.
|
|
281
281
|
*/
|
|
282
282
|
_elevationStart: number;
|
|
283
283
|
/**
|
|
284
|
-
* @
|
|
284
|
+
* @internal
|
|
285
285
|
* Saves the current state of the elevation freeze - this is used during map movement to prevent "rocky" camera movement.
|
|
286
286
|
*/
|
|
287
287
|
_elevationFreeze: boolean;
|
|
288
288
|
/**
|
|
289
|
-
* @
|
|
289
|
+
* @internal
|
|
290
290
|
* Used to track accumulated changes during continuous interaction
|
|
291
291
|
*/
|
|
292
292
|
_requestedCameraState?: Transform;
|
|
@@ -645,6 +645,7 @@ export abstract class Camera extends Evented {
|
|
|
645
645
|
}
|
|
646
646
|
|
|
647
647
|
/**
|
|
648
|
+
* @internal
|
|
648
649
|
* Calculate the center of these two points in the viewport and use
|
|
649
650
|
* the highest zoom level up to and including `Map#getMaxZoom()` that fits
|
|
650
651
|
* the points in the viewport at the specified bearing.
|
|
@@ -654,7 +655,6 @@ export abstract class Camera extends Evented {
|
|
|
654
655
|
* @param options - the camera options
|
|
655
656
|
* @returns If map is able to fit to provided bounds, returns `center`, `zoom`, and `bearing`.
|
|
656
657
|
* If map is unable to fit, method will warn and return undefined.
|
|
657
|
-
* @hidden
|
|
658
658
|
* @example
|
|
659
659
|
* ```ts
|
|
660
660
|
* let p0 = [-79, 43];
|
|
@@ -1085,11 +1085,11 @@ export abstract class Camera extends Evented {
|
|
|
1085
1085
|
}
|
|
1086
1086
|
|
|
1087
1087
|
/**
|
|
1088
|
+
* @internal
|
|
1088
1089
|
* Called when the camera is about to be manipulated.
|
|
1089
1090
|
* If `transformCameraUpdate` is specified, a copy of the current transform is created to track the accumulated changes.
|
|
1090
1091
|
* This underlying transform represents the "desired state" proposed by input handlers / animations / UI controls.
|
|
1091
1092
|
* It may differ from the state used for rendering (`this.transform`).
|
|
1092
|
-
* @hidden
|
|
1093
1093
|
* @returns Transform to apply changes to
|
|
1094
1094
|
*/
|
|
1095
1095
|
_getTransformForUpdate(): Transform {
|
|
@@ -1102,8 +1102,8 @@ export abstract class Camera extends Evented {
|
|
|
1102
1102
|
}
|
|
1103
1103
|
|
|
1104
1104
|
/**
|
|
1105
|
+
* @internal
|
|
1105
1106
|
* Called after the camera is done being manipulated.
|
|
1106
|
-
* @hidden
|
|
1107
1107
|
* @param tr - the requested camera end state
|
|
1108
1108
|
* Call `transformCameraUpdate` if present, and then apply the "approved" changes.
|
|
1109
1109
|
*/
|
|
@@ -33,9 +33,7 @@ export class KeyboardHandler implements Handler {
|
|
|
33
33
|
_pitchStep: number;
|
|
34
34
|
_rotationDisabled: boolean;
|
|
35
35
|
|
|
36
|
-
/**
|
|
37
|
-
* @hidden
|
|
38
|
-
*/
|
|
36
|
+
/** @internal */
|
|
39
37
|
constructor(map: Map) {
|
|
40
38
|
this._tr = new TransformProvider(map);
|
|
41
39
|
const stepOptions = defaultOptions;
|
|
@@ -62,9 +62,7 @@ export class ScrollZoomHandler implements Handler {
|
|
|
62
62
|
_defaultZoomRate: number;
|
|
63
63
|
_wheelZoomRate: number;
|
|
64
64
|
|
|
65
|
-
/**
|
|
66
|
-
* @hidden
|
|
67
|
-
*/
|
|
65
|
+
/** @internal */
|
|
68
66
|
constructor(map: Map, triggerRenderFrame: () => void) {
|
|
69
67
|
this._map = map;
|
|
70
68
|
this._tr = new TransformProvider(map);
|
|
@@ -12,9 +12,7 @@ export class DoubleClickZoomHandler {
|
|
|
12
12
|
_clickZoom: ClickZoomHandler;
|
|
13
13
|
_tapZoom: TapZoomHandler;
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* @hidden
|
|
17
|
-
*/
|
|
15
|
+
/** @internal */
|
|
18
16
|
constructor(clickZoom: ClickZoomHandler, TapZoom: TapZoomHandler) {
|
|
19
17
|
this._clickZoom = clickZoom;
|
|
20
18
|
this._tapZoom = TapZoom;
|
|
@@ -41,9 +41,7 @@ export class DragPanHandler {
|
|
|
41
41
|
_touchPan: TouchPanHandler;
|
|
42
42
|
_inertiaOptions: DragPanOptions | boolean;
|
|
43
43
|
|
|
44
|
-
/**
|
|
45
|
-
* @hidden
|
|
46
|
-
*/
|
|
44
|
+
/** @internal */
|
|
47
45
|
constructor(el: HTMLElement, mousePan: MousePanHandler, touchPan: TouchPanHandler) {
|
|
48
46
|
this._el = el;
|
|
49
47
|
this._mousePan = mousePan;
|
|
@@ -20,9 +20,7 @@ export class DragRotateHandler {
|
|
|
20
20
|
_mousePitch: MousePitchHandler;
|
|
21
21
|
_pitchWithRotate: boolean;
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* @hidden
|
|
25
|
-
*/
|
|
23
|
+
/** @internal */
|
|
26
24
|
constructor(options: DragRotateHandlerOptions, mouseRotate: MouseRotateHandler, mousePitch: MousePitchHandler) {
|
|
27
25
|
this._pitchWithRotate = options.pitchWithRotate;
|
|
28
26
|
this._mouseRotate = mouseRotate;
|
|
@@ -19,9 +19,7 @@ export class TwoFingersTouchZoomRotateHandler {
|
|
|
19
19
|
_rotationDisabled: boolean;
|
|
20
20
|
_enabled: boolean;
|
|
21
21
|
|
|
22
|
-
/**
|
|
23
|
-
* @hidden
|
|
24
|
-
*/
|
|
22
|
+
/** @internal */
|
|
25
23
|
constructor(el: HTMLElement, touchZoom: TwoFingersTouchZoomHandler, touchRotate: TwoFingersTouchRotateHandler, tapDragZoom: TapDragZoomHandler) {
|
|
26
24
|
this._el = el;
|
|
27
25
|
this._touchZoom = touchZoom;
|
|
@@ -5,6 +5,7 @@ import Point from '@mapbox/point-geometry';
|
|
|
5
5
|
import {LngLat} from '../../geo/lng_lat';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
+
* @internal
|
|
8
9
|
* Shared utilities for the Handler classes to access the correct camera state.
|
|
9
10
|
* If Camera.transformCameraUpdate is specified, the "desired state" of camera may differ from the state used for rendering.
|
|
10
11
|
* The handlers need the "desired state" to track accumulated changes.
|