maplibre-gl-layers 0.14.0 → 0.16.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 (42) hide show
  1. package/dist/SpriteLayer.d.ts +5 -22
  2. package/dist/config.d.ts +2 -2
  3. package/dist/const.d.ts +7 -3
  4. package/dist/default.d.ts +2 -2
  5. package/dist/{atlas.d.ts → gl/atlas.d.ts} +3 -3
  6. package/dist/gl/hitTest.d.ts +54 -0
  7. package/dist/gl/shader.d.ts +115 -0
  8. package/dist/gl/text.d.ts +17 -0
  9. package/dist/{calculationHost.d.ts → host/calculationHost.d.ts} +27 -5
  10. package/dist/{mapLibreProjectionHost.d.ts → host/mapLibreProjectionHost.d.ts} +3 -3
  11. package/dist/{projectionHost.d.ts → host/projectionHost.d.ts} +10 -8
  12. package/dist/{runtime.d.ts → host/runtime.d.ts} +4 -3
  13. package/dist/{wasmCalculationHost.d.ts → host/wasmCalculationHost.d.ts} +18 -14
  14. package/dist/{wasmHost.d.ts → host/wasmHost.d.ts} +7 -5
  15. package/dist/{wasmProjectionHost.d.ts → host/wasmProjectionHost.d.ts} +3 -3
  16. package/dist/index.cjs +5185 -2836
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +4 -4
  19. package/dist/index.mjs +5185 -2836
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/internalTypes.d.ts +127 -23
  22. package/dist/{degreeInterpolation.d.ts → interpolation/degreeInterpolation.d.ts} +19 -4
  23. package/dist/interpolation/distanceInterpolation.d.ts +46 -0
  24. package/dist/interpolation/easing.d.ts +24 -0
  25. package/dist/{interpolation.d.ts → interpolation/interpolation.d.ts} +5 -27
  26. package/dist/{interpolationChannels.d.ts → interpolation/interpolationChannels.d.ts} +16 -7
  27. package/dist/{rotationInterpolation.d.ts → interpolation/rotationInterpolation.d.ts} +5 -10
  28. package/dist/types.d.ts +152 -29
  29. package/dist/utils/color.d.ts +25 -0
  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} +28 -16
  33. package/dist/{utils.d.ts → utils/utils.d.ts} +3 -3
  34. package/dist/wasm/config.json.d.ts +2 -2
  35. package/dist/wasm/offloads-nosimd.wasm +0 -0
  36. package/dist/wasm/offloads-simd-mt.js +1 -1
  37. package/dist/wasm/offloads-simd-mt.wasm +0 -0
  38. package/dist/wasm/offloads-simd.wasm +0 -0
  39. package/package.json +6 -8
  40. package/dist/distanceInterpolation.d.ts +0 -33
  41. package/dist/easing.d.ts +0 -19
  42. package/dist/shader.d.ts +0 -101
@@ -1,15 +1,17 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.14.0
3
+ * version: 0.16.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: a531802b05777e1f54a8828a247254293df1415d
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
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, SpriteScreenPoint, SpritePoint, SpriteEasing, SpriteImageLineAttributeState, SpriteImageState, SpriteInterpolatedValues, SpriteImageInterpolatedOffset } from './types';
12
+ import { EasingFunction } from './interpolation/easing';
13
+ import { ResolvedSpriteScalingOptions, SurfaceCorner } from './utils/math';
14
+ import { RgbaColor } from './utils/color';
13
15
  /**
14
16
  * The handle value that using the instance.
15
17
  */
@@ -167,23 +169,42 @@ export interface SpriteMercatorCoordinate {
167
169
  readonly y: number;
168
170
  readonly z: number;
169
171
  }
170
- export interface Releaseable {
172
+ /**
173
+ * Mutable counterpart to {@link SpriteInterpolatedValues}, used internally so SpriteLayer
174
+ * can reuse object references while still exposing readonly snapshots publicly.
175
+ */
176
+ export interface MutableSpriteInterpolatedValues<T> extends SpriteInterpolatedValues<T> {
177
+ current: T;
178
+ from: T | undefined;
179
+ to: T | undefined;
180
+ invalidated: boolean | undefined;
181
+ }
182
+ export interface MutableSpriteImageInterpolatedOffset extends SpriteImageInterpolatedOffset {
183
+ offsetMeters: MutableSpriteInterpolatedValues<number>;
184
+ offsetDeg: MutableSpriteInterpolatedValues<number>;
185
+ }
186
+ export interface Releasable {
171
187
  readonly release: () => void;
172
188
  }
173
189
  /**
174
- * Abstraction that exposes projection-related helpers.
190
+ * Mimimum abstraction that exposes projection-related helpers.
175
191
  */
176
- export interface ProjectionHost extends Releaseable {
192
+ export interface ProjectionHost extends Releasable {
177
193
  /**
178
194
  * Get current zoom level.
179
195
  * @returns Zoom level.
180
196
  */
181
197
  readonly getZoom: () => number;
198
+ /**
199
+ * Get camera location.
200
+ * @returns Camera location when viewport is available.
201
+ */
202
+ readonly getCameraLocation: () => SpriteLocation | undefined;
182
203
  /**
183
204
  * Extracts the current clip-space context if the mercator matrix is available.
184
- * @returns {ClipContext | null} Clip context or `null` when the transform is not ready.
205
+ * @returns {ClipContext | undefined} Clip context or `undefined` when the transform is not ready.
185
206
  */
186
- readonly getClipContext: () => ClipContext | null;
207
+ readonly getClipContext: () => ClipContext | undefined;
187
208
  /**
188
209
  * Get mercator coordinate from the location
189
210
  * @param location Location.
@@ -195,13 +216,13 @@ export interface ProjectionHost extends Releaseable {
195
216
  * @param location Location.
196
217
  * @returns Projected point if valid location.
197
218
  */
198
- readonly project: (location: Readonly<SpriteLocation>) => SpritePoint | null;
219
+ readonly project: (location: Readonly<SpriteLocation>) => SpritePoint | undefined;
199
220
  /**
200
221
  * Unproject the location.
201
222
  * @param point Projected point.
202
223
  * @returns Location if valid point.
203
224
  */
204
- readonly unproject: (point: Readonly<SpritePoint>) => SpriteLocation | null;
225
+ readonly unproject: (point: Readonly<SpritePoint>) => SpriteLocation | undefined;
205
226
  /**
206
227
  * Calculate perspective ratio.
207
228
  * @param location Location.
@@ -219,7 +240,7 @@ export interface PrepareDrawSpriteImageParamsBase {
219
240
  readonly drawingBufferWidth: number;
220
241
  readonly drawingBufferHeight: number;
221
242
  readonly pixelRatio: number;
222
- readonly clipContext: Readonly<ClipContext> | null;
243
+ readonly clipContext: Readonly<ClipContext> | undefined;
223
244
  }
224
245
  export interface PrepareDrawSpriteImageParamsBefore<TTag> extends PrepareDrawSpriteImageParamsBase {
225
246
  readonly bucket: readonly Readonly<RenderTargetEntryLike<TTag>>[];
@@ -247,7 +268,8 @@ export interface PreparedDrawSpriteImageParams<T> {
247
268
  readonly imageEntry: InternalSpriteImageState;
248
269
  readonly imageResource: RegisteredImage;
249
270
  readonly vertexData: Float32Array;
250
- readonly opacity: number;
271
+ opacity: number;
272
+ readonly cameraDistanceMeters: number;
251
273
  readonly hitTestCorners: readonly [
252
274
  Readonly<SpriteScreenPoint>,
253
275
  Readonly<SpriteScreenPoint>,
@@ -273,13 +295,50 @@ export interface PreparedDrawSpriteImageParams<T> {
273
295
  readonly cos: number;
274
296
  } | null;
275
297
  }
298
+ /**
299
+ * Common frame parameters shared with interpolation processing.
300
+ */
301
+ export interface RenderInterpolationFrameContext {
302
+ readonly baseMetersPerPixel: number;
303
+ readonly spriteMinPixel: number;
304
+ readonly spriteMaxPixel: number;
305
+ }
306
+ /**
307
+ * Parameters consumed when processing sprite interpolations.
308
+ */
309
+ export interface RenderInterpolationParams<TTag> {
310
+ readonly sprites: readonly InternalSpriteCurrentState<TTag>[];
311
+ readonly timestamp: number;
312
+ readonly frameContext?: RenderInterpolationFrameContext;
313
+ }
314
+ /**
315
+ * Result produced by sprite interpolation processing.
316
+ */
317
+ export interface RenderInterpolationResult {
318
+ readonly handled: boolean;
319
+ readonly hasActiveInterpolation: boolean;
320
+ }
321
+ /**
322
+ * Parameters passed into RenderCalculationHost.processDrawSpriteImages.
323
+ */
324
+ export interface ProcessDrawSpriteImagesParams<TTag> {
325
+ readonly interpolationParams?: RenderInterpolationParams<TTag>;
326
+ readonly prepareParams?: PrepareDrawSpriteImageParams<TTag>;
327
+ }
328
+ /**
329
+ * Result returned from RenderCalculationHost.processDrawSpriteImages.
330
+ */
331
+ export interface ProcessDrawSpriteImagesResult<TTag> {
332
+ readonly preparedItems: PreparedDrawSpriteImageParams<TTag>[];
333
+ readonly interpolationResult: RenderInterpolationResult;
334
+ }
276
335
  /**
277
336
  * The render calculation host.
278
337
  * Abstraction that render calculations.
279
338
  * @param TTag Tag type.
280
339
  */
281
- export interface RenderCalculationHost<TTag> extends Releaseable {
282
- readonly prepareDrawSpriteImages: (params: PrepareDrawSpriteImageParams<TTag>) => PreparedDrawSpriteImageParams<TTag>[];
340
+ export interface RenderCalculationHost<TTag> extends Releasable {
341
+ readonly processDrawSpriteImages: (params: ProcessDrawSpriteImagesParams<TTag>) => ProcessDrawSpriteImagesResult<TTag>;
283
342
  }
284
343
  /**
285
344
  * Corner model describing world displacements and resulting geographic coordinates for shader validation.
@@ -350,6 +409,7 @@ export interface SpriteInterpolationState {
350
409
  readonly mode: SpriteInterpolationMode;
351
410
  readonly durationMs: number;
352
411
  readonly easing: EasingFunction;
412
+ readonly easingPreset: SpriteEasing;
353
413
  startTimestamp: number;
354
414
  readonly from: SpriteLocation;
355
415
  readonly to: SpriteLocation;
@@ -366,6 +426,7 @@ export interface SpriteInterpolationState {
366
426
  export interface DegreeInterpolationState {
367
427
  readonly durationMs: number;
368
428
  readonly easing: EasingFunction;
429
+ readonly easingPreset: SpriteEasing;
369
430
  readonly from: number;
370
431
  readonly to: number;
371
432
  readonly finalValue: number;
@@ -374,11 +435,39 @@ export interface DegreeInterpolationState {
374
435
  export interface DistanceInterpolationState {
375
436
  readonly durationMs: number;
376
437
  readonly easing: EasingFunction;
438
+ readonly easingPreset: SpriteEasing;
377
439
  readonly from: number;
378
440
  readonly to: number;
379
441
  readonly finalValue: number;
380
442
  startTimestamp: number;
381
443
  }
444
+ export interface DistanceInterpolationEvaluationParams {
445
+ readonly state: DistanceInterpolationState;
446
+ readonly timestamp: number;
447
+ }
448
+ export interface DistanceInterpolationEvaluationResult {
449
+ readonly value: number;
450
+ readonly completed: boolean;
451
+ readonly effectiveStartTimestamp: number;
452
+ }
453
+ export interface DegreeInterpolationEvaluationParams {
454
+ readonly state: DegreeInterpolationState;
455
+ readonly timestamp: number;
456
+ }
457
+ export interface DegreeInterpolationEvaluationResult {
458
+ readonly value: number;
459
+ readonly completed: boolean;
460
+ readonly effectiveStartTimestamp: number;
461
+ }
462
+ export interface SpriteInterpolationEvaluationParams {
463
+ readonly state: SpriteInterpolationState;
464
+ readonly timestamp: number;
465
+ }
466
+ export interface SpriteInterpolationEvaluationResult {
467
+ readonly location: SpriteLocation;
468
+ readonly completed: boolean;
469
+ readonly effectiveStartTimestamp: number;
470
+ }
382
471
  /**
383
472
  * Alias for the interpolation state used internally by sprites.
384
473
  */
@@ -473,34 +562,49 @@ export type Canvas2DContext = CanvasRenderingContext2D | OffscreenCanvasRenderin
473
562
  * Canvas sources supported when rendering text glyphs.
474
563
  */
475
564
  export type Canvas2DSource = HTMLCanvasElement | OffscreenCanvas;
565
+ /** Line definition resolved for rendering. */
566
+ export interface ResolvedSpriteImageLineAttribute extends SpriteImageLineAttributeState {
567
+ readonly rgba: RgbaColor;
568
+ }
476
569
  /**
477
570
  * Base attributes for an image that composes a sprite.
478
571
  */
479
- export interface InternalSpriteImageState {
572
+ export interface InternalSpriteImageState extends SpriteImageState {
480
573
  subLayer: number;
481
574
  order: number;
482
575
  imageId: string;
483
576
  imageHandle: number;
484
577
  mode: SpriteMode;
485
- opacity: number;
578
+ opacity: MutableSpriteInterpolatedValues<number>;
486
579
  scale: number;
487
580
  anchor: Readonly<SpriteAnchor>;
488
- offset: SpriteImageOffset;
489
- rotateDeg: number;
581
+ border: ResolvedSpriteImageLineAttribute | undefined;
582
+ borderPixelWidth: number;
583
+ leaderLine: ResolvedSpriteImageLineAttribute | undefined;
584
+ leaderLinePixelWidth: number;
585
+ offset: MutableSpriteImageInterpolatedOffset;
586
+ rotateDeg: MutableSpriteInterpolatedValues<number>;
587
+ rotationCommandDeg: number;
490
588
  displayedRotateDeg: number;
491
589
  autoRotation: boolean;
492
590
  autoRotationMinDistanceMeters: number;
493
591
  resolvedBaseRotateDeg: number;
494
- originLocation?: Readonly<SpriteImageOriginLocation>;
592
+ originLocation: Readonly<SpriteImageOriginLocation> | undefined;
495
593
  originReferenceKey: SpriteOriginReferenceKey;
496
594
  originRenderTargetIndex: SpriteOriginReferenceIndex;
497
595
  rotationInterpolationState: Readonly<DegreeInterpolationState> | null;
498
596
  rotationInterpolationOptions: Readonly<SpriteInterpolationOptions> | null;
499
597
  offsetDegInterpolationState: Readonly<DegreeInterpolationState> | null;
500
598
  offsetMetersInterpolationState: Readonly<DistanceInterpolationState> | null;
599
+ opacityInterpolationState: Readonly<DistanceInterpolationState> | null;
600
+ opacityInterpolationOptions: Readonly<SpriteInterpolationOptions> | null;
601
+ opacityTargetValue: number;
602
+ lodLastCommandOpacity: number;
501
603
  lastCommandRotateDeg: number;
502
604
  lastCommandOffsetDeg: number;
503
605
  lastCommandOffsetMeters: number;
606
+ lastCommandOpacity: number;
607
+ interpolationDirty: boolean;
504
608
  surfaceShaderInputs?: Readonly<SurfaceShaderInputs>;
505
609
  hitTestCorners?: [
506
610
  MutableSpriteScreenPoint,
@@ -516,9 +620,8 @@ export interface InternalSpriteCurrentState<TTag> {
516
620
  spriteId: string;
517
621
  handle: IdHandle;
518
622
  isEnabled: boolean;
519
- currentLocation: Readonly<SpriteLocation>;
520
- fromLocation?: Readonly<SpriteLocation>;
521
- toLocation?: Readonly<SpriteLocation>;
623
+ visibilityDistanceMeters?: number;
624
+ location: MutableSpriteInterpolatedValues<Readonly<SpriteLocation>>;
522
625
  images: Map<number, Map<number, InternalSpriteImageState>>;
523
626
  tag: TTag | null;
524
627
  interpolationState: InternalSpriteInterpolationState | null;
@@ -526,6 +629,7 @@ export interface InternalSpriteCurrentState<TTag> {
526
629
  lastCommandLocation: Readonly<SpriteLocation>;
527
630
  lastAutoRotationLocation: Readonly<SpriteLocation>;
528
631
  lastAutoRotationAngleDeg: number;
632
+ interpolationDirty: boolean;
529
633
  cachedMercator: Readonly<SpriteMercatorCoordinate>;
530
634
  cachedMercatorLng: number;
531
635
  cachedMercatorLat: number;
@@ -1,15 +1,15 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.14.0
3
+ * version: 0.16.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: a531802b05777e1f54a8828a247254293df1415d
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
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.16.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: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
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 {};
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * name: maplibre-gl-layers
3
+ * version: 0.16.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: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
9
+ */
10
+
11
+ import { SpriteEasing } from '../types';
12
+ export type EasingFunction = (progress: number) => number;
13
+ /**
14
+ * Linear interpolation that clamps the value to the [0, 1] range.
15
+ */
16
+ export declare const linearEasing: EasingFunction;
17
+ export interface ResolvedEasing {
18
+ readonly easing: EasingFunction;
19
+ readonly preset: SpriteEasing;
20
+ }
21
+ /**
22
+ * Resolves an easing definition into its implementation, defaulting to linear when unspecified or unknown.
23
+ */
24
+ export declare const resolveEasing: (easing?: SpriteEasing) => ResolvedEasing;
@@ -1,15 +1,15 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.14.0
3
+ * version: 0.16.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: a531802b05777e1f54a8828a247254293df1415d
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
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.14.0
3
+ * version: 0.16.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: a531802b05777e1f54a8828a247254293df1415d
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
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.14.0
3
+ * version: 0.16.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: a531802b05777e1f54a8828a247254293df1415d
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
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.