maplibre-gl-layers 0.10.0 → 0.12.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.
- package/README.md +7 -2
- package/dist/SpriteLayer.d.ts +8 -51
- package/dist/calculationHost.d.ts +63 -0
- package/dist/config.d.ts +18 -0
- package/dist/const.d.ts +51 -13
- package/dist/default.d.ts +29 -0
- package/dist/degreeInterpolation.d.ts +2 -2
- package/dist/distanceInterpolation.d.ts +2 -2
- package/dist/easing.d.ts +2 -2
- package/dist/image.d.ts +32 -0
- package/dist/index.cjs +5361 -1531
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +5361 -1532
- package/dist/index.mjs.map +1 -1
- package/dist/internalTypes.d.ts +360 -21
- package/dist/interpolation.d.ts +2 -2
- package/dist/interpolationChannels.d.ts +2 -2
- package/dist/looseQuadTree.d.ts +34 -0
- package/dist/mapLibreProjectionHost.d.ts +18 -0
- package/dist/math.d.ts +115 -163
- package/dist/projectionHost.d.ts +60 -0
- package/dist/rotationInterpolation.d.ts +2 -2
- package/dist/shader.d.ts +83 -0
- package/dist/types.d.ts +27 -8
- package/dist/utils.d.ts +25 -20
- package/dist/wasmCalculationHost.d.ts +68 -0
- package/dist/wasmHost.d.ts +125 -0
- package/dist/wasmProjectionHost.d.ts +19 -0
- package/package.json +8 -7
- package/dist/location.d.ts +0 -24
package/dist/internalTypes.d.ts
CHANGED
|
@@ -1,14 +1,340 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.12.0
|
|
4
4
|
* description: MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/maplibre-gl-layers.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: e8e2cd81aeec4b10f2898c0ede5880ac56bf748d
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { SpriteMode, SpriteAnchor, SpriteImageOffset, SpriteInterpolationOptions, SpriteImageOriginLocation, SpriteLocation, SpriteTextGlyphHorizontalAlign, SpriteTextureMagFilter, SpriteTextureMinFilter, SpriteInterpolationMode, EasingFunction } from './types';
|
|
11
|
+
import { SpriteMode, SpriteAnchor, SpriteImageOffset, SpriteInterpolationOptions, SpriteImageOriginLocation, SpriteLocation, SpriteTextGlyphHorizontalAlign, SpriteTextureMagFilter, SpriteTextureMinFilter, SpriteInterpolationMode, EasingFunction, SpriteScreenPoint, SpritePoint } from './types';
|
|
12
|
+
import { ResolvedSpriteScalingOptions, SurfaceCorner } from './math';
|
|
13
|
+
/**
|
|
14
|
+
* The handle value that using the instance.
|
|
15
|
+
*/
|
|
16
|
+
export type IdHandle = number;
|
|
17
|
+
/**
|
|
18
|
+
* Id handler interface.
|
|
19
|
+
* @param T Identified instance type
|
|
20
|
+
* @remarks It is used for (wasm) interoperability for identity.
|
|
21
|
+
*/
|
|
22
|
+
export interface IdHandler<T> {
|
|
23
|
+
/**
|
|
24
|
+
* Allocates a numeric handle for the specified identifier.
|
|
25
|
+
* @param {string} rawId - Raw identifier.
|
|
26
|
+
* @returns {IdHandle} Allocated handle.
|
|
27
|
+
*/
|
|
28
|
+
readonly allocate: (rawId: string) => IdHandle;
|
|
29
|
+
/**
|
|
30
|
+
* Stores an instance reference at the given handle index.
|
|
31
|
+
* @param {IdHandle} handle - Numeric handle.
|
|
32
|
+
* @param {T} instance - Registered instance.
|
|
33
|
+
*/
|
|
34
|
+
readonly store: (handle: IdHandle, instance: T) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Get instance by handle.
|
|
37
|
+
* @param handle Numeric handle
|
|
38
|
+
* @returns Instance.
|
|
39
|
+
*/
|
|
40
|
+
readonly get: (handle: IdHandle) => T;
|
|
41
|
+
/**
|
|
42
|
+
* Releases the handle associated with the provided identifier.
|
|
43
|
+
* @param {string} rawId - Raw identifier.
|
|
44
|
+
*/
|
|
45
|
+
readonly release: (rawId: string) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Clears all handle bookkeeping state.
|
|
48
|
+
*/
|
|
49
|
+
readonly reset: () => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Buffers exposing image metadata indexed by handle.
|
|
53
|
+
* @remarks It is used for (wasm) interoperability for image identity.
|
|
54
|
+
*/
|
|
55
|
+
export interface ImageHandleBuffers {
|
|
56
|
+
readonly widths: Float32Array;
|
|
57
|
+
readonly heights: Float32Array;
|
|
58
|
+
readonly textureReady: Uint8Array;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Registered image references aligned by handle index.
|
|
62
|
+
* @remarks It is used for (wasm) interoperability for image identity.
|
|
63
|
+
*/
|
|
64
|
+
export type ImageResourceTable = readonly (Readonly<RegisteredImage> | undefined)[];
|
|
65
|
+
/**
|
|
66
|
+
* Image handle buffer controller interface.
|
|
67
|
+
* @remarks It is used for (wasm) interoperability for image identity.
|
|
68
|
+
*/
|
|
69
|
+
export interface ImageHandleBufferController {
|
|
70
|
+
/**
|
|
71
|
+
* Flag metadata buffers for regeneration.
|
|
72
|
+
* @param images Image map.
|
|
73
|
+
*/
|
|
74
|
+
readonly markDirty: (images: ReadonlyMap<string, RegisteredImage>) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Rebuilds the metadata buffers when flagged as dirty.
|
|
77
|
+
* @returns {ImageHandleBuffers} Metadata buffers aligned by handle index.
|
|
78
|
+
*/
|
|
79
|
+
readonly ensure: () => ImageHandleBuffers;
|
|
80
|
+
/**
|
|
81
|
+
* Returns registered images aligned by handle index. Ensures buffers are up to date.
|
|
82
|
+
*/
|
|
83
|
+
readonly getResourcesByHandle: () => ImageResourceTable;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Encoded pointer representing the target of an origin reference.
|
|
87
|
+
* @remarks It is used for (wasm) interoperability for image identity.
|
|
88
|
+
* The high bits encode the sub-layer while the low bits encode the order slot.
|
|
89
|
+
*/
|
|
90
|
+
export type SpriteOriginReferenceKey = number;
|
|
91
|
+
/** Sentinel used when the image does not reference another sprite image. */
|
|
92
|
+
export declare const SPRITE_ORIGIN_REFERENCE_KEY_NONE = -1;
|
|
93
|
+
/**
|
|
94
|
+
* Index into the render target bucket pointing at the resolved origin image.
|
|
95
|
+
* @remarks It is used for (wasm) interoperability for image identity.
|
|
96
|
+
* When no origin is assigned or the reference could not be resolved,
|
|
97
|
+
* the value will be {@link SPRITE_ORIGIN_REFERENCE_INDEX_NONE}.
|
|
98
|
+
*/
|
|
99
|
+
export type SpriteOriginReferenceIndex = number;
|
|
100
|
+
/** Sentinel indicating that the origin pointer has not been resolved yet. */
|
|
101
|
+
export declare const SPRITE_ORIGIN_REFERENCE_INDEX_NONE = -1;
|
|
102
|
+
/**
|
|
103
|
+
* Encode/Decode interface for a (subLayer, order) pair into a compact numeric key.
|
|
104
|
+
* @remarks It is used for (wasm) interoperability for image identity.
|
|
105
|
+
*/
|
|
106
|
+
export interface SpriteOriginReference {
|
|
107
|
+
/**
|
|
108
|
+
* Encodes a (subLayer, order) pair into a compact numeric key.
|
|
109
|
+
* @param subLayer Sub-layer identifier within the sprite.
|
|
110
|
+
* @param order Order slot inside the sub-layer.
|
|
111
|
+
* @returns Encoded origin reference key.
|
|
112
|
+
*/
|
|
113
|
+
readonly encodeKey: (subLayer: number, order: number) => SpriteOriginReferenceKey;
|
|
114
|
+
/**
|
|
115
|
+
* Decodes an origin reference key back into the sub-layer and order pair.
|
|
116
|
+
* @param key Encoded origin reference key.
|
|
117
|
+
* @returns `subLayer` and `order` components; when the key is invalid, both values are set to `-1`.
|
|
118
|
+
*/
|
|
119
|
+
readonly decodeKey: (key: SpriteOriginReferenceKey) => {
|
|
120
|
+
readonly subLayer: number;
|
|
121
|
+
readonly order: number;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Tuple representing a single entry in a render target bucket.
|
|
126
|
+
* @remarks It is used for (wasm) interoperability for sprite origin.
|
|
127
|
+
* The first item is the sprite's frame-level state and the second item is
|
|
128
|
+
* the specific image being rendered,
|
|
129
|
+
* mirroring how the renderer stores draw calls on the CPU side.
|
|
130
|
+
* Keeping the pair immutable prevents accidental divergence between cached data
|
|
131
|
+
* and the GPU buffers derived from it.
|
|
132
|
+
*/
|
|
133
|
+
export type RenderTargetEntryLike<TTag> = readonly [
|
|
134
|
+
InternalSpriteCurrentState<TTag>,
|
|
135
|
+
InternalSpriteImageState
|
|
136
|
+
];
|
|
137
|
+
/**
|
|
138
|
+
* Parallel typed arrays that expose bucket metadata in a WASM-friendly layout.
|
|
139
|
+
* @remarks It is used for (wasm) interoperability for sprite origin.
|
|
140
|
+
* Both arrays always share the same length as the bucket, allowing shader-side
|
|
141
|
+
* code (or WASM helpers) to traverse origin reference metadata without touching
|
|
142
|
+
* the heavyweight tuple objects.
|
|
143
|
+
*/
|
|
144
|
+
export interface RenderTargetBucketBuffers {
|
|
145
|
+
/**
|
|
146
|
+
* Encoded origin metadata (sub-layer/order pairs) for each queued image,
|
|
147
|
+
* mirroring `image.originReferenceKey`. A value of
|
|
148
|
+
* `SPRITE_ORIGIN_REFERENCE_KEY_NONE` denotes that the entry is self-originating.
|
|
149
|
+
*/
|
|
150
|
+
readonly originReferenceKeys: Int32Array;
|
|
151
|
+
/**
|
|
152
|
+
* Bucket index pointing to the entry that should provide the origin image for
|
|
153
|
+
* the current sprite. Values equal to
|
|
154
|
+
* `SPRITE_ORIGIN_REFERENCE_INDEX_NONE` or outside the bucket range mark the
|
|
155
|
+
* origin as unresolved.
|
|
156
|
+
*/
|
|
157
|
+
readonly originTargetIndices: Int32Array;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Represents a projected three dimensional position.
|
|
161
|
+
* `MercatorCoordinate` uses the web mercator projection ([EPSG:3857](https://epsg.io/3857)) with slightly different units:
|
|
162
|
+
* - the size of 1 unit is the width of the projected world instead of the "mercator meter"
|
|
163
|
+
* - the origin of the coordinate space is at the north-west corner instead of the middle
|
|
164
|
+
*/
|
|
165
|
+
export interface SpriteMercatorCoordinate {
|
|
166
|
+
readonly x: number;
|
|
167
|
+
readonly y: number;
|
|
168
|
+
readonly z: number;
|
|
169
|
+
}
|
|
170
|
+
export interface Releaseable {
|
|
171
|
+
readonly release: () => void;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Abstraction that exposes projection-related helpers.
|
|
175
|
+
*/
|
|
176
|
+
export interface ProjectionHost extends Releaseable {
|
|
177
|
+
/**
|
|
178
|
+
* Get current zoom level.
|
|
179
|
+
* @returns Zoom level.
|
|
180
|
+
*/
|
|
181
|
+
readonly getZoom: () => number;
|
|
182
|
+
/**
|
|
183
|
+
* Extracts the current clip-space context if the mercator matrix is available.
|
|
184
|
+
* @returns {ClipContext | null} Clip context or `null` when the transform is not ready.
|
|
185
|
+
*/
|
|
186
|
+
readonly getClipContext: () => ClipContext | null;
|
|
187
|
+
/**
|
|
188
|
+
* Get mercator coordinate from the location
|
|
189
|
+
* @param location Location.
|
|
190
|
+
* @returns Mercator coordinate.
|
|
191
|
+
*/
|
|
192
|
+
readonly fromLngLat: (location: Readonly<SpriteLocation>) => SpriteMercatorCoordinate;
|
|
193
|
+
/**
|
|
194
|
+
* Project the location.
|
|
195
|
+
* @param location Location.
|
|
196
|
+
* @returns Projected point if valid location.
|
|
197
|
+
*/
|
|
198
|
+
readonly project: (location: Readonly<SpriteLocation>) => SpritePoint | null;
|
|
199
|
+
/**
|
|
200
|
+
* Unproject the location.
|
|
201
|
+
* @param point Projected point.
|
|
202
|
+
* @returns Location if valid point.
|
|
203
|
+
*/
|
|
204
|
+
readonly unproject: (point: Readonly<SpritePoint>) => SpriteLocation | null;
|
|
205
|
+
/**
|
|
206
|
+
* Calculate perspective ratio.
|
|
207
|
+
* @param location Location.
|
|
208
|
+
* @param cachedMercator Mercator coodinate when available earlier calculation.
|
|
209
|
+
* @returns The ratio.
|
|
210
|
+
*/
|
|
211
|
+
readonly calculatePerspectiveRatio: (location: Readonly<SpriteLocation>, cachedMercator?: SpriteMercatorCoordinate) => number;
|
|
212
|
+
}
|
|
213
|
+
export interface PrepareDrawSpriteImageParamsBase {
|
|
214
|
+
readonly imageResources: ImageResourceTable;
|
|
215
|
+
readonly imageHandleBuffers: Readonly<ImageHandleBuffers>;
|
|
216
|
+
readonly baseMetersPerPixel: number;
|
|
217
|
+
readonly spriteMinPixel: number;
|
|
218
|
+
readonly spriteMaxPixel: number;
|
|
219
|
+
readonly drawingBufferWidth: number;
|
|
220
|
+
readonly drawingBufferHeight: number;
|
|
221
|
+
readonly pixelRatio: number;
|
|
222
|
+
readonly clipContext: Readonly<ClipContext> | null;
|
|
223
|
+
}
|
|
224
|
+
export interface PrepareDrawSpriteImageParamsBefore<TTag> extends PrepareDrawSpriteImageParamsBase {
|
|
225
|
+
readonly bucket: readonly Readonly<RenderTargetEntryLike<TTag>>[];
|
|
226
|
+
readonly bucketBuffers: Readonly<RenderTargetBucketBuffers>;
|
|
227
|
+
readonly resolvedScaling: ResolvedSpriteScalingOptions;
|
|
228
|
+
readonly zoomScaleFactor: number;
|
|
229
|
+
}
|
|
230
|
+
export interface PrepareDrawSpriteImageParamsAfter extends PrepareDrawSpriteImageParamsBase {
|
|
231
|
+
readonly identityScaleX: number;
|
|
232
|
+
readonly identityScaleY: number;
|
|
233
|
+
readonly identityOffsetX: number;
|
|
234
|
+
readonly identityOffsetY: number;
|
|
235
|
+
readonly screenToClipScaleX: number;
|
|
236
|
+
readonly screenToClipScaleY: number;
|
|
237
|
+
readonly screenToClipOffsetX: number;
|
|
238
|
+
readonly screenToClipOffsetY: number;
|
|
239
|
+
}
|
|
240
|
+
export interface PrepareDrawSpriteImageParams<TTag> extends PrepareDrawSpriteImageParamsBefore<TTag>, PrepareDrawSpriteImageParamsAfter {
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Prepared parameters for WebGL rendering.
|
|
244
|
+
*/
|
|
245
|
+
export interface PreparedDrawSpriteImageParams<T> {
|
|
246
|
+
readonly spriteEntry: InternalSpriteCurrentState<T>;
|
|
247
|
+
readonly imageEntry: InternalSpriteImageState;
|
|
248
|
+
readonly imageResource: RegisteredImage;
|
|
249
|
+
readonly vertexData: Float32Array;
|
|
250
|
+
readonly opacity: number;
|
|
251
|
+
readonly hitTestCorners: readonly [
|
|
252
|
+
Readonly<SpriteScreenPoint>,
|
|
253
|
+
Readonly<SpriteScreenPoint>,
|
|
254
|
+
Readonly<SpriteScreenPoint>,
|
|
255
|
+
Readonly<SpriteScreenPoint>
|
|
256
|
+
] | null;
|
|
257
|
+
readonly screenToClip: {
|
|
258
|
+
readonly scaleX: number;
|
|
259
|
+
readonly scaleY: number;
|
|
260
|
+
readonly offsetX: number;
|
|
261
|
+
readonly offsetY: number;
|
|
262
|
+
};
|
|
263
|
+
readonly useShaderSurface: boolean;
|
|
264
|
+
readonly surfaceShaderInputs: SurfaceShaderInputs | undefined;
|
|
265
|
+
readonly surfaceClipEnabled: boolean;
|
|
266
|
+
readonly useShaderBillboard: boolean;
|
|
267
|
+
readonly billboardUniforms: {
|
|
268
|
+
readonly center: SpritePoint;
|
|
269
|
+
readonly halfWidth: number;
|
|
270
|
+
readonly halfHeight: number;
|
|
271
|
+
readonly anchor: SpriteAnchor;
|
|
272
|
+
readonly sin: number;
|
|
273
|
+
readonly cos: number;
|
|
274
|
+
} | null;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* The render calculation host.
|
|
278
|
+
* Abstraction that render calculations.
|
|
279
|
+
* @param TTag Tag type.
|
|
280
|
+
*/
|
|
281
|
+
export interface RenderCalculationHost<TTag> extends Releaseable {
|
|
282
|
+
readonly prepareDrawSpriteImages: (params: PrepareDrawSpriteImageParams<TTag>) => PreparedDrawSpriteImageParams<TTag>[];
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Corner model describing world displacements and resulting geographic coordinates for shader validation.
|
|
286
|
+
*/
|
|
287
|
+
export interface SurfaceShaderCornerState extends SpriteLocation, SurfaceCorner {
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Aggregated inputs required to reproduce surface geometry on the GPU.
|
|
291
|
+
*/
|
|
292
|
+
export interface SurfaceShaderInputs {
|
|
293
|
+
readonly mercatorCenter: {
|
|
294
|
+
readonly x: number;
|
|
295
|
+
readonly y: number;
|
|
296
|
+
readonly z: number;
|
|
297
|
+
};
|
|
298
|
+
readonly worldToMercatorScale: Readonly<SurfaceCorner>;
|
|
299
|
+
readonly halfSizeMeters: Readonly<SurfaceCorner>;
|
|
300
|
+
readonly anchor: Readonly<SpriteAnchor>;
|
|
301
|
+
readonly offsetMeters: Readonly<SurfaceCorner>;
|
|
302
|
+
readonly sinCos: {
|
|
303
|
+
readonly sin: number;
|
|
304
|
+
readonly cos: number;
|
|
305
|
+
};
|
|
306
|
+
readonly totalRotateDeg: number;
|
|
307
|
+
readonly depthBiasNdc: number;
|
|
308
|
+
readonly centerDisplacement: Readonly<SurfaceCorner>;
|
|
309
|
+
readonly baseLngLat: Readonly<SpriteLocation>;
|
|
310
|
+
readonly displacedCenter: Readonly<SpriteLocation>;
|
|
311
|
+
readonly scaleAdjustment: number;
|
|
312
|
+
readonly corners: readonly Readonly<SurfaceShaderCornerState>[];
|
|
313
|
+
clipCenter: {
|
|
314
|
+
readonly x: number;
|
|
315
|
+
readonly y: number;
|
|
316
|
+
readonly z: number;
|
|
317
|
+
readonly w: number;
|
|
318
|
+
};
|
|
319
|
+
clipBasisEast: {
|
|
320
|
+
readonly x: number;
|
|
321
|
+
readonly y: number;
|
|
322
|
+
readonly z: number;
|
|
323
|
+
readonly w: number;
|
|
324
|
+
};
|
|
325
|
+
clipBasisNorth: {
|
|
326
|
+
readonly x: number;
|
|
327
|
+
readonly y: number;
|
|
328
|
+
readonly z: number;
|
|
329
|
+
readonly w: number;
|
|
330
|
+
};
|
|
331
|
+
clipCorners: ReadonlyArray<{
|
|
332
|
+
readonly x: number;
|
|
333
|
+
readonly y: number;
|
|
334
|
+
readonly z: number;
|
|
335
|
+
readonly w: number;
|
|
336
|
+
}>;
|
|
337
|
+
}
|
|
12
338
|
/**
|
|
13
339
|
* Runtime state describing the active interpolation between two sprite locations.
|
|
14
340
|
* Consumers reuse the same state across ticks to avoid re-allocations while animation is running.
|
|
@@ -70,10 +396,14 @@ export interface ResolvedTextureFilteringOptions {
|
|
|
70
396
|
* Image metadata ready for use as a WebGL texture.
|
|
71
397
|
*/
|
|
72
398
|
export interface RegisteredImage {
|
|
73
|
-
id: string;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
399
|
+
readonly id: string;
|
|
400
|
+
/**
|
|
401
|
+
* For use (wasm) interoperability id.
|
|
402
|
+
*/
|
|
403
|
+
readonly handle: number;
|
|
404
|
+
readonly width: number;
|
|
405
|
+
readonly height: number;
|
|
406
|
+
readonly bitmap: ImageBitmap;
|
|
77
407
|
texture: WebGLTexture | undefined;
|
|
78
408
|
}
|
|
79
409
|
/**
|
|
@@ -116,7 +446,7 @@ export interface ResolvedTextGlyphOptions {
|
|
|
116
446
|
/**
|
|
117
447
|
* Mutable point reused when computing hit-test corners.
|
|
118
448
|
*/
|
|
119
|
-
export interface MutableSpriteScreenPoint {
|
|
449
|
+
export interface MutableSpriteScreenPoint extends SpriteScreenPoint {
|
|
120
450
|
x: number;
|
|
121
451
|
y: number;
|
|
122
452
|
}
|
|
@@ -127,9 +457,9 @@ export type MatrixInput = ArrayLike<number>;
|
|
|
127
457
|
/**
|
|
128
458
|
* Cached clip-space context containing the mercator matrix required to project coordinates.
|
|
129
459
|
*/
|
|
130
|
-
export
|
|
460
|
+
export interface ClipContext {
|
|
131
461
|
readonly mercatorMatrix: MatrixInput;
|
|
132
|
-
}
|
|
462
|
+
}
|
|
133
463
|
/**
|
|
134
464
|
* 2D canvas rendering context accepted by the glyph renderer.
|
|
135
465
|
*/
|
|
@@ -145,24 +475,28 @@ export interface InternalSpriteImageState {
|
|
|
145
475
|
subLayer: number;
|
|
146
476
|
order: number;
|
|
147
477
|
imageId: string;
|
|
478
|
+
imageHandle: number;
|
|
148
479
|
mode: SpriteMode;
|
|
149
480
|
opacity: number;
|
|
150
481
|
scale: number;
|
|
151
|
-
anchor: SpriteAnchor
|
|
482
|
+
anchor: Readonly<SpriteAnchor>;
|
|
152
483
|
offset: SpriteImageOffset;
|
|
153
484
|
rotateDeg: number;
|
|
154
485
|
displayedRotateDeg: number;
|
|
155
486
|
autoRotation: boolean;
|
|
156
487
|
autoRotationMinDistanceMeters: number;
|
|
157
488
|
resolvedBaseRotateDeg: number;
|
|
158
|
-
originLocation?: SpriteImageOriginLocation
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
489
|
+
originLocation?: Readonly<SpriteImageOriginLocation>;
|
|
490
|
+
originReferenceKey: SpriteOriginReferenceKey;
|
|
491
|
+
originRenderTargetIndex: SpriteOriginReferenceIndex;
|
|
492
|
+
rotationInterpolationState: Readonly<DegreeInterpolationState> | null;
|
|
493
|
+
rotationInterpolationOptions: Readonly<SpriteInterpolationOptions> | null;
|
|
494
|
+
offsetDegInterpolationState: Readonly<DegreeInterpolationState> | null;
|
|
495
|
+
offsetMetersInterpolationState: Readonly<DistanceInterpolationState> | null;
|
|
163
496
|
lastCommandRotateDeg: number;
|
|
164
497
|
lastCommandOffsetDeg: number;
|
|
165
498
|
lastCommandOffsetMeters: number;
|
|
499
|
+
surfaceShaderInputs?: Readonly<SurfaceShaderInputs>;
|
|
166
500
|
hitTestCorners?: [
|
|
167
501
|
MutableSpriteScreenPoint,
|
|
168
502
|
MutableSpriteScreenPoint,
|
|
@@ -175,15 +509,20 @@ export interface InternalSpriteImageState {
|
|
|
175
509
|
*/
|
|
176
510
|
export interface InternalSpriteCurrentState<TTag> {
|
|
177
511
|
spriteId: string;
|
|
512
|
+
handle: IdHandle;
|
|
178
513
|
isEnabled: boolean;
|
|
179
|
-
currentLocation: SpriteLocation
|
|
180
|
-
fromLocation?: SpriteLocation
|
|
181
|
-
toLocation?: SpriteLocation
|
|
514
|
+
currentLocation: Readonly<SpriteLocation>;
|
|
515
|
+
fromLocation?: Readonly<SpriteLocation>;
|
|
516
|
+
toLocation?: Readonly<SpriteLocation>;
|
|
182
517
|
images: Map<number, Map<number, InternalSpriteImageState>>;
|
|
183
518
|
tag: TTag | null;
|
|
184
519
|
interpolationState: InternalSpriteInterpolationState | null;
|
|
185
520
|
pendingInterpolationOptions: SpriteInterpolationOptions | null;
|
|
186
|
-
lastCommandLocation: SpriteLocation
|
|
187
|
-
lastAutoRotationLocation: SpriteLocation
|
|
521
|
+
lastCommandLocation: Readonly<SpriteLocation>;
|
|
522
|
+
lastAutoRotationLocation: Readonly<SpriteLocation>;
|
|
188
523
|
lastAutoRotationAngleDeg: number;
|
|
524
|
+
cachedMercator: Readonly<SpriteMercatorCoordinate>;
|
|
525
|
+
cachedMercatorLng: number;
|
|
526
|
+
cachedMercatorLat: number;
|
|
527
|
+
cachedMercatorZ: number | undefined;
|
|
189
528
|
}
|
package/dist/interpolation.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.12.0
|
|
4
4
|
* description: MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/maplibre-gl-layers.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: e8e2cd81aeec4b10f2898c0ede5880ac56bf748d
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteInterpolationOptions, SpriteLocation } from './types';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.12.0
|
|
4
4
|
* description: MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/maplibre-gl-layers.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: e8e2cd81aeec4b10f2898c0ede5880ac56bf748d
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteInterpolationOptions, SpriteImageOffset } from './types';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: maplibre-gl-layers
|
|
3
|
+
* version: 0.12.0
|
|
4
|
+
* description: MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images
|
|
5
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
+
* license: MIT
|
|
7
|
+
* repository.url: https://github.com/kekyo/maplibre-gl-layers.git
|
|
8
|
+
* git.commit.hash: e8e2cd81aeec4b10f2898c0ede5880ac56bf748d
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export interface Rect {
|
|
12
|
+
readonly x0: number;
|
|
13
|
+
readonly y0: number;
|
|
14
|
+
readonly x1: number;
|
|
15
|
+
readonly y1: number;
|
|
16
|
+
}
|
|
17
|
+
export interface Item<TState> extends Rect {
|
|
18
|
+
readonly state: TState;
|
|
19
|
+
}
|
|
20
|
+
export interface LooseQuadTree<TState> {
|
|
21
|
+
readonly size: number;
|
|
22
|
+
readonly add: (item: Item<TState>) => void;
|
|
23
|
+
readonly remove: (x0: number, y0: number, x1: number, y1: number, item: Item<TState>) => boolean;
|
|
24
|
+
readonly update: (oldX0: number, oldY0: number, oldX1: number, oldY1: number, newX0: number, newY0: number, newX1: number, newY1: number, item: Item<TState>) => boolean;
|
|
25
|
+
readonly lookup: (x0: number, y0: number, x1: number, y1: number) => Item<TState>[];
|
|
26
|
+
readonly clear: () => void;
|
|
27
|
+
}
|
|
28
|
+
export interface LooseQuadTreeOptions {
|
|
29
|
+
readonly bounds: Rect;
|
|
30
|
+
readonly maxItemsPerNode?: number;
|
|
31
|
+
readonly maxDepth?: number;
|
|
32
|
+
readonly looseness?: number;
|
|
33
|
+
}
|
|
34
|
+
export declare const createLooseQuadTree: <TState>(options: LooseQuadTreeOptions) => LooseQuadTree<TState>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: maplibre-gl-layers
|
|
3
|
+
* version: 0.12.0
|
|
4
|
+
* description: MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images
|
|
5
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
+
* license: MIT
|
|
7
|
+
* repository.url: https://github.com/kekyo/maplibre-gl-layers.git
|
|
8
|
+
* git.commit.hash: e8e2cd81aeec4b10f2898c0ede5880ac56bf748d
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { Map as MapLibreMap } from 'maplibre-gl';
|
|
12
|
+
import { ProjectionHost } from './internalTypes';
|
|
13
|
+
/**
|
|
14
|
+
* Create a projection host that delegates to MapLibre.
|
|
15
|
+
* @param map MapLibre map instance
|
|
16
|
+
* @returns Projection host
|
|
17
|
+
*/
|
|
18
|
+
export declare const createMapLibreProjectionHost: (map: MapLibreMap) => ProjectionHost;
|