maplibre-gl-layers 0.16.0 → 0.18.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 +3 -3
- package/dist/config.d.ts +2 -2
- package/dist/const.d.ts +26 -2
- package/dist/default.d.ts +2 -2
- package/dist/gl/atlas.d.ts +2 -2
- package/dist/gl/hitTest.d.ts +2 -2
- package/dist/gl/shader.d.ts +3 -4
- package/dist/gl/text.d.ts +2 -2
- package/dist/host/calculationHost.d.ts +2 -2
- package/dist/host/mapLibreProjectionHost.d.ts +2 -2
- package/dist/host/projectionHost.d.ts +2 -2
- package/dist/host/runtime.d.ts +2 -2
- package/dist/host/wasmCalculationHost.d.ts +2 -2
- package/dist/host/wasmHost.d.ts +3 -3
- package/dist/host/wasmProjectionHost.d.ts +2 -2
- package/dist/index.cjs +606 -499
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +606 -499
- package/dist/index.mjs.map +1 -1
- package/dist/internalTypes.d.ts +56 -83
- package/dist/interpolation/degreeInterpolation.d.ts +18 -19
- package/dist/interpolation/distanceInterpolation.d.ts +6 -7
- package/dist/interpolation/easing.d.ts +9 -7
- 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 +137 -137
- package/dist/utils/color.d.ts +3 -8
- package/dist/utils/image.d.ts +2 -2
- package/dist/utils/looseQuadTree.d.ts +2 -2
- package/dist/utils/math.d.ts +68 -75
- package/dist/utils/utils.d.ts +2 -2
- package/dist/wasm/config.json.d.ts +2 -2
- package/package.json +6 -6
package/dist/internalTypes.d.ts
CHANGED
|
@@ -1,17 +1,30 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.18.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: ca8392c8aa3aae7e0e4e3c871e195d49b125e481
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { SpriteMode, SpriteAnchor, SpriteInterpolationOptions, SpriteImageOriginLocation, SpriteLocation, SpriteTextGlyphHorizontalAlign, SpriteTextureMagFilter, SpriteTextureMinFilter, SpriteInterpolationMode, SpriteScreenPoint, SpritePoint,
|
|
12
|
-
import { EasingFunction } from './interpolation/easing';
|
|
11
|
+
import { SpriteMode, SpriteAnchor, SpriteInterpolationOptions, SpriteImageOriginLocation, SpriteLocation, SpriteTextGlyphHorizontalAlign, SpriteTextureMagFilter, SpriteTextureMinFilter, SpriteInterpolationMode, SpriteScreenPoint, SpritePoint, SpriteEasingParam, SpriteImageLineAttributeState, SpriteImageState, SpriteInterpolatedValues, SpriteImageInterpolatedOffset } from './types';
|
|
13
12
|
import { ResolvedSpriteScalingOptions, SurfaceCorner } from './utils/math';
|
|
14
|
-
|
|
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
|
+
}
|
|
15
28
|
/**
|
|
16
29
|
* The handle value that using the instance.
|
|
17
30
|
*/
|
|
@@ -159,33 +172,30 @@ export interface RenderTargetBucketBuffers {
|
|
|
159
172
|
readonly originTargetIndices: Int32Array;
|
|
160
173
|
}
|
|
161
174
|
/**
|
|
162
|
-
*
|
|
163
|
-
* `MercatorCoordinate` uses the web mercator projection ([EPSG:3857](https://epsg.io/3857)) with slightly different units:
|
|
164
|
-
* - the size of 1 unit is the width of the projected world instead of the "mercator meter"
|
|
165
|
-
* - the origin of the coordinate space is at the north-west corner instead of the middle
|
|
175
|
+
* Mutable interpolation states.
|
|
166
176
|
*/
|
|
167
|
-
export interface
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
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;
|
|
171
183
|
}
|
|
172
184
|
/**
|
|
173
185
|
* Mutable counterpart to {@link SpriteInterpolatedValues}, used internally so SpriteLayer
|
|
174
186
|
* can reuse object references while still exposing readonly snapshots publicly.
|
|
175
187
|
*/
|
|
176
|
-
export interface MutableSpriteInterpolatedValues<
|
|
177
|
-
current:
|
|
178
|
-
from:
|
|
179
|
-
to:
|
|
188
|
+
export interface MutableSpriteInterpolatedValues<TValue> extends SpriteInterpolatedValues<TValue> {
|
|
189
|
+
current: TValue;
|
|
190
|
+
from: TValue | undefined;
|
|
191
|
+
to: TValue | undefined;
|
|
180
192
|
invalidated: boolean | undefined;
|
|
193
|
+
interpolation: MutableSpriteInterpolation<TValue>;
|
|
181
194
|
}
|
|
182
195
|
export interface MutableSpriteImageInterpolatedOffset extends SpriteImageInterpolatedOffset {
|
|
183
196
|
offsetMeters: MutableSpriteInterpolatedValues<number>;
|
|
184
197
|
offsetDeg: MutableSpriteInterpolatedValues<number>;
|
|
185
198
|
}
|
|
186
|
-
export interface Releasable {
|
|
187
|
-
readonly release: () => void;
|
|
188
|
-
}
|
|
189
199
|
/**
|
|
190
200
|
* Mimimum abstraction that exposes projection-related helpers.
|
|
191
201
|
*/
|
|
@@ -394,55 +404,34 @@ export interface SurfaceShaderInputs {
|
|
|
394
404
|
readonly w: number;
|
|
395
405
|
}>;
|
|
396
406
|
}
|
|
407
|
+
/**
|
|
408
|
+
* Easing function type.
|
|
409
|
+
*/
|
|
410
|
+
export type EasingFunction = (progress: number) => number;
|
|
397
411
|
/**
|
|
398
412
|
* Runtime state describing the active interpolation between two sprite locations.
|
|
399
413
|
* Consumers reuse the same state across ticks to avoid re-allocations while animation is running.
|
|
400
|
-
*
|
|
401
|
-
* @property mode - Strategy used to resolve the target location (feedback or feedforward).
|
|
402
|
-
* @property durationMs - Total time allocated for the interpolation in milliseconds.
|
|
403
|
-
* @property easing - Resolved easing function applied to raw progress values.
|
|
404
|
-
* @property startTimestamp - Epoch millisecond when the interpolation started, or -1 when uninitialized.
|
|
405
|
-
* @property from - Origin sprite location cloned from the current render state.
|
|
406
|
-
* @property to - Destination sprite location being interpolated towards.
|
|
407
|
-
*/
|
|
408
|
-
export interface SpriteInterpolationState {
|
|
409
|
-
readonly mode: SpriteInterpolationMode;
|
|
410
|
-
readonly durationMs: number;
|
|
411
|
-
readonly easing: EasingFunction;
|
|
412
|
-
readonly easingPreset: SpriteEasing;
|
|
413
|
-
startTimestamp: number;
|
|
414
|
-
readonly from: SpriteLocation;
|
|
415
|
-
readonly to: SpriteLocation;
|
|
416
|
-
}
|
|
417
|
-
/**
|
|
418
|
-
* Runtime state tracked for numeric interpolations.
|
|
419
|
-
* @property {number} durationMs - Total duration of the interpolation in milliseconds.
|
|
420
|
-
* @property {EasingFunction} easing - Easing function applied to progress samples.
|
|
421
|
-
* @property {number} from - Start value used for interpolation.
|
|
422
|
-
* @property {number} to - Adjusted target along the shortest rotation path.
|
|
423
|
-
* @property {number} finalValue - Caller-requested final value (used once interpolation completes).
|
|
424
|
-
* @property {number} startTimestamp - Timestamp when interpolation began, `-1` until evaluation starts.
|
|
425
414
|
*/
|
|
426
|
-
export interface
|
|
427
|
-
|
|
428
|
-
readonly
|
|
429
|
-
|
|
430
|
-
readonly from: number;
|
|
431
|
-
readonly to: number;
|
|
432
|
-
readonly finalValue: number;
|
|
433
|
-
startTimestamp: number;
|
|
434
|
-
}
|
|
435
|
-
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. */
|
|
436
419
|
readonly durationMs: number;
|
|
437
|
-
|
|
438
|
-
readonly
|
|
439
|
-
|
|
440
|
-
readonly
|
|
441
|
-
|
|
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. */
|
|
442
431
|
startTimestamp: number;
|
|
443
432
|
}
|
|
444
433
|
export interface DistanceInterpolationEvaluationParams {
|
|
445
|
-
readonly state:
|
|
434
|
+
readonly state: SpriteInterpolationState<number>;
|
|
446
435
|
readonly timestamp: number;
|
|
447
436
|
}
|
|
448
437
|
export interface DistanceInterpolationEvaluationResult {
|
|
@@ -451,7 +440,7 @@ export interface DistanceInterpolationEvaluationResult {
|
|
|
451
440
|
readonly effectiveStartTimestamp: number;
|
|
452
441
|
}
|
|
453
442
|
export interface DegreeInterpolationEvaluationParams {
|
|
454
|
-
readonly state:
|
|
443
|
+
readonly state: SpriteInterpolationState<number>;
|
|
455
444
|
readonly timestamp: number;
|
|
456
445
|
}
|
|
457
446
|
export interface DegreeInterpolationEvaluationResult {
|
|
@@ -460,7 +449,7 @@ export interface DegreeInterpolationEvaluationResult {
|
|
|
460
449
|
readonly effectiveStartTimestamp: number;
|
|
461
450
|
}
|
|
462
451
|
export interface SpriteInterpolationEvaluationParams {
|
|
463
|
-
readonly state: SpriteInterpolationState
|
|
452
|
+
readonly state: SpriteInterpolationState<SpriteLocation>;
|
|
464
453
|
readonly timestamp: number;
|
|
465
454
|
}
|
|
466
455
|
export interface SpriteInterpolationEvaluationResult {
|
|
@@ -468,10 +457,6 @@ export interface SpriteInterpolationEvaluationResult {
|
|
|
468
457
|
readonly completed: boolean;
|
|
469
458
|
readonly effectiveStartTimestamp: number;
|
|
470
459
|
}
|
|
471
|
-
/**
|
|
472
|
-
* Alias for the interpolation state used internally by sprites.
|
|
473
|
-
*/
|
|
474
|
-
export type InternalSpriteInterpolationState = SpriteInterpolationState;
|
|
475
460
|
/**
|
|
476
461
|
* Texture filtering parameters resolved from the public options structure.
|
|
477
462
|
*/
|
|
@@ -576,6 +561,7 @@ export interface InternalSpriteImageState extends SpriteImageState {
|
|
|
576
561
|
imageHandle: number;
|
|
577
562
|
mode: SpriteMode;
|
|
578
563
|
opacity: MutableSpriteInterpolatedValues<number>;
|
|
564
|
+
lodOpacity: number;
|
|
579
565
|
scale: number;
|
|
580
566
|
anchor: Readonly<SpriteAnchor>;
|
|
581
567
|
border: ResolvedSpriteImageLineAttribute | undefined;
|
|
@@ -592,18 +578,6 @@ export interface InternalSpriteImageState extends SpriteImageState {
|
|
|
592
578
|
originLocation: Readonly<SpriteImageOriginLocation> | undefined;
|
|
593
579
|
originReferenceKey: SpriteOriginReferenceKey;
|
|
594
580
|
originRenderTargetIndex: SpriteOriginReferenceIndex;
|
|
595
|
-
rotationInterpolationState: Readonly<DegreeInterpolationState> | null;
|
|
596
|
-
rotationInterpolationOptions: Readonly<SpriteInterpolationOptions> | null;
|
|
597
|
-
offsetDegInterpolationState: Readonly<DegreeInterpolationState> | null;
|
|
598
|
-
offsetMetersInterpolationState: Readonly<DistanceInterpolationState> | null;
|
|
599
|
-
opacityInterpolationState: Readonly<DistanceInterpolationState> | null;
|
|
600
|
-
opacityInterpolationOptions: Readonly<SpriteInterpolationOptions> | null;
|
|
601
|
-
opacityTargetValue: number;
|
|
602
|
-
lodLastCommandOpacity: number;
|
|
603
|
-
lastCommandRotateDeg: number;
|
|
604
|
-
lastCommandOffsetDeg: number;
|
|
605
|
-
lastCommandOffsetMeters: number;
|
|
606
|
-
lastCommandOpacity: number;
|
|
607
581
|
interpolationDirty: boolean;
|
|
608
582
|
surfaceShaderInputs?: Readonly<SurfaceShaderInputs>;
|
|
609
583
|
hitTestCorners?: [
|
|
@@ -621,14 +595,13 @@ export interface InternalSpriteCurrentState<TTag> {
|
|
|
621
595
|
handle: IdHandle;
|
|
622
596
|
isEnabled: boolean;
|
|
623
597
|
visibilityDistanceMeters?: number;
|
|
624
|
-
|
|
598
|
+
opacityMultiplier: number;
|
|
599
|
+
location: MutableSpriteInterpolatedValues<SpriteLocation>;
|
|
625
600
|
images: Map<number, Map<number, InternalSpriteImageState>>;
|
|
626
601
|
tag: TTag | null;
|
|
627
|
-
interpolationState: InternalSpriteInterpolationState | null;
|
|
628
|
-
pendingInterpolationOptions: SpriteInterpolationOptions | null;
|
|
629
|
-
lastCommandLocation: Readonly<SpriteLocation>;
|
|
630
602
|
lastAutoRotationLocation: Readonly<SpriteLocation>;
|
|
631
603
|
lastAutoRotationAngleDeg: number;
|
|
604
|
+
autoRotationInvalidated: boolean;
|
|
632
605
|
interpolationDirty: boolean;
|
|
633
606
|
cachedMercator: Readonly<SpriteMercatorCoordinate>;
|
|
634
607
|
cachedMercatorLng: number;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.18.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: ca8392c8aa3aae7e0e4e3c871e195d49b125e481
|
|
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.18.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: ca8392c8aa3aae7e0e4e3c871e195d49b125e481
|
|
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.18.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: ca8392c8aa3aae7e0e4e3c871e195d49b125e481
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
|
|
11
|
+
import { EasingFunction } from '../internalTypes';
|
|
12
|
+
import { SpriteEasingParam } from '../types';
|
|
13
13
|
/**
|
|
14
14
|
* Linear interpolation that clamps the value to the [0, 1] range.
|
|
15
15
|
*/
|
|
16
16
|
export declare const linearEasing: EasingFunction;
|
|
17
17
|
export interface ResolvedEasing {
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
18
|
+
readonly param: SpriteEasingParam;
|
|
19
|
+
readonly func: EasingFunction;
|
|
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.18.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: ca8392c8aa3aae7e0e4e3c871e195d49b125e481
|
|
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.18.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: ca8392c8aa3aae7e0e4e3c871e195d49b125e481
|
|
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.18.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: ca8392c8aa3aae7e0e4e3c871e195d49b125e481
|
|
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.
|