maplibre-gl-layers 0.13.0 → 0.15.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.
Files changed (40) hide show
  1. package/README.md +3 -3
  2. package/dist/SpriteLayer.d.ts +3 -27
  3. package/dist/config.d.ts +10 -2
  4. package/dist/const.d.ts +3 -3
  5. package/dist/default.d.ts +2 -2
  6. package/dist/gl/atlas.d.ts +64 -0
  7. package/dist/gl/hitTest.d.ts +54 -0
  8. package/dist/{shader.d.ts → gl/shader.d.ts} +22 -4
  9. package/dist/gl/text.d.ts +17 -0
  10. package/dist/{calculationHost.d.ts → host/calculationHost.d.ts} +26 -4
  11. package/dist/{mapLibreProjectionHost.d.ts → host/mapLibreProjectionHost.d.ts} +3 -3
  12. package/dist/{projectionHost.d.ts → host/projectionHost.d.ts} +5 -4
  13. package/dist/host/runtime.d.ts +38 -0
  14. package/dist/{wasmCalculationHost.d.ts → host/wasmCalculationHost.d.ts} +14 -14
  15. package/dist/{wasmHost.d.ts → host/wasmHost.d.ts} +14 -8
  16. package/dist/{wasmProjectionHost.d.ts → host/wasmProjectionHost.d.ts} +3 -3
  17. package/dist/index.cjs +7117 -4673
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.ts +4 -3
  20. package/dist/index.mjs +7117 -4673
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/internalTypes.d.ts +109 -15
  23. package/dist/{degreeInterpolation.d.ts → interpolation/degreeInterpolation.d.ts} +19 -4
  24. package/dist/interpolation/distanceInterpolation.d.ts +46 -0
  25. package/dist/{easing.d.ts → interpolation/easing.d.ts} +9 -4
  26. package/dist/{interpolation.d.ts → interpolation/interpolation.d.ts} +5 -27
  27. package/dist/{interpolationChannels.d.ts → interpolation/interpolationChannels.d.ts} +16 -7
  28. package/dist/{rotationInterpolation.d.ts → interpolation/rotationInterpolation.d.ts} +5 -10
  29. package/dist/types.d.ts +75 -26
  30. package/dist/{image.d.ts → utils/image.d.ts} +3 -3
  31. package/dist/{looseQuadTree.d.ts → utils/looseQuadTree.d.ts} +2 -2
  32. package/dist/{math.d.ts → utils/math.d.ts} +15 -4
  33. package/dist/{utils.d.ts → utils/utils.d.ts} +3 -3
  34. package/dist/wasm/config.json.d.ts +16 -0
  35. package/dist/wasm/offloads-nosimd.wasm +0 -0
  36. package/dist/wasm/offloads-simd-mt.js +2 -0
  37. package/dist/wasm/offloads-simd-mt.wasm +0 -0
  38. package/dist/wasm/offloads-simd.wasm +0 -0
  39. package/package.json +7 -9
  40. package/dist/distanceInterpolation.d.ts +0 -33
@@ -1,15 +1,15 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.13.0
3
+ * version: 0.15.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: 4934aa7f4fed93594ece419184b32b5b972bbb88
8
+ * git.commit.hash: d850b7e9c713f54f0630248dc4ea370721b6965b
9
9
  */
10
10
 
11
- import { SpriteMode, SpriteAnchor, SpriteImageOffset, SpriteInterpolationOptions, SpriteImageOriginLocation, SpriteLocation, SpriteTextGlyphHorizontalAlign, SpriteTextureMagFilter, SpriteTextureMinFilter, SpriteInterpolationMode, EasingFunction, SpriteScreenPoint, SpritePoint } from './types';
12
- import { ResolvedSpriteScalingOptions, SurfaceCorner } from './math';
11
+ import { SpriteMode, SpriteAnchor, SpriteInterpolationOptions, SpriteImageOriginLocation, SpriteLocation, SpriteTextGlyphHorizontalAlign, SpriteTextureMagFilter, SpriteTextureMinFilter, SpriteInterpolationMode, EasingFunction, SpriteScreenPoint, SpritePoint, SpriteEasingPresetName } from './types';
12
+ import { ResolvedSpriteScalingOptions, SurfaceCorner } from './utils/math';
13
13
  /**
14
14
  * The handle value that using the instance.
15
15
  */
@@ -167,13 +167,26 @@ export interface SpriteMercatorCoordinate {
167
167
  readonly y: number;
168
168
  readonly z: number;
169
169
  }
170
- export interface Releaseable {
170
+ /**
171
+ * Mutable counterpart to {@link InterpolatedValues}, used internally so SpriteLayer
172
+ * can reuse object references while still exposing readonly snapshots publicly.
173
+ */
174
+ export interface MutableInterpolatedValues<T> {
175
+ current: T;
176
+ from: T | undefined;
177
+ to: T | undefined;
178
+ }
179
+ export interface MutableSpriteImageInterpolatedOffset {
180
+ offsetMeters: MutableInterpolatedValues<number>;
181
+ offsetDeg: MutableInterpolatedValues<number>;
182
+ }
183
+ export interface Releasable {
171
184
  readonly release: () => void;
172
185
  }
173
186
  /**
174
187
  * Abstraction that exposes projection-related helpers.
175
188
  */
176
- export interface ProjectionHost extends Releaseable {
189
+ export interface ProjectionHost extends Releasable {
177
190
  /**
178
191
  * Get current zoom level.
179
192
  * @returns Zoom level.
@@ -209,6 +222,7 @@ export interface ProjectionHost extends Releaseable {
209
222
  * @returns The ratio.
210
223
  */
211
224
  readonly calculatePerspectiveRatio: (location: Readonly<SpriteLocation>, cachedMercator?: SpriteMercatorCoordinate) => number;
225
+ readonly getCameraLocation: () => SpriteLocation | null;
212
226
  }
213
227
  export interface PrepareDrawSpriteImageParamsBase {
214
228
  readonly imageResources: ImageResourceTable;
@@ -247,7 +261,8 @@ export interface PreparedDrawSpriteImageParams<T> {
247
261
  readonly imageEntry: InternalSpriteImageState;
248
262
  readonly imageResource: RegisteredImage;
249
263
  readonly vertexData: Float32Array;
250
- readonly opacity: number;
264
+ opacity: number;
265
+ readonly cameraDistanceMeters: number;
251
266
  readonly hitTestCorners: readonly [
252
267
  Readonly<SpriteScreenPoint>,
253
268
  Readonly<SpriteScreenPoint>,
@@ -273,13 +288,50 @@ export interface PreparedDrawSpriteImageParams<T> {
273
288
  readonly cos: number;
274
289
  } | null;
275
290
  }
291
+ /**
292
+ * Common frame parameters shared with interpolation processing.
293
+ */
294
+ export interface RenderInterpolationFrameContext {
295
+ readonly baseMetersPerPixel: number;
296
+ readonly spriteMinPixel: number;
297
+ readonly spriteMaxPixel: number;
298
+ }
299
+ /**
300
+ * Parameters consumed when processing sprite interpolations.
301
+ */
302
+ export interface RenderInterpolationParams<TTag> {
303
+ readonly sprites: readonly InternalSpriteCurrentState<TTag>[];
304
+ readonly timestamp: number;
305
+ readonly frameContext?: RenderInterpolationFrameContext;
306
+ }
307
+ /**
308
+ * Result produced by sprite interpolation processing.
309
+ */
310
+ export interface RenderInterpolationResult {
311
+ readonly handled: boolean;
312
+ readonly hasActiveInterpolation: boolean;
313
+ }
314
+ /**
315
+ * Parameters passed into RenderCalculationHost.processDrawSpriteImages.
316
+ */
317
+ export interface ProcessDrawSpriteImagesParams<TTag> {
318
+ readonly interpolationParams?: RenderInterpolationParams<TTag>;
319
+ readonly prepareParams?: PrepareDrawSpriteImageParams<TTag>;
320
+ }
321
+ /**
322
+ * Result returned from RenderCalculationHost.processDrawSpriteImages.
323
+ */
324
+ export interface ProcessDrawSpriteImagesResult<TTag> {
325
+ readonly preparedItems: PreparedDrawSpriteImageParams<TTag>[];
326
+ readonly interpolationResult: RenderInterpolationResult;
327
+ }
276
328
  /**
277
329
  * The render calculation host.
278
330
  * Abstraction that render calculations.
279
331
  * @param TTag Tag type.
280
332
  */
281
- export interface RenderCalculationHost<TTag> extends Releaseable {
282
- readonly prepareDrawSpriteImages: (params: PrepareDrawSpriteImageParams<TTag>) => PreparedDrawSpriteImageParams<TTag>[];
333
+ export interface RenderCalculationHost<TTag> extends Releasable {
334
+ readonly processDrawSpriteImages: (params: ProcessDrawSpriteImagesParams<TTag>) => ProcessDrawSpriteImagesResult<TTag>;
283
335
  }
284
336
  /**
285
337
  * Corner model describing world displacements and resulting geographic coordinates for shader validation.
@@ -350,6 +402,7 @@ export interface SpriteInterpolationState {
350
402
  readonly mode: SpriteInterpolationMode;
351
403
  readonly durationMs: number;
352
404
  readonly easing: EasingFunction;
405
+ readonly easingPreset: SpriteEasingPresetName | null;
353
406
  startTimestamp: number;
354
407
  readonly from: SpriteLocation;
355
408
  readonly to: SpriteLocation;
@@ -366,6 +419,7 @@ export interface SpriteInterpolationState {
366
419
  export interface DegreeInterpolationState {
367
420
  readonly durationMs: number;
368
421
  readonly easing: EasingFunction;
422
+ readonly easingPreset: SpriteEasingPresetName | null;
369
423
  readonly from: number;
370
424
  readonly to: number;
371
425
  readonly finalValue: number;
@@ -374,11 +428,39 @@ export interface DegreeInterpolationState {
374
428
  export interface DistanceInterpolationState {
375
429
  readonly durationMs: number;
376
430
  readonly easing: EasingFunction;
431
+ readonly easingPreset: SpriteEasingPresetName | null;
377
432
  readonly from: number;
378
433
  readonly to: number;
379
434
  readonly finalValue: number;
380
435
  startTimestamp: number;
381
436
  }
437
+ export interface DistanceInterpolationEvaluationParams {
438
+ readonly state: DistanceInterpolationState;
439
+ readonly timestamp: number;
440
+ }
441
+ export interface DistanceInterpolationEvaluationResult {
442
+ readonly value: number;
443
+ readonly completed: boolean;
444
+ readonly effectiveStartTimestamp: number;
445
+ }
446
+ export interface DegreeInterpolationEvaluationParams {
447
+ readonly state: DegreeInterpolationState;
448
+ readonly timestamp: number;
449
+ }
450
+ export interface DegreeInterpolationEvaluationResult {
451
+ readonly value: number;
452
+ readonly completed: boolean;
453
+ readonly effectiveStartTimestamp: number;
454
+ }
455
+ export interface SpriteInterpolationEvaluationParams {
456
+ readonly state: SpriteInterpolationState;
457
+ readonly timestamp: number;
458
+ }
459
+ export interface SpriteInterpolationEvaluationResult {
460
+ readonly location: SpriteLocation;
461
+ readonly completed: boolean;
462
+ readonly effectiveStartTimestamp: number;
463
+ }
382
464
  /**
383
465
  * Alias for the interpolation state used internally by sprites.
384
466
  */
@@ -405,6 +487,11 @@ export interface RegisteredImage {
405
487
  readonly height: number;
406
488
  readonly bitmap: ImageBitmap;
407
489
  texture: WebGLTexture | undefined;
490
+ atlasPageIndex: number;
491
+ atlasU0: number;
492
+ atlasV0: number;
493
+ atlasU1: number;
494
+ atlasV1: number;
408
495
  }
409
496
  /**
410
497
  * Padding resolved for glyph rendering with guaranteed non-negative values.
@@ -477,11 +564,12 @@ export interface InternalSpriteImageState {
477
564
  imageId: string;
478
565
  imageHandle: number;
479
566
  mode: SpriteMode;
480
- opacity: number;
567
+ opacity: MutableInterpolatedValues<number>;
481
568
  scale: number;
482
569
  anchor: Readonly<SpriteAnchor>;
483
- offset: SpriteImageOffset;
484
- rotateDeg: number;
570
+ offset: MutableSpriteImageInterpolatedOffset;
571
+ rotateDeg: MutableInterpolatedValues<number>;
572
+ rotationCommandDeg: number;
485
573
  displayedRotateDeg: number;
486
574
  autoRotation: boolean;
487
575
  autoRotationMinDistanceMeters: number;
@@ -493,9 +581,15 @@ export interface InternalSpriteImageState {
493
581
  rotationInterpolationOptions: Readonly<SpriteInterpolationOptions> | null;
494
582
  offsetDegInterpolationState: Readonly<DegreeInterpolationState> | null;
495
583
  offsetMetersInterpolationState: Readonly<DistanceInterpolationState> | null;
584
+ opacityInterpolationState: Readonly<DistanceInterpolationState> | null;
585
+ opacityInterpolationOptions: Readonly<SpriteInterpolationOptions> | null;
586
+ opacityTargetValue: number;
587
+ lodLastCommandOpacity: number;
496
588
  lastCommandRotateDeg: number;
497
589
  lastCommandOffsetDeg: number;
498
590
  lastCommandOffsetMeters: number;
591
+ lastCommandOpacity: number;
592
+ interpolationDirty: boolean;
499
593
  surfaceShaderInputs?: Readonly<SurfaceShaderInputs>;
500
594
  hitTestCorners?: [
501
595
  MutableSpriteScreenPoint,
@@ -511,9 +605,8 @@ export interface InternalSpriteCurrentState<TTag> {
511
605
  spriteId: string;
512
606
  handle: IdHandle;
513
607
  isEnabled: boolean;
514
- currentLocation: Readonly<SpriteLocation>;
515
- fromLocation?: Readonly<SpriteLocation>;
516
- toLocation?: Readonly<SpriteLocation>;
608
+ visibilityDistanceMeters?: number;
609
+ location: MutableInterpolatedValues<Readonly<SpriteLocation>>;
517
610
  images: Map<number, Map<number, InternalSpriteImageState>>;
518
611
  tag: TTag | null;
519
612
  interpolationState: InternalSpriteInterpolationState | null;
@@ -521,6 +614,7 @@ export interface InternalSpriteCurrentState<TTag> {
521
614
  lastCommandLocation: Readonly<SpriteLocation>;
522
615
  lastAutoRotationLocation: Readonly<SpriteLocation>;
523
616
  lastAutoRotationAngleDeg: number;
617
+ interpolationDirty: boolean;
524
618
  cachedMercator: Readonly<SpriteMercatorCoordinate>;
525
619
  cachedMercatorLng: number;
526
620
  cachedMercatorLat: number;
@@ -1,15 +1,15 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.13.0
3
+ * version: 0.15.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: 4934aa7f4fed93594ece419184b32b5b972bbb88
8
+ * git.commit.hash: d850b7e9c713f54f0630248dc4ea370721b6965b
9
9
  */
10
10
 
11
- import { SpriteInterpolationOptions } from './types';
12
- import { DegreeInterpolationState } from './internalTypes';
11
+ import { SpriteInterpolationOptions } from '../types';
12
+ import { DegreeInterpolationState, DegreeInterpolationEvaluationResult, InternalSpriteImageState } from '../internalTypes';
13
13
  /**
14
14
  * Parameters required to construct a {@link DegreeInterpolationState}.
15
15
  * @property {number} currentValue - Current numeric value rendered on screen.
@@ -64,3 +64,18 @@ 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
+ interface DegreeInterpolationChannelDescriptor {
69
+ readonly stateKey: DegreeInterpolationStateKey;
70
+ readonly normalize?: (value: number) => number;
71
+ readonly applyValue: (image: InternalSpriteImageState, value: number) => void;
72
+ readonly applyFinalValue?: (image: InternalSpriteImageState, value: number) => void;
73
+ }
74
+ export interface DegreeInterpolationWorkItem {
75
+ readonly descriptor: DegreeInterpolationChannelDescriptor;
76
+ readonly image: InternalSpriteImageState;
77
+ readonly state: DegreeInterpolationState;
78
+ }
79
+ export declare const collectDegreeInterpolationWorkItems: (image: InternalSpriteImageState, workItems: DegreeInterpolationWorkItem[]) => void;
80
+ export declare const applyDegreeInterpolationEvaluations: (workItems: readonly DegreeInterpolationWorkItem[], evaluations: readonly DegreeInterpolationEvaluationResult[], timestamp: number) => boolean;
81
+ export {};
@@ -0,0 +1,46 @@
1
+ /*!
2
+ * name: maplibre-gl-layers
3
+ * version: 0.15.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: d850b7e9c713f54f0630248dc4ea370721b6965b
9
+ */
10
+
11
+ import { SpriteInterpolationOptions } from '../types';
12
+ import { DistanceInterpolationEvaluationParams, DistanceInterpolationEvaluationResult, DistanceInterpolationState, InternalSpriteImageState } from '../internalTypes';
13
+ export interface CreateDistanceInterpolationStateParams {
14
+ currentValue: number;
15
+ targetValue: number;
16
+ previousCommandValue?: number;
17
+ options: SpriteInterpolationOptions;
18
+ }
19
+ export interface CreateDistanceInterpolationStateResult {
20
+ readonly state: DistanceInterpolationState;
21
+ readonly requiresInterpolation: boolean;
22
+ }
23
+ export declare const createDistanceInterpolationState: (params: CreateDistanceInterpolationStateParams) => CreateDistanceInterpolationStateResult;
24
+ export declare const evaluateDistanceInterpolation: (params: DistanceInterpolationEvaluationParams) => DistanceInterpolationEvaluationResult;
25
+ type DistanceInterpolationStateKey = 'offsetMetersInterpolationState' | 'opacityInterpolationState';
26
+ interface DistanceInterpolationChannelDescriptor {
27
+ readonly stateKey: DistanceInterpolationStateKey;
28
+ readonly normalize?: (value: number) => number;
29
+ readonly applyValue: (image: InternalSpriteImageState, value: number) => void;
30
+ readonly applyFinalValue?: (image: InternalSpriteImageState, value: number) => void;
31
+ }
32
+ declare const DISTANCE_INTERPOLATION_CHANNELS: Record<'offsetMeters' | 'opacity', DistanceInterpolationChannelDescriptor>;
33
+ export type DistanceInterpolationChannelDescriptorMap = typeof DISTANCE_INTERPOLATION_CHANNELS;
34
+ export type DistanceInterpolationChannelName = keyof DistanceInterpolationChannelDescriptorMap;
35
+ export interface DistanceInterpolationWorkItem {
36
+ readonly descriptor: DistanceInterpolationChannelDescriptorMap[DistanceInterpolationChannelName];
37
+ readonly image: InternalSpriteImageState;
38
+ readonly state: DistanceInterpolationState;
39
+ }
40
+ export interface CollectDistanceInterpolationWorkItemOptions {
41
+ readonly includeOffsetMeters?: boolean;
42
+ readonly includeOpacity?: boolean;
43
+ }
44
+ export declare const collectDistanceInterpolationWorkItems: (image: InternalSpriteImageState, workItems: DistanceInterpolationWorkItem[], options?: CollectDistanceInterpolationWorkItemOptions) => void;
45
+ export declare const applyDistanceInterpolationEvaluations: (workItems: readonly DistanceInterpolationWorkItem[], evaluations: readonly DistanceInterpolationEvaluationResult[], timestamp: number) => boolean;
46
+ export {};
@@ -1,19 +1,24 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.13.0
3
+ * version: 0.15.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: 4934aa7f4fed93594ece419184b32b5b972bbb88
8
+ * git.commit.hash: d850b7e9c713f54f0630248dc4ea370721b6965b
9
9
  */
10
10
 
11
- import { EasingFunction } from './types';
11
+ import { EasingFunction, SpriteEasingPresetName, SpriteInterpolationEasing } from '../types';
12
12
  /**
13
13
  * Linear interpolation that clamps the value to the [0, 1] range.
14
14
  */
15
15
  export declare const linearEasing: EasingFunction;
16
+ export interface ResolvedEasing {
17
+ readonly easing: EasingFunction;
18
+ readonly preset: SpriteEasingPresetName | null;
19
+ }
16
20
  /**
17
21
  * Returns the provided easing function or falls back to linear interpolation.
22
+ * When a preset name is supplied the resolved preset identifier is preserved for downstream consumers.
18
23
  */
19
- export declare const resolveEasing: (easing?: EasingFunction) => EasingFunction;
24
+ export declare const resolveEasing: (easing?: SpriteInterpolationEasing) => ResolvedEasing;
@@ -1,15 +1,15 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.13.0
3
+ * version: 0.15.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: 4934aa7f4fed93594ece419184b32b5b972bbb88
8
+ * git.commit.hash: d850b7e9c713f54f0630248dc4ea370721b6965b
9
9
  */
10
10
 
11
- import { SpriteInterpolationOptions, SpriteLocation } from './types';
12
- import { SpriteInterpolationState } from './internalTypes';
11
+ import { SpriteInterpolationOptions, SpriteLocation } from '../types';
12
+ import { SpriteInterpolationState, SpriteInterpolationEvaluationParams, SpriteInterpolationEvaluationResult } from '../internalTypes';
13
13
  /**
14
14
  * Parameters required to create a fresh interpolation state for the next animation segment.
15
15
  *
@@ -41,32 +41,10 @@ export interface CreateInterpolationStateResult {
41
41
  * @returns The prepared state alongside a boolean indicating whether animation should run.
42
42
  */
43
43
  export declare const createInterpolationState: (params: CreateInterpolationStateParams) => CreateInterpolationStateResult;
44
- /**
45
- * Parameters required to evaluate an interpolation tick at a given moment.
46
- *
47
- * @property state - Active interpolation state previously created.
48
- * @property timestamp - Epoch millisecond at which interpolation should be evaluated.
49
- */
50
- export interface EvaluateInterpolationParams {
51
- state: SpriteInterpolationState;
52
- timestamp: number;
53
- }
54
- /**
55
- * Result of evaluating interpolation progress at a specific timestamp.
56
- *
57
- * @property location - Interpolated sprite location corresponding to the evaluated time.
58
- * @property completed - Indicates whether the interpolation has reached or exceeded its duration.
59
- * @property effectiveStartTimestamp - Timestamp detected or assigned as the interpolation starting point.
60
- */
61
- export interface EvaluateInterpolationResult {
62
- readonly location: SpriteLocation;
63
- readonly completed: boolean;
64
- readonly effectiveStartTimestamp: number;
65
- }
66
44
  /**
67
45
  * Evaluates an interpolation state at a specific point in time and returns the intermediate location.
68
46
  *
69
47
  * @param params - The interpolation state and the reference timestamp for evaluation.
70
48
  * @returns The lerped location, whether the interpolation has finished, and the effective start time.
71
49
  */
72
- export declare const evaluateInterpolation: (params: EvaluateInterpolationParams) => EvaluateInterpolationResult;
50
+ export declare const evaluateInterpolation: (params: SpriteInterpolationEvaluationParams) => SpriteInterpolationEvaluationResult;
@@ -1,15 +1,15 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.13.0
3
+ * version: 0.15.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: 4934aa7f4fed93594ece419184b32b5b972bbb88
8
+ * git.commit.hash: d850b7e9c713f54f0630248dc4ea370721b6965b
9
9
  */
10
10
 
11
- import { SpriteInterpolationOptions, SpriteImageOffset } from './types';
12
- import { InternalSpriteImageState } from './internalTypes';
11
+ import { SpriteInterpolationOptions, SpriteImageOffset } from '../types';
12
+ import { InternalSpriteImageState } from '../internalTypes';
13
13
  /**
14
14
  * Ensures the rotation channel reflects the latest targets, optionally overriding interpolation.
15
15
  */
@@ -22,11 +22,21 @@ export declare const clearOffsetDegInterpolation: (image: InternalSpriteImageSta
22
22
  * Clears any running offset distance interpolation in meters.
23
23
  */
24
24
  export declare const clearOffsetMetersInterpolation: (image: InternalSpriteImageState) => void;
25
+ /**
26
+ * Clears any running opacity interpolation.
27
+ */
28
+ export declare const clearOpacityInterpolation: (image: InternalSpriteImageState) => void;
29
+ export declare const applyOpacityUpdate: (image: InternalSpriteImageState, nextOpacity: number, interpolationOptions?: SpriteInterpolationOptions | null) => void;
30
+ export type ImageInterpolationStepperId = 'rotation' | 'offsetDeg' | 'offsetMeters' | 'opacity';
25
31
  /**
26
32
  * Executes all interpolation steppers for an image and reports whether any remain active.
27
33
  */
28
- export declare const stepSpriteImageInterpolations: (image: InternalSpriteImageState, timestamp: number) => boolean;
29
- interface ApplyOffsetUpdateOptions {
34
+ export interface StepSpriteImageInterpolationOptions {
35
+ readonly skipChannels?: Partial<Record<ImageInterpolationStepperId, boolean>>;
36
+ }
37
+ export declare const stepSpriteImageInterpolations: (image: InternalSpriteImageState, timestamp: number, options?: StepSpriteImageInterpolationOptions) => boolean;
38
+ export declare const hasActiveImageInterpolations: (image: InternalSpriteImageState) => boolean;
39
+ export interface ApplyOffsetUpdateOptions {
30
40
  readonly deg?: SpriteInterpolationOptions | null;
31
41
  readonly meters?: SpriteInterpolationOptions | null;
32
42
  }
@@ -34,4 +44,3 @@ interface ApplyOffsetUpdateOptions {
34
44
  * Applies offset updates across both angular and radial channels.
35
45
  */
36
46
  export declare const applyOffsetUpdate: (image: InternalSpriteImageState, nextOffset: SpriteImageOffset, options?: ApplyOffsetUpdateOptions) => void;
37
- export {};
@@ -1,21 +1,16 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.13.0
3
+ * version: 0.15.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: 4934aa7f4fed93594ece419184b32b5b972bbb88
8
+ * git.commit.hash: d850b7e9c713f54f0630248dc4ea370721b6965b
9
9
  */
10
10
 
11
- import { SpriteInterpolationOptions } from './types';
12
- import { DegreeInterpolationState } from './internalTypes';
13
- /**
14
- * Normalizes an absolute angle in degrees to the range [0, 360).
15
- * @param {number} angle - Angle provided by the caller which may fall outside a single revolution.
16
- * @returns {number} Angle wrapped to [0, 360) with negative zero converted to zero.
17
- */
18
- export declare const normalizeAngleDeg: (angle: number) => number;
11
+ import { SpriteInterpolationOptions } from '../types';
12
+ import { DegreeInterpolationState } from '../internalTypes';
13
+ export { normalizeAngleDeg } from '../utils/math';
19
14
  /**
20
15
  * Parameters describing the rotation update request.
21
16
  * @property {number} currentAngleDeg - Current angle already applied to the sprite in degrees.