maplibre-gl-layers 0.15.0 → 0.17.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 +2 -2
- package/dist/SpriteLayer.d.ts +5 -4
- package/dist/config.d.ts +2 -2
- package/dist/const.d.ts +30 -2
- package/dist/default.d.ts +2 -2
- package/dist/gl/atlas.d.ts +2 -2
- package/dist/gl/hitTest.d.ts +5 -5
- package/dist/gl/shader.d.ts +39 -26
- package/dist/gl/text.d.ts +2 -2
- package/dist/host/calculationHost.d.ts +3 -3
- package/dist/host/mapLibreProjectionHost.d.ts +2 -2
- package/dist/host/projectionHost.d.ts +8 -7
- package/dist/host/runtime.d.ts +2 -2
- package/dist/host/wasmCalculationHost.d.ts +6 -2
- package/dist/host/wasmHost.d.ts +3 -3
- package/dist/host/wasmProjectionHost.d.ts +2 -2
- package/dist/index.cjs +2019 -1052
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +2019 -1052
- package/dist/index.mjs.map +1 -1
- package/dist/internalTypes.d.ts +84 -96
- package/dist/interpolation/degreeInterpolation.d.ts +18 -19
- package/dist/interpolation/distanceInterpolation.d.ts +6 -7
- package/dist/interpolation/easing.d.ts +10 -8
- package/dist/interpolation/interpolation.d.ts +10 -12
- package/dist/interpolation/interpolationChannels.d.ts +4 -3
- package/dist/interpolation/rotationInterpolation.d.ts +10 -10
- package/dist/types.d.ts +227 -138
- package/dist/utils/color.d.ts +20 -0
- package/dist/utils/image.d.ts +2 -2
- package/dist/utils/looseQuadTree.d.ts +2 -2
- package/dist/utils/math.d.ts +80 -86
- package/dist/utils/utils.d.ts +2 -2
- package/dist/wasm/config.json.d.ts +2 -2
- package/dist/wasm/offloads-nosimd.wasm +0 -0
- package/dist/wasm/offloads-simd-mt.wasm +0 -0
- package/dist/wasm/offloads-simd.wasm +0 -0
- package/package.json +6 -6
package/dist/internalTypes.d.ts
CHANGED
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.17.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: 9fe9aa30db6602d13643e32c94af39ae2b26b082
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { SpriteMode, SpriteAnchor, SpriteInterpolationOptions, SpriteImageOriginLocation, SpriteLocation, SpriteTextGlyphHorizontalAlign, SpriteTextureMagFilter, SpriteTextureMinFilter, SpriteInterpolationMode,
|
|
11
|
+
import { SpriteMode, SpriteAnchor, SpriteInterpolationOptions, SpriteImageOriginLocation, SpriteLocation, SpriteTextGlyphHorizontalAlign, SpriteTextureMagFilter, SpriteTextureMinFilter, SpriteInterpolationMode, SpriteScreenPoint, SpritePoint, SpriteEasingParam, SpriteImageLineAttributeState, SpriteImageState, SpriteInterpolatedValues, SpriteImageInterpolatedOffset } from './types';
|
|
12
12
|
import { ResolvedSpriteScalingOptions, SurfaceCorner } from './utils/math';
|
|
13
|
+
export interface Releasable {
|
|
14
|
+
readonly release: () => void;
|
|
15
|
+
}
|
|
16
|
+
export type RgbaColor = readonly [number, number, number, number];
|
|
17
|
+
/**
|
|
18
|
+
* Represents a projected three dimensional position.
|
|
19
|
+
* `MercatorCoordinate` uses the web mercator projection ([EPSG:3857](https://epsg.io/3857)) with slightly different units:
|
|
20
|
+
* - the size of 1 unit is the width of the projected world instead of the "mercator meter"
|
|
21
|
+
* - the origin of the coordinate space is at the north-west corner instead of the middle
|
|
22
|
+
*/
|
|
23
|
+
export interface SpriteMercatorCoordinate {
|
|
24
|
+
readonly x: number;
|
|
25
|
+
readonly y: number;
|
|
26
|
+
readonly z: number;
|
|
27
|
+
}
|
|
13
28
|
/**
|
|
14
29
|
* The handle value that using the instance.
|
|
15
30
|
*/
|
|
@@ -157,34 +172,32 @@ export interface RenderTargetBucketBuffers {
|
|
|
157
172
|
readonly originTargetIndices: Int32Array;
|
|
158
173
|
}
|
|
159
174
|
/**
|
|
160
|
-
*
|
|
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
|
|
175
|
+
* Mutable interpolation states.
|
|
164
176
|
*/
|
|
165
|
-
export interface
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
177
|
+
export interface MutableSpriteInterpolation<TValue> {
|
|
178
|
+
state: SpriteInterpolationState<TValue> | null;
|
|
179
|
+
options: Readonly<SpriteInterpolationOptions> | null;
|
|
180
|
+
lastCommandValue: TValue;
|
|
181
|
+
baseValue: TValue | undefined;
|
|
182
|
+
targetValue: TValue | undefined;
|
|
169
183
|
}
|
|
170
184
|
/**
|
|
171
|
-
* Mutable counterpart to {@link
|
|
185
|
+
* Mutable counterpart to {@link SpriteInterpolatedValues}, used internally so SpriteLayer
|
|
172
186
|
* can reuse object references while still exposing readonly snapshots publicly.
|
|
173
187
|
*/
|
|
174
|
-
export interface
|
|
175
|
-
current:
|
|
176
|
-
from:
|
|
177
|
-
to:
|
|
188
|
+
export interface MutableSpriteInterpolatedValues<TValue> extends SpriteInterpolatedValues<TValue> {
|
|
189
|
+
current: TValue;
|
|
190
|
+
from: TValue | undefined;
|
|
191
|
+
to: TValue | undefined;
|
|
192
|
+
invalidated: boolean | undefined;
|
|
193
|
+
interpolation: MutableSpriteInterpolation<TValue>;
|
|
178
194
|
}
|
|
179
|
-
export interface MutableSpriteImageInterpolatedOffset {
|
|
180
|
-
offsetMeters:
|
|
181
|
-
offsetDeg:
|
|
182
|
-
}
|
|
183
|
-
export interface Releasable {
|
|
184
|
-
readonly release: () => void;
|
|
195
|
+
export interface MutableSpriteImageInterpolatedOffset extends SpriteImageInterpolatedOffset {
|
|
196
|
+
offsetMeters: MutableSpriteInterpolatedValues<number>;
|
|
197
|
+
offsetDeg: MutableSpriteInterpolatedValues<number>;
|
|
185
198
|
}
|
|
186
199
|
/**
|
|
187
|
-
*
|
|
200
|
+
* Mimimum abstraction that exposes projection-related helpers.
|
|
188
201
|
*/
|
|
189
202
|
export interface ProjectionHost extends Releasable {
|
|
190
203
|
/**
|
|
@@ -192,11 +205,16 @@ export interface ProjectionHost extends Releasable {
|
|
|
192
205
|
* @returns Zoom level.
|
|
193
206
|
*/
|
|
194
207
|
readonly getZoom: () => number;
|
|
208
|
+
/**
|
|
209
|
+
* Get camera location.
|
|
210
|
+
* @returns Camera location when viewport is available.
|
|
211
|
+
*/
|
|
212
|
+
readonly getCameraLocation: () => SpriteLocation | undefined;
|
|
195
213
|
/**
|
|
196
214
|
* Extracts the current clip-space context if the mercator matrix is available.
|
|
197
|
-
* @returns {ClipContext |
|
|
215
|
+
* @returns {ClipContext | undefined} Clip context or `undefined` when the transform is not ready.
|
|
198
216
|
*/
|
|
199
|
-
readonly getClipContext: () => ClipContext |
|
|
217
|
+
readonly getClipContext: () => ClipContext | undefined;
|
|
200
218
|
/**
|
|
201
219
|
* Get mercator coordinate from the location
|
|
202
220
|
* @param location Location.
|
|
@@ -208,13 +226,13 @@ export interface ProjectionHost extends Releasable {
|
|
|
208
226
|
* @param location Location.
|
|
209
227
|
* @returns Projected point if valid location.
|
|
210
228
|
*/
|
|
211
|
-
readonly project: (location: Readonly<SpriteLocation>) => SpritePoint |
|
|
229
|
+
readonly project: (location: Readonly<SpriteLocation>) => SpritePoint | undefined;
|
|
212
230
|
/**
|
|
213
231
|
* Unproject the location.
|
|
214
232
|
* @param point Projected point.
|
|
215
233
|
* @returns Location if valid point.
|
|
216
234
|
*/
|
|
217
|
-
readonly unproject: (point: Readonly<SpritePoint>) => SpriteLocation |
|
|
235
|
+
readonly unproject: (point: Readonly<SpritePoint>) => SpriteLocation | undefined;
|
|
218
236
|
/**
|
|
219
237
|
* Calculate perspective ratio.
|
|
220
238
|
* @param location Location.
|
|
@@ -222,7 +240,6 @@ export interface ProjectionHost extends Releasable {
|
|
|
222
240
|
* @returns The ratio.
|
|
223
241
|
*/
|
|
224
242
|
readonly calculatePerspectiveRatio: (location: Readonly<SpriteLocation>, cachedMercator?: SpriteMercatorCoordinate) => number;
|
|
225
|
-
readonly getCameraLocation: () => SpriteLocation | null;
|
|
226
243
|
}
|
|
227
244
|
export interface PrepareDrawSpriteImageParamsBase {
|
|
228
245
|
readonly imageResources: ImageResourceTable;
|
|
@@ -233,7 +250,7 @@ export interface PrepareDrawSpriteImageParamsBase {
|
|
|
233
250
|
readonly drawingBufferWidth: number;
|
|
234
251
|
readonly drawingBufferHeight: number;
|
|
235
252
|
readonly pixelRatio: number;
|
|
236
|
-
readonly clipContext: Readonly<ClipContext> |
|
|
253
|
+
readonly clipContext: Readonly<ClipContext> | undefined;
|
|
237
254
|
}
|
|
238
255
|
export interface PrepareDrawSpriteImageParamsBefore<TTag> extends PrepareDrawSpriteImageParamsBase {
|
|
239
256
|
readonly bucket: readonly Readonly<RenderTargetEntryLike<TTag>>[];
|
|
@@ -387,55 +404,34 @@ export interface SurfaceShaderInputs {
|
|
|
387
404
|
readonly w: number;
|
|
388
405
|
}>;
|
|
389
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* Easing function type.
|
|
409
|
+
*/
|
|
410
|
+
export type EasingFunction = (progress: number) => number;
|
|
390
411
|
/**
|
|
391
412
|
* Runtime state describing the active interpolation between two sprite locations.
|
|
392
413
|
* Consumers reuse the same state across ticks to avoid re-allocations while animation is running.
|
|
393
|
-
*
|
|
394
|
-
* @property mode - Strategy used to resolve the target location (feedback or feedforward).
|
|
395
|
-
* @property durationMs - Total time allocated for the interpolation in milliseconds.
|
|
396
|
-
* @property easing - Resolved easing function applied to raw progress values.
|
|
397
|
-
* @property startTimestamp - Epoch millisecond when the interpolation started, or -1 when uninitialized.
|
|
398
|
-
* @property from - Origin sprite location cloned from the current render state.
|
|
399
|
-
* @property to - Destination sprite location being interpolated towards.
|
|
400
|
-
*/
|
|
401
|
-
export interface SpriteInterpolationState {
|
|
402
|
-
readonly mode: SpriteInterpolationMode;
|
|
403
|
-
readonly durationMs: number;
|
|
404
|
-
readonly easing: EasingFunction;
|
|
405
|
-
readonly easingPreset: SpriteEasingPresetName | null;
|
|
406
|
-
startTimestamp: number;
|
|
407
|
-
readonly from: SpriteLocation;
|
|
408
|
-
readonly to: SpriteLocation;
|
|
409
|
-
}
|
|
410
|
-
/**
|
|
411
|
-
* Runtime state tracked for numeric interpolations.
|
|
412
|
-
* @property {number} durationMs - Total duration of the interpolation in milliseconds.
|
|
413
|
-
* @property {EasingFunction} easing - Easing function applied to progress samples.
|
|
414
|
-
* @property {number} from - Start value used for interpolation.
|
|
415
|
-
* @property {number} to - Adjusted target along the shortest rotation path.
|
|
416
|
-
* @property {number} finalValue - Caller-requested final value (used once interpolation completes).
|
|
417
|
-
* @property {number} startTimestamp - Timestamp when interpolation began, `-1` until evaluation starts.
|
|
418
414
|
*/
|
|
419
|
-
export interface
|
|
420
|
-
|
|
421
|
-
readonly
|
|
422
|
-
|
|
423
|
-
readonly from: number;
|
|
424
|
-
readonly to: number;
|
|
425
|
-
readonly finalValue: number;
|
|
426
|
-
startTimestamp: number;
|
|
427
|
-
}
|
|
428
|
-
export interface DistanceInterpolationState {
|
|
415
|
+
export interface SpriteInterpolationState<TValue> {
|
|
416
|
+
/** Strategy used to resolve the target location (feedback or feedforward). */
|
|
417
|
+
readonly mode: SpriteInterpolationMode;
|
|
418
|
+
/** Total time allocated for the interpolation in milliseconds. */
|
|
429
419
|
readonly durationMs: number;
|
|
430
|
-
|
|
431
|
-
readonly
|
|
432
|
-
|
|
433
|
-
readonly
|
|
434
|
-
|
|
420
|
+
/** Easing attributes */
|
|
421
|
+
readonly easingParam: SpriteEasingParam;
|
|
422
|
+
/** Resolved easing function applied to raw progress values. */
|
|
423
|
+
readonly easingFunc: EasingFunction;
|
|
424
|
+
/** Origin sprite location cloned from the current render state. */
|
|
425
|
+
readonly from: TValue;
|
|
426
|
+
/** Destination sprite location being interpolated towards. */
|
|
427
|
+
readonly to: TValue;
|
|
428
|
+
/** */
|
|
429
|
+
readonly pathTarget?: TValue;
|
|
430
|
+
/** Epoch millisecond when the interpolation started, or -1 when uninitialized. */
|
|
435
431
|
startTimestamp: number;
|
|
436
432
|
}
|
|
437
433
|
export interface DistanceInterpolationEvaluationParams {
|
|
438
|
-
readonly state:
|
|
434
|
+
readonly state: SpriteInterpolationState<number>;
|
|
439
435
|
readonly timestamp: number;
|
|
440
436
|
}
|
|
441
437
|
export interface DistanceInterpolationEvaluationResult {
|
|
@@ -444,7 +440,7 @@ export interface DistanceInterpolationEvaluationResult {
|
|
|
444
440
|
readonly effectiveStartTimestamp: number;
|
|
445
441
|
}
|
|
446
442
|
export interface DegreeInterpolationEvaluationParams {
|
|
447
|
-
readonly state:
|
|
443
|
+
readonly state: SpriteInterpolationState<number>;
|
|
448
444
|
readonly timestamp: number;
|
|
449
445
|
}
|
|
450
446
|
export interface DegreeInterpolationEvaluationResult {
|
|
@@ -453,7 +449,7 @@ export interface DegreeInterpolationEvaluationResult {
|
|
|
453
449
|
readonly effectiveStartTimestamp: number;
|
|
454
450
|
}
|
|
455
451
|
export interface SpriteInterpolationEvaluationParams {
|
|
456
|
-
readonly state: SpriteInterpolationState
|
|
452
|
+
readonly state: SpriteInterpolationState<SpriteLocation>;
|
|
457
453
|
readonly timestamp: number;
|
|
458
454
|
}
|
|
459
455
|
export interface SpriteInterpolationEvaluationResult {
|
|
@@ -461,10 +457,6 @@ export interface SpriteInterpolationEvaluationResult {
|
|
|
461
457
|
readonly completed: boolean;
|
|
462
458
|
readonly effectiveStartTimestamp: number;
|
|
463
459
|
}
|
|
464
|
-
/**
|
|
465
|
-
* Alias for the interpolation state used internally by sprites.
|
|
466
|
-
*/
|
|
467
|
-
export type InternalSpriteInterpolationState = SpriteInterpolationState;
|
|
468
460
|
/**
|
|
469
461
|
* Texture filtering parameters resolved from the public options structure.
|
|
470
462
|
*/
|
|
@@ -555,40 +547,37 @@ export type Canvas2DContext = CanvasRenderingContext2D | OffscreenCanvasRenderin
|
|
|
555
547
|
* Canvas sources supported when rendering text glyphs.
|
|
556
548
|
*/
|
|
557
549
|
export type Canvas2DSource = HTMLCanvasElement | OffscreenCanvas;
|
|
550
|
+
/** Line definition resolved for rendering. */
|
|
551
|
+
export interface ResolvedSpriteImageLineAttribute extends SpriteImageLineAttributeState {
|
|
552
|
+
readonly rgba: RgbaColor;
|
|
553
|
+
}
|
|
558
554
|
/**
|
|
559
555
|
* Base attributes for an image that composes a sprite.
|
|
560
556
|
*/
|
|
561
|
-
export interface InternalSpriteImageState {
|
|
557
|
+
export interface InternalSpriteImageState extends SpriteImageState {
|
|
562
558
|
subLayer: number;
|
|
563
559
|
order: number;
|
|
564
560
|
imageId: string;
|
|
565
561
|
imageHandle: number;
|
|
566
562
|
mode: SpriteMode;
|
|
567
|
-
opacity:
|
|
563
|
+
opacity: MutableSpriteInterpolatedValues<number>;
|
|
564
|
+
lodOpacity: number;
|
|
568
565
|
scale: number;
|
|
569
566
|
anchor: Readonly<SpriteAnchor>;
|
|
567
|
+
border: ResolvedSpriteImageLineAttribute | undefined;
|
|
568
|
+
borderPixelWidth: number;
|
|
569
|
+
leaderLine: ResolvedSpriteImageLineAttribute | undefined;
|
|
570
|
+
leaderLinePixelWidth: number;
|
|
570
571
|
offset: MutableSpriteImageInterpolatedOffset;
|
|
571
|
-
rotateDeg:
|
|
572
|
+
rotateDeg: MutableSpriteInterpolatedValues<number>;
|
|
572
573
|
rotationCommandDeg: number;
|
|
573
574
|
displayedRotateDeg: number;
|
|
574
575
|
autoRotation: boolean;
|
|
575
576
|
autoRotationMinDistanceMeters: number;
|
|
576
577
|
resolvedBaseRotateDeg: number;
|
|
577
|
-
originLocation
|
|
578
|
+
originLocation: Readonly<SpriteImageOriginLocation> | undefined;
|
|
578
579
|
originReferenceKey: SpriteOriginReferenceKey;
|
|
579
580
|
originRenderTargetIndex: SpriteOriginReferenceIndex;
|
|
580
|
-
rotationInterpolationState: Readonly<DegreeInterpolationState> | null;
|
|
581
|
-
rotationInterpolationOptions: Readonly<SpriteInterpolationOptions> | null;
|
|
582
|
-
offsetDegInterpolationState: Readonly<DegreeInterpolationState> | null;
|
|
583
|
-
offsetMetersInterpolationState: Readonly<DistanceInterpolationState> | null;
|
|
584
|
-
opacityInterpolationState: Readonly<DistanceInterpolationState> | null;
|
|
585
|
-
opacityInterpolationOptions: Readonly<SpriteInterpolationOptions> | null;
|
|
586
|
-
opacityTargetValue: number;
|
|
587
|
-
lodLastCommandOpacity: number;
|
|
588
|
-
lastCommandRotateDeg: number;
|
|
589
|
-
lastCommandOffsetDeg: number;
|
|
590
|
-
lastCommandOffsetMeters: number;
|
|
591
|
-
lastCommandOpacity: number;
|
|
592
581
|
interpolationDirty: boolean;
|
|
593
582
|
surfaceShaderInputs?: Readonly<SurfaceShaderInputs>;
|
|
594
583
|
hitTestCorners?: [
|
|
@@ -606,14 +595,13 @@ export interface InternalSpriteCurrentState<TTag> {
|
|
|
606
595
|
handle: IdHandle;
|
|
607
596
|
isEnabled: boolean;
|
|
608
597
|
visibilityDistanceMeters?: number;
|
|
609
|
-
|
|
598
|
+
opacityMultiplier: number;
|
|
599
|
+
location: MutableSpriteInterpolatedValues<SpriteLocation>;
|
|
610
600
|
images: Map<number, Map<number, InternalSpriteImageState>>;
|
|
611
601
|
tag: TTag | null;
|
|
612
|
-
interpolationState: InternalSpriteInterpolationState | null;
|
|
613
|
-
pendingInterpolationOptions: SpriteInterpolationOptions | null;
|
|
614
|
-
lastCommandLocation: Readonly<SpriteLocation>;
|
|
615
602
|
lastAutoRotationLocation: Readonly<SpriteLocation>;
|
|
616
603
|
lastAutoRotationAngleDeg: number;
|
|
604
|
+
autoRotationInvalidated: boolean;
|
|
617
605
|
interpolationDirty: boolean;
|
|
618
606
|
cachedMercator: Readonly<SpriteMercatorCoordinate>;
|
|
619
607
|
cachedMercatorLng: number;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.17.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: 9fe9aa30db6602d13643e32c94af39ae2b26b082
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteInterpolationOptions } from '../types';
|
|
12
|
-
import {
|
|
12
|
+
import { DegreeInterpolationEvaluationResult, InternalSpriteImageState, MutableSpriteInterpolation, SpriteInterpolationState } from '../internalTypes';
|
|
13
13
|
/**
|
|
14
14
|
* Parameters required to construct a {@link DegreeInterpolationState}.
|
|
15
|
-
* @property {number} currentValue - Current numeric value rendered on screen.
|
|
16
|
-
* @property {number} targetValue - Desired value after interpolation completes.
|
|
17
|
-
* @property {number | undefined} previousCommandValue - Prior commanded value used for feed-forward prediction.
|
|
18
|
-
* @property {SpriteInterpolationOptions} options - Timing and easing configuration.
|
|
19
15
|
*/
|
|
20
16
|
export interface CreateDegreeInterpolationStateParams {
|
|
17
|
+
/** Current numeric value rendered on screen. */
|
|
21
18
|
currentValue: number;
|
|
19
|
+
/** Desired value after interpolation completes. */
|
|
22
20
|
targetValue: number;
|
|
21
|
+
/** Prior commanded value used for feed-forward prediction. */
|
|
23
22
|
previousCommandValue?: number;
|
|
23
|
+
/** Timing and easing configuration. */
|
|
24
24
|
options: SpriteInterpolationOptions;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Result returned by {@link createDegreeInterpolationState} containing state and a flag for activation.
|
|
28
|
-
* @property {DegreeInterpolationState} state - Resolved state object.
|
|
29
|
-
* @property {boolean} requiresInterpolation - Indicates whether the caller should animate or snap.
|
|
30
28
|
*/
|
|
31
29
|
export interface CreateDegreeInterpolationStateResult {
|
|
32
|
-
|
|
30
|
+
/** Resolved state object. */
|
|
31
|
+
readonly state: SpriteInterpolationState<number>;
|
|
32
|
+
/** Indicates whether the caller should animate or snap. */
|
|
33
33
|
readonly requiresInterpolation: boolean;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
@@ -40,22 +40,22 @@ export interface CreateDegreeInterpolationStateResult {
|
|
|
40
40
|
export declare const createDegreeInterpolationState: (params: CreateDegreeInterpolationStateParams) => CreateDegreeInterpolationStateResult;
|
|
41
41
|
/**
|
|
42
42
|
* Parameters describing interpolation evaluation state.
|
|
43
|
-
* @property {DegreeInterpolationState} state - State generated via {@link createDegreeInterpolationState}.
|
|
44
|
-
* @property {number} timestamp - Timestamp in milliseconds used to sample the interpolation curve.
|
|
45
43
|
*/
|
|
46
44
|
export interface EvaluateDegreeInterpolationParams {
|
|
47
|
-
|
|
45
|
+
/** State generated via {@link createDegreeInterpolationState}. */
|
|
46
|
+
state: SpriteInterpolationState<number>;
|
|
47
|
+
/** Timestamp in milliseconds used to sample the interpolation curve. */
|
|
48
48
|
timestamp: number;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
51
|
* Result of evaluating a numeric interpolation at a specific timestamp.
|
|
52
|
-
* @property {number} value - Current interpolated value (or final value after completion).
|
|
53
|
-
* @property {boolean} completed - Indicates whether interpolation reached the end.
|
|
54
|
-
* @property {number} effectiveStartTimestamp - Start timestamp applied during evaluation.
|
|
55
52
|
*/
|
|
56
53
|
export interface EvaluateDegreeInterpolationResult {
|
|
54
|
+
/** Current interpolated value (or final value after completion). */
|
|
57
55
|
readonly value: number;
|
|
56
|
+
/** Indicates whether interpolation reached the end. */
|
|
58
57
|
readonly completed: boolean;
|
|
58
|
+
/** Start timestamp applied during evaluation. */
|
|
59
59
|
readonly effectiveStartTimestamp: number;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -64,9 +64,8 @@ export interface EvaluateDegreeInterpolationResult {
|
|
|
64
64
|
* @returns {EvaluateDegreeInterpolationResult} Current value, completion flag, and effective start time.
|
|
65
65
|
*/
|
|
66
66
|
export declare const evaluateDegreeInterpolation: (params: EvaluateDegreeInterpolationParams) => EvaluateDegreeInterpolationResult;
|
|
67
|
-
type DegreeInterpolationStateKey = 'rotationInterpolationState' | 'offsetDegInterpolationState';
|
|
68
67
|
interface DegreeInterpolationChannelDescriptor {
|
|
69
|
-
readonly
|
|
68
|
+
readonly resolveInterpolation: (image: InternalSpriteImageState) => MutableSpriteInterpolation<number>;
|
|
70
69
|
readonly normalize?: (value: number) => number;
|
|
71
70
|
readonly applyValue: (image: InternalSpriteImageState, value: number) => void;
|
|
72
71
|
readonly applyFinalValue?: (image: InternalSpriteImageState, value: number) => void;
|
|
@@ -74,7 +73,7 @@ interface DegreeInterpolationChannelDescriptor {
|
|
|
74
73
|
export interface DegreeInterpolationWorkItem {
|
|
75
74
|
readonly descriptor: DegreeInterpolationChannelDescriptor;
|
|
76
75
|
readonly image: InternalSpriteImageState;
|
|
77
|
-
readonly state:
|
|
76
|
+
readonly state: SpriteInterpolationState<number>;
|
|
78
77
|
}
|
|
79
78
|
export declare const collectDegreeInterpolationWorkItems: (image: InternalSpriteImageState, workItems: DegreeInterpolationWorkItem[]) => void;
|
|
80
79
|
export declare const applyDegreeInterpolationEvaluations: (workItems: readonly DegreeInterpolationWorkItem[], evaluations: readonly DegreeInterpolationEvaluationResult[], timestamp: number) => boolean;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.17.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: 9fe9aa30db6602d13643e32c94af39ae2b26b082
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteInterpolationOptions } from '../types';
|
|
12
|
-
import { DistanceInterpolationEvaluationParams, DistanceInterpolationEvaluationResult,
|
|
12
|
+
import { DistanceInterpolationEvaluationParams, DistanceInterpolationEvaluationResult, InternalSpriteImageState, MutableSpriteInterpolation, SpriteInterpolationState } from '../internalTypes';
|
|
13
13
|
export interface CreateDistanceInterpolationStateParams {
|
|
14
14
|
currentValue: number;
|
|
15
15
|
targetValue: number;
|
|
@@ -17,14 +17,13 @@ export interface CreateDistanceInterpolationStateParams {
|
|
|
17
17
|
options: SpriteInterpolationOptions;
|
|
18
18
|
}
|
|
19
19
|
export interface CreateDistanceInterpolationStateResult {
|
|
20
|
-
readonly state:
|
|
20
|
+
readonly state: SpriteInterpolationState<number>;
|
|
21
21
|
readonly requiresInterpolation: boolean;
|
|
22
22
|
}
|
|
23
23
|
export declare const createDistanceInterpolationState: (params: CreateDistanceInterpolationStateParams) => CreateDistanceInterpolationStateResult;
|
|
24
24
|
export declare const evaluateDistanceInterpolation: (params: DistanceInterpolationEvaluationParams) => DistanceInterpolationEvaluationResult;
|
|
25
|
-
type DistanceInterpolationStateKey = 'offsetMetersInterpolationState' | 'opacityInterpolationState';
|
|
26
25
|
interface DistanceInterpolationChannelDescriptor {
|
|
27
|
-
readonly
|
|
26
|
+
readonly resolveInterpolation: (image: InternalSpriteImageState) => MutableSpriteInterpolation<number>;
|
|
28
27
|
readonly normalize?: (value: number) => number;
|
|
29
28
|
readonly applyValue: (image: InternalSpriteImageState, value: number) => void;
|
|
30
29
|
readonly applyFinalValue?: (image: InternalSpriteImageState, value: number) => void;
|
|
@@ -35,7 +34,7 @@ export type DistanceInterpolationChannelName = keyof DistanceInterpolationChanne
|
|
|
35
34
|
export interface DistanceInterpolationWorkItem {
|
|
36
35
|
readonly descriptor: DistanceInterpolationChannelDescriptorMap[DistanceInterpolationChannelName];
|
|
37
36
|
readonly image: InternalSpriteImageState;
|
|
38
|
-
readonly state:
|
|
37
|
+
readonly state: SpriteInterpolationState<number>;
|
|
39
38
|
}
|
|
40
39
|
export interface CollectDistanceInterpolationWorkItemOptions {
|
|
41
40
|
readonly includeOffsetMeters?: boolean;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.17.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: 9fe9aa30db6602d13643e32c94af39ae2b26b082
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { EasingFunction
|
|
11
|
+
import { EasingFunction } from '../internalTypes';
|
|
12
|
+
import { SpriteEasingParam } from '../types';
|
|
12
13
|
/**
|
|
13
14
|
* Linear interpolation that clamps the value to the [0, 1] range.
|
|
14
15
|
*/
|
|
15
16
|
export declare const linearEasing: EasingFunction;
|
|
16
17
|
export interface ResolvedEasing {
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
18
|
+
readonly param: SpriteEasingParam;
|
|
19
|
+
readonly func: EasingFunction;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
22
|
+
* Resolves an easing definition into its implementation, defaulting to linear when unspecified or unknown.
|
|
23
|
+
* @param easing - Easing parameter.
|
|
24
|
+
* @return Resolved easing parameters.
|
|
23
25
|
*/
|
|
24
|
-
export declare const resolveEasing: (easing?:
|
|
26
|
+
export declare const resolveEasing: (easing?: SpriteEasingParam) => ResolvedEasing;
|
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.17.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: 9fe9aa30db6602d13643e32c94af39ae2b26b082
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteInterpolationOptions, SpriteLocation } from '../types';
|
|
12
|
-
import {
|
|
12
|
+
import { SpriteInterpolationEvaluationParams, SpriteInterpolationEvaluationResult, SpriteInterpolationState } from '../internalTypes';
|
|
13
13
|
/**
|
|
14
14
|
* Parameters required to create a fresh interpolation state for the next animation segment.
|
|
15
|
-
*
|
|
16
|
-
* @property currentLocation - Sprite location currently rendered on screen.
|
|
17
|
-
* @property lastCommandLocation - Previously commanded target, used for feedforward extrapolation.
|
|
18
|
-
* @property nextCommandLocation - Upcoming commanded target that the sprite should reach.
|
|
19
|
-
* @property options - Raw interpolation options supplied by the caller.
|
|
20
15
|
*/
|
|
21
16
|
export interface CreateInterpolationStateParams {
|
|
17
|
+
/** Sprite location currently rendered on screen. */
|
|
22
18
|
currentLocation: SpriteLocation;
|
|
19
|
+
/** Previously commanded target, used for feedforward extrapolation. */
|
|
23
20
|
lastCommandLocation?: SpriteLocation;
|
|
21
|
+
/** Upcoming commanded target that the sprite should reach. */
|
|
24
22
|
nextCommandLocation: SpriteLocation;
|
|
23
|
+
/** Raw interpolation options supplied by the caller. */
|
|
25
24
|
options: SpriteInterpolationOptions;
|
|
26
25
|
}
|
|
27
26
|
/**
|
|
28
27
|
* Result of preparing interpolation state, including a flag denoting whether any lerp is needed.
|
|
29
|
-
*
|
|
30
|
-
* @property state - Prepared interpolation state ready for evaluation.
|
|
31
|
-
* @property requiresInterpolation - Indicates whether lerping is needed or an immediate snap is sufficient.
|
|
32
28
|
*/
|
|
33
29
|
export interface CreateInterpolationStateResult {
|
|
34
|
-
|
|
30
|
+
/** Prepared interpolation state ready for evaluation. */
|
|
31
|
+
readonly state: SpriteInterpolationState<SpriteLocation>;
|
|
32
|
+
/** Indicates whether lerping is needed or an immediate snap is sufficient. */
|
|
35
33
|
readonly requiresInterpolation: boolean;
|
|
36
34
|
}
|
|
37
35
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.17.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: 9fe9aa30db6602d13643e32c94af39ae2b26b082
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteInterpolationOptions, SpriteImageOffset } from '../types';
|
|
@@ -26,7 +26,8 @@ export declare const clearOffsetMetersInterpolation: (image: InternalSpriteImage
|
|
|
26
26
|
* Clears any running opacity interpolation.
|
|
27
27
|
*/
|
|
28
28
|
export declare const clearOpacityInterpolation: (image: InternalSpriteImageState) => void;
|
|
29
|
-
export declare const applyOpacityUpdate: (image: InternalSpriteImageState, nextOpacity: number, interpolationOptions?: SpriteInterpolationOptions | null) => void;
|
|
29
|
+
export declare const applyOpacityUpdate: (image: InternalSpriteImageState, nextOpacity: number, interpolationOptions?: SpriteInterpolationOptions | null, spriteOpacityMultiplier?: number) => void;
|
|
30
|
+
export declare const applyResolvedOpacityTarget: (image: InternalSpriteImageState, resolvedTarget: number, interpolationOptions?: SpriteInterpolationOptions | null) => void;
|
|
30
31
|
export type ImageInterpolationStepperId = 'rotation' | 'offsetDeg' | 'offsetMeters' | 'opacity';
|
|
31
32
|
/**
|
|
32
33
|
* Executes all interpolation steppers for an image and reports whether any remain active.
|
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.17.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: 9fe9aa30db6602d13643e32c94af39ae2b26b082
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteInterpolationOptions } from '../types';
|
|
12
|
-
import {
|
|
12
|
+
import { SpriteInterpolationState } from '../internalTypes';
|
|
13
13
|
export { normalizeAngleDeg } from '../utils/math';
|
|
14
14
|
/**
|
|
15
15
|
* Parameters describing the rotation update request.
|
|
16
|
-
* @property {number} currentAngleDeg - Current angle already applied to the sprite in degrees.
|
|
17
|
-
* @property {number} targetAngleDeg - Desired angle in degrees that should be reached.
|
|
18
|
-
* @property {number | undefined} previousCommandAngleDeg - Previous commanded angle for feed-forward prediction.
|
|
19
|
-
* @property {SpriteInterpolationOptions | null} [options] - Optional interpolation configuration.
|
|
20
16
|
*/
|
|
21
17
|
export interface ResolveRotationTargetParams {
|
|
18
|
+
/** Current angle already applied to the sprite in degrees. */
|
|
22
19
|
currentAngleDeg: number;
|
|
20
|
+
/** Desired angle in degrees that should be reached. */
|
|
23
21
|
targetAngleDeg: number;
|
|
22
|
+
/** Previous commanded angle for feed-forward prediction. */
|
|
24
23
|
previousCommandAngleDeg?: number;
|
|
24
|
+
/** Optional interpolation configuration. */
|
|
25
25
|
options?: SpriteInterpolationOptions | null;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Result produced by {@link resolveRotationTarget} when determining the next rotation step.
|
|
29
|
-
* @property {number} nextAngleDeg - Angle that should be applied immediately.
|
|
30
|
-
* @property {DegreeInterpolationState | null} interpolationState - Optional state for animating toward the target.
|
|
31
29
|
*/
|
|
32
30
|
export interface ResolveRotationTargetResult {
|
|
31
|
+
/** Angle that should be applied immediately. */
|
|
33
32
|
readonly nextAngleDeg: number;
|
|
34
|
-
|
|
33
|
+
/** Optional state for animating toward the target. */
|
|
34
|
+
readonly interpolationState: SpriteInterpolationState<number> | null;
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Determines whether a rotation change requires interpolation and, if so, produces the state to drive it.
|