maplibre-gl-layers 0.15.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 (38) hide show
  1. package/dist/SpriteLayer.d.ts +4 -3
  2. package/dist/config.d.ts +2 -2
  3. package/dist/const.d.ts +6 -2
  4. package/dist/default.d.ts +2 -2
  5. package/dist/gl/atlas.d.ts +2 -2
  6. package/dist/gl/hitTest.d.ts +5 -5
  7. package/dist/gl/shader.d.ts +40 -26
  8. package/dist/gl/text.d.ts +2 -2
  9. package/dist/host/calculationHost.d.ts +3 -3
  10. package/dist/host/mapLibreProjectionHost.d.ts +2 -2
  11. package/dist/host/projectionHost.d.ts +8 -7
  12. package/dist/host/runtime.d.ts +2 -2
  13. package/dist/host/wasmCalculationHost.d.ts +6 -2
  14. package/dist/host/wasmHost.d.ts +2 -2
  15. package/dist/host/wasmProjectionHost.d.ts +2 -2
  16. package/dist/index.cjs +1849 -987
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +2 -2
  19. package/dist/index.mjs +1849 -987
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/internalTypes.d.ts +38 -23
  22. package/dist/interpolation/degreeInterpolation.d.ts +2 -2
  23. package/dist/interpolation/distanceInterpolation.d.ts +2 -2
  24. package/dist/interpolation/easing.d.ts +7 -7
  25. package/dist/interpolation/interpolation.d.ts +2 -2
  26. package/dist/interpolation/interpolationChannels.d.ts +2 -2
  27. package/dist/interpolation/rotationInterpolation.d.ts +2 -2
  28. package/dist/types.d.ts +112 -23
  29. package/dist/utils/color.d.ts +25 -0
  30. package/dist/utils/image.d.ts +2 -2
  31. package/dist/utils/looseQuadTree.d.ts +2 -2
  32. package/dist/utils/math.d.ts +15 -14
  33. package/dist/utils/utils.d.ts +2 -2
  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.wasm +0 -0
  37. package/dist/wasm/offloads-simd.wasm +0 -0
  38. package/package.json +6 -6
@@ -1,15 +1,17 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.15.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: d850b7e9c713f54f0630248dc4ea370721b6965b
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
9
9
  */
10
10
 
11
- import { SpriteMode, SpriteAnchor, SpriteInterpolationOptions, SpriteImageOriginLocation, SpriteLocation, SpriteTextGlyphHorizontalAlign, SpriteTextureMagFilter, SpriteTextureMinFilter, SpriteInterpolationMode, EasingFunction, SpriteScreenPoint, SpritePoint, SpriteEasingPresetName } from './types';
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';
12
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
  */
@@ -168,23 +170,24 @@ export interface SpriteMercatorCoordinate {
168
170
  readonly z: number;
169
171
  }
170
172
  /**
171
- * Mutable counterpart to {@link InterpolatedValues}, used internally so SpriteLayer
173
+ * Mutable counterpart to {@link SpriteInterpolatedValues}, used internally so SpriteLayer
172
174
  * can reuse object references while still exposing readonly snapshots publicly.
173
175
  */
174
- export interface MutableInterpolatedValues<T> {
176
+ export interface MutableSpriteInterpolatedValues<T> extends SpriteInterpolatedValues<T> {
175
177
  current: T;
176
178
  from: T | undefined;
177
179
  to: T | undefined;
180
+ invalidated: boolean | undefined;
178
181
  }
179
- export interface MutableSpriteImageInterpolatedOffset {
180
- offsetMeters: MutableInterpolatedValues<number>;
181
- offsetDeg: MutableInterpolatedValues<number>;
182
+ export interface MutableSpriteImageInterpolatedOffset extends SpriteImageInterpolatedOffset {
183
+ offsetMeters: MutableSpriteInterpolatedValues<number>;
184
+ offsetDeg: MutableSpriteInterpolatedValues<number>;
182
185
  }
183
186
  export interface Releasable {
184
187
  readonly release: () => void;
185
188
  }
186
189
  /**
187
- * Abstraction that exposes projection-related helpers.
190
+ * Mimimum abstraction that exposes projection-related helpers.
188
191
  */
189
192
  export interface ProjectionHost extends Releasable {
190
193
  /**
@@ -192,11 +195,16 @@ export interface ProjectionHost extends Releasable {
192
195
  * @returns Zoom level.
193
196
  */
194
197
  readonly getZoom: () => number;
198
+ /**
199
+ * Get camera location.
200
+ * @returns Camera location when viewport is available.
201
+ */
202
+ readonly getCameraLocation: () => SpriteLocation | undefined;
195
203
  /**
196
204
  * Extracts the current clip-space context if the mercator matrix is available.
197
- * @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.
198
206
  */
199
- readonly getClipContext: () => ClipContext | null;
207
+ readonly getClipContext: () => ClipContext | undefined;
200
208
  /**
201
209
  * Get mercator coordinate from the location
202
210
  * @param location Location.
@@ -208,13 +216,13 @@ export interface ProjectionHost extends Releasable {
208
216
  * @param location Location.
209
217
  * @returns Projected point if valid location.
210
218
  */
211
- readonly project: (location: Readonly<SpriteLocation>) => SpritePoint | null;
219
+ readonly project: (location: Readonly<SpriteLocation>) => SpritePoint | undefined;
212
220
  /**
213
221
  * Unproject the location.
214
222
  * @param point Projected point.
215
223
  * @returns Location if valid point.
216
224
  */
217
- readonly unproject: (point: Readonly<SpritePoint>) => SpriteLocation | null;
225
+ readonly unproject: (point: Readonly<SpritePoint>) => SpriteLocation | undefined;
218
226
  /**
219
227
  * Calculate perspective ratio.
220
228
  * @param location Location.
@@ -222,7 +230,6 @@ export interface ProjectionHost extends Releasable {
222
230
  * @returns The ratio.
223
231
  */
224
232
  readonly calculatePerspectiveRatio: (location: Readonly<SpriteLocation>, cachedMercator?: SpriteMercatorCoordinate) => number;
225
- readonly getCameraLocation: () => SpriteLocation | null;
226
233
  }
227
234
  export interface PrepareDrawSpriteImageParamsBase {
228
235
  readonly imageResources: ImageResourceTable;
@@ -233,7 +240,7 @@ export interface PrepareDrawSpriteImageParamsBase {
233
240
  readonly drawingBufferWidth: number;
234
241
  readonly drawingBufferHeight: number;
235
242
  readonly pixelRatio: number;
236
- readonly clipContext: Readonly<ClipContext> | null;
243
+ readonly clipContext: Readonly<ClipContext> | undefined;
237
244
  }
238
245
  export interface PrepareDrawSpriteImageParamsBefore<TTag> extends PrepareDrawSpriteImageParamsBase {
239
246
  readonly bucket: readonly Readonly<RenderTargetEntryLike<TTag>>[];
@@ -402,7 +409,7 @@ export interface SpriteInterpolationState {
402
409
  readonly mode: SpriteInterpolationMode;
403
410
  readonly durationMs: number;
404
411
  readonly easing: EasingFunction;
405
- readonly easingPreset: SpriteEasingPresetName | null;
412
+ readonly easingPreset: SpriteEasing;
406
413
  startTimestamp: number;
407
414
  readonly from: SpriteLocation;
408
415
  readonly to: SpriteLocation;
@@ -419,7 +426,7 @@ export interface SpriteInterpolationState {
419
426
  export interface DegreeInterpolationState {
420
427
  readonly durationMs: number;
421
428
  readonly easing: EasingFunction;
422
- readonly easingPreset: SpriteEasingPresetName | null;
429
+ readonly easingPreset: SpriteEasing;
423
430
  readonly from: number;
424
431
  readonly to: number;
425
432
  readonly finalValue: number;
@@ -428,7 +435,7 @@ export interface DegreeInterpolationState {
428
435
  export interface DistanceInterpolationState {
429
436
  readonly durationMs: number;
430
437
  readonly easing: EasingFunction;
431
- readonly easingPreset: SpriteEasingPresetName | null;
438
+ readonly easingPreset: SpriteEasing;
432
439
  readonly from: number;
433
440
  readonly to: number;
434
441
  readonly finalValue: number;
@@ -555,26 +562,34 @@ export type Canvas2DContext = CanvasRenderingContext2D | OffscreenCanvasRenderin
555
562
  * Canvas sources supported when rendering text glyphs.
556
563
  */
557
564
  export type Canvas2DSource = HTMLCanvasElement | OffscreenCanvas;
565
+ /** Line definition resolved for rendering. */
566
+ export interface ResolvedSpriteImageLineAttribute extends SpriteImageLineAttributeState {
567
+ readonly rgba: RgbaColor;
568
+ }
558
569
  /**
559
570
  * Base attributes for an image that composes a sprite.
560
571
  */
561
- export interface InternalSpriteImageState {
572
+ export interface InternalSpriteImageState extends SpriteImageState {
562
573
  subLayer: number;
563
574
  order: number;
564
575
  imageId: string;
565
576
  imageHandle: number;
566
577
  mode: SpriteMode;
567
- opacity: MutableInterpolatedValues<number>;
578
+ opacity: MutableSpriteInterpolatedValues<number>;
568
579
  scale: number;
569
580
  anchor: Readonly<SpriteAnchor>;
581
+ border: ResolvedSpriteImageLineAttribute | undefined;
582
+ borderPixelWidth: number;
583
+ leaderLine: ResolvedSpriteImageLineAttribute | undefined;
584
+ leaderLinePixelWidth: number;
570
585
  offset: MutableSpriteImageInterpolatedOffset;
571
- rotateDeg: MutableInterpolatedValues<number>;
586
+ rotateDeg: MutableSpriteInterpolatedValues<number>;
572
587
  rotationCommandDeg: number;
573
588
  displayedRotateDeg: number;
574
589
  autoRotation: boolean;
575
590
  autoRotationMinDistanceMeters: number;
576
591
  resolvedBaseRotateDeg: number;
577
- originLocation?: Readonly<SpriteImageOriginLocation>;
592
+ originLocation: Readonly<SpriteImageOriginLocation> | undefined;
578
593
  originReferenceKey: SpriteOriginReferenceKey;
579
594
  originRenderTargetIndex: SpriteOriginReferenceIndex;
580
595
  rotationInterpolationState: Readonly<DegreeInterpolationState> | null;
@@ -606,7 +621,7 @@ export interface InternalSpriteCurrentState<TTag> {
606
621
  handle: IdHandle;
607
622
  isEnabled: boolean;
608
623
  visibilityDistanceMeters?: number;
609
- location: MutableInterpolatedValues<Readonly<SpriteLocation>>;
624
+ location: MutableSpriteInterpolatedValues<Readonly<SpriteLocation>>;
610
625
  images: Map<number, Map<number, InternalSpriteImageState>>;
611
626
  tag: TTag | null;
612
627
  interpolationState: InternalSpriteInterpolationState | null;
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.15.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: d850b7e9c713f54f0630248dc4ea370721b6965b
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
9
9
  */
10
10
 
11
11
  import { SpriteInterpolationOptions } from '../types';
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.15.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: d850b7e9c713f54f0630248dc4ea370721b6965b
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
9
9
  */
10
10
 
11
11
  import { SpriteInterpolationOptions } from '../types';
@@ -1,24 +1,24 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.15.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: d850b7e9c713f54f0630248dc4ea370721b6965b
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
9
9
  */
10
10
 
11
- import { EasingFunction, SpriteEasingPresetName, SpriteInterpolationEasing } from '../types';
11
+ import { SpriteEasing } from '../types';
12
+ export type EasingFunction = (progress: number) => number;
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
18
  readonly easing: EasingFunction;
18
- readonly preset: SpriteEasingPresetName | null;
19
+ readonly preset: SpriteEasing;
19
20
  }
20
21
  /**
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.
22
+ * Resolves an easing definition into its implementation, defaulting to linear when unspecified or unknown.
23
23
  */
24
- export declare const resolveEasing: (easing?: SpriteInterpolationEasing) => ResolvedEasing;
24
+ export declare const resolveEasing: (easing?: SpriteEasing) => ResolvedEasing;
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.15.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: d850b7e9c713f54f0630248dc4ea370721b6965b
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
9
9
  */
10
10
 
11
11
  import { SpriteInterpolationOptions, SpriteLocation } from '../types';
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.15.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: d850b7e9c713f54f0630248dc4ea370721b6965b
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
9
9
  */
10
10
 
11
11
  import { SpriteInterpolationOptions, SpriteImageOffset } from '../types';
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.15.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: d850b7e9c713f54f0630248dc4ea370721b6965b
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
9
9
  */
10
10
 
11
11
  import { SpriteInterpolationOptions } from '../types';
package/dist/types.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.15.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: d850b7e9c713f54f0630248dc4ea370721b6965b
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
9
9
  */
10
10
 
11
11
  import { CustomLayerInterface } from 'maplibre-gl';
@@ -42,6 +42,15 @@ export interface SpriteImageOffset {
42
42
  */
43
43
  offsetDeg: number;
44
44
  }
45
+ /**
46
+ * Line attribute.
47
+ */
48
+ export interface SpriteImageLineAttribute {
49
+ /** CSS color string. Defaults to red. */
50
+ color?: string;
51
+ /** Line width in meters. Defaults to 1. */
52
+ widthMeters?: number;
53
+ }
45
54
  /**
46
55
  * Anchor within the image.
47
56
  * The sprite's base coordinate maps to this location; range is -1.0 to 1.0 relative to image size.
@@ -73,18 +82,63 @@ export interface SpriteImageOriginLocation {
73
82
  }
74
83
  /** Defines movement interpolation modes. */
75
84
  export type SpriteInterpolationMode = 'feedback' | 'feedforward';
76
- /** Easing function signature used to map interpolation progress. */
77
- export type EasingFunction = (progress: number) => number;
78
- export type SpriteEasingPresetName = 'linear';
79
- export type SpriteInterpolationEasing = EasingFunction | SpriteEasingPresetName;
85
+ export interface SpriteEasingLinear {
86
+ type: 'linear';
87
+ }
88
+ export interface SpriteEasingEase {
89
+ type: 'ease';
90
+ /** Power applied to the easing curve. Defaults to 3. */
91
+ power?: number;
92
+ /** Direction of the easing curve. Defaults to in-out. */
93
+ mode?: 'in' | 'out' | 'in-out';
94
+ }
95
+ export interface SpriteEasingExponential {
96
+ type: 'exponential';
97
+ /** Growth rate used by the exponential curve. Defaults to 5. */
98
+ exponent?: number;
99
+ /** Direction of the exponential curve. Defaults to in-out. */
100
+ mode?: 'in' | 'out' | 'in-out';
101
+ }
102
+ export interface SpriteEasingQuadratic {
103
+ type: 'quadratic';
104
+ /** Direction of the quadratic curve. Defaults to in-out. */
105
+ mode?: 'in' | 'out' | 'in-out';
106
+ }
107
+ export interface SpriteEasingCubic {
108
+ type: 'cubic';
109
+ /** Direction of the cubic curve. Defaults to in-out. */
110
+ mode?: 'in' | 'out' | 'in-out';
111
+ }
112
+ export interface SpriteEasingSine {
113
+ type: 'sine';
114
+ /** Direction of the sine ease. Defaults to in-out. */
115
+ mode?: 'in' | 'out' | 'in-out';
116
+ /** Multiplier applied to the sine amplitude. Defaults to 1. */
117
+ amplitude?: number;
118
+ }
119
+ export interface SpriteEasingBounce {
120
+ type: 'bounce';
121
+ /** Number of visible bounces before settling. Defaults to 3. */
122
+ bounces?: number;
123
+ /** Decay factor applied per bounce; range (0, 1]. Defaults to 0.5. */
124
+ decay?: number;
125
+ }
126
+ export interface SpriteEasingBack {
127
+ type: 'back';
128
+ /** Overshoot factor controlling how far past the target the curve goes. Defaults to 1.70158. */
129
+ overshoot?: number;
130
+ }
131
+ /** Union of supported easing definitions. */
132
+ export type SpriteEasing = SpriteEasingLinear | SpriteEasingEase | SpriteEasingExponential | SpriteEasingQuadratic | SpriteEasingCubic | SpriteEasingSine | SpriteEasingBounce | SpriteEasingBack;
133
+ export type SpriteEasingType = SpriteEasing['type'];
80
134
  /** Options for interpolating values. */
81
135
  export interface SpriteInterpolationOptions {
82
136
  /** Interpolation mode; defaults to feedback. */
83
137
  mode?: SpriteInterpolationMode;
84
138
  /** Duration in milliseconds. */
85
139
  durationMs: number;
86
- /** Easing mapping applied to progress values. Accepts preset names or custom functions. Defaults to linear. */
87
- easing?: SpriteInterpolationEasing;
140
+ /** Easing definition. Defaults to linear. */
141
+ easing?: SpriteEasing;
88
142
  }
89
143
  /** Interpolation configuration for rotateDeg and offsetDeg. */
90
144
  export interface SpriteImageInterpolationOptions {
@@ -113,6 +167,10 @@ export interface SpriteImageDefinitionInit {
113
167
  anchor?: SpriteAnchor;
114
168
  /** Offset from the sprite coordinate. Defaults to no offset. */
115
169
  offset?: SpriteImageOffset;
170
+ /** Optional border rendered around the image. */
171
+ border?: SpriteImageLineAttribute;
172
+ /** Optional leader line rendered toward the origin image. */
173
+ leaderLine?: SpriteImageLineAttribute;
116
174
  /**
117
175
  * Determines which coordinate to anchor against.
118
176
  * - Omitted: use the sprite base coordinate.
@@ -154,6 +212,10 @@ export interface SpriteImageDefinitionUpdate {
154
212
  anchor?: SpriteAnchor;
155
213
  /** Offset from the sprite coordinate. */
156
214
  offset?: SpriteImageOffset;
215
+ /** Border rendered around the image. Specify null to remove. */
216
+ border?: SpriteImageLineAttribute | null;
217
+ /** Leader line rendered toward the origin image. Specify null to remove. */
218
+ leaderLine?: SpriteImageLineAttribute | null;
157
219
  /** Additional rotation in degrees. */
158
220
  rotateDeg?: number;
159
221
  /** Enables auto-rotation toward the travel direction. */
@@ -184,11 +246,20 @@ export interface SpriteInit<TTag> {
184
246
  isEnabled?: boolean;
185
247
  /** Initial location. */
186
248
  location: SpriteLocation;
249
+ /**
250
+ * Marks the sprite as invalidated initially, causing interpolation parameters to be
251
+ * ignored until the first update drives the value again.
252
+ */
253
+ invalidate?: boolean;
187
254
  /**
188
255
  * Pseudo LOD threshold for the sprite. When the camera distance exceeds this value,
189
256
  * all images attached to the sprite become invisible.
190
257
  */
191
258
  visibilityDistanceMeters?: number;
259
+ /**
260
+ * Default interpolation settings applied to initial location updates until overridden.
261
+ */
262
+ interpolation?: SpriteInterpolationOptions;
192
263
  /** Array of zero or more images. */
193
264
  images: SpriteImageDefinitionInitEntry[];
194
265
  /** Optional tag value; null or omission means no tag. */
@@ -213,22 +284,33 @@ export type SpriteInitCollection<TTag> = Record<string, SpriteInit<TTag>> | read
213
284
  * Interpolated values.
214
285
  * @param T - Value type.
215
286
  */
216
- export interface InterpolatedValues<T> {
287
+ export interface SpriteInterpolatedValues<T> {
217
288
  /** Current time value. */
218
289
  readonly current: T;
219
290
  /** Requested value. */
220
291
  readonly from: T | undefined;
221
292
  /** Will be reached value. */
222
293
  readonly to: T | undefined;
294
+ /** Marks whether the value was invalidated due to visibility changes. */
295
+ readonly invalidated: boolean | undefined;
223
296
  }
224
297
  /**
225
298
  * Offset with interpolation metadata for both distance and heading.
226
299
  */
227
300
  export interface SpriteImageInterpolatedOffset {
228
301
  /** Distance from the anchor in meters. */
229
- readonly offsetMeters: InterpolatedValues<number>;
302
+ readonly offsetMeters: SpriteInterpolatedValues<number>;
230
303
  /** Heading describing the offset direction in degrees. */
231
- readonly offsetDeg: InterpolatedValues<number>;
304
+ readonly offsetDeg: SpriteInterpolatedValues<number>;
305
+ }
306
+ /**
307
+ * Resolved line attribute state.
308
+ */
309
+ export interface SpriteImageLineAttributeState {
310
+ /** CSS color string applied to the line. */
311
+ readonly color: string;
312
+ /** Line width in meters. */
313
+ readonly widthMeters: number;
232
314
  }
233
315
  /**
234
316
  * Sprite image state evaluated at runtime.
@@ -237,11 +319,13 @@ export interface SpriteImageInterpolatedOffset {
237
319
  * @property {number} order - Ordering slot within the sub-layer.
238
320
  * @property {string} imageId - Identifier of the registered image or glyph.
239
321
  * @property {SpriteMode} mode - Rendering mode applied to the image.
240
- * @property {InterpolatedValues<number>} opacity - Opacity multiplier applied when rendering, with interpolation metadata.
322
+ * @property {SpriteInterpolatedValues<number>} opacity - Opacity multiplier applied when rendering, with interpolation metadata.
241
323
  * @property {number} scale - Scale factor converting pixels to meters.
242
324
  * @property {Readonly<SpriteAnchor>} anchor - Anchor coordinates resolved for the image.
243
- * @property {Readonly<SpriteImageInterpolatedOffset>} offset - Offset applied relative to the anchor point, with interpolation metadata.
244
- * @property {InterpolatedValues<number>} rotateDeg - Additional rotation in degrees plus interpolation metadata.
325
+ * @property {SpriteImageInterpolatedOffset} offset - Offset applied relative to the anchor point, with interpolation metadata.
326
+ * @property {SpriteImageLineAttributeState | undefined} border - Border line attribute.
327
+ * @property {SpriteImageLineAttributeState | undefined} leaderLine - Leader line attribute.
328
+ * @property {SpriteInterpolatedValues<number>} rotateDeg - Additional rotation in degrees plus interpolation metadata.
245
329
  * @property {boolean} autoRotation - Indicates whether auto-rotation is active.
246
330
  * @property {number} autoRotationMinDistanceMeters - Minimum travel distance before auto-rotation updates.
247
331
  * @property {number} resolvedBaseRotateDeg - Internal base rotation resolved for the current frame.
@@ -262,14 +346,18 @@ export interface SpriteImageState {
262
346
  /** Anchor coordinates resolved for the image. */
263
347
  readonly anchor: Readonly<SpriteAnchor>;
264
348
  /** Opacity multiplier applied when rendering. */
265
- readonly opacity: InterpolatedValues<number>;
349
+ readonly opacity: SpriteInterpolatedValues<number>;
266
350
  /** Offset applied relative to the anchor point. */
267
- readonly offset: Readonly<SpriteImageInterpolatedOffset>;
351
+ readonly offset: SpriteImageInterpolatedOffset;
352
+ /** Optional border rendered around the image. */
353
+ readonly border: SpriteImageLineAttributeState | undefined;
354
+ /** Optional leader line rendered toward the origin image. */
355
+ readonly leaderLine: SpriteImageLineAttributeState | undefined;
268
356
  /**
269
357
  * Additional rotation in degrees with interpolation metadata.
270
358
  * `from`/`to` are `undefined` when no rotation animation is running.
271
359
  */
272
- readonly rotateDeg: InterpolatedValues<number>;
360
+ readonly rotateDeg: SpriteInterpolatedValues<number>;
273
361
  /** Indicates whether auto-rotation is active. */
274
362
  readonly autoRotation: boolean;
275
363
  /** Minimum travel distance before auto-rotation updates. */
@@ -300,7 +388,7 @@ export interface SpriteCurrentState<TTag> {
300
388
  * Location information including current, source, and destination coordinates.
301
389
  * `from`/`to` are `undefined` when interpolation is inactive.
302
390
  */
303
- readonly location: InterpolatedValues<Readonly<SpriteLocation>>;
391
+ readonly location: SpriteInterpolatedValues<Readonly<SpriteLocation>>;
304
392
  /** Current image states, grouped by sub-layer and order. */
305
393
  readonly images: ReadonlyMap<number, ReadonlyMap<number, SpriteImageState>>;
306
394
  /** Optional tag value; null indicates no tag. */
@@ -560,11 +648,6 @@ export interface SpriteLayerOptions {
560
648
  spriteScaling?: SpriteScalingOptions;
561
649
  /** Optional texture filtering configuration. */
562
650
  textureFiltering?: SpriteTextureFilteringOptions;
563
- /**
564
- * When true, renders red outlines around sprite hit-test regions to aid debugging.
565
- * Defaults to false.
566
- */
567
- showDebugBounds?: boolean;
568
651
  }
569
652
  /**
570
653
  * Options used when registering SVG images.
@@ -813,6 +896,12 @@ export interface SpriteLayerInterface<TTag = any> extends CustomLayerInterface {
813
896
  * @returns {number} Number of sprites that were updated.
814
897
  */
815
898
  readonly updateForEach: (updater: (sprite: SpriteCurrentState<TTag>, update: SpriteUpdaterEntry<TTag>) => boolean) => number;
899
+ /**
900
+ * Controls entire interpolation Calculation.
901
+ * When `false`, interpolation halts immediately and resumes smoothly from the paused state when re-enabled.
902
+ * @param moveable - Continuous calculation for movement interpolation when value is true.
903
+ */
904
+ readonly setInterpolationCalculation: (moveable: boolean) => void;
816
905
  /**
817
906
  * Adds an event listener.
818
907
  *
@@ -0,0 +1,25 @@
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
+ /**
12
+ * Minimal CSS color parser used for resolving sprite border colors.
13
+ */
14
+ export type RgbaColor = readonly [number, number, number, number];
15
+ /**
16
+ * Parses a CSS color string into normalized RGBA values.
17
+ * Falls back to the supplied default when parsing fails.
18
+ *
19
+ * @param color CSS color string to parse.
20
+ * @param fallback Fallback value used when parsing fails.
21
+ * @returns Parsed RGBA tuple.
22
+ */
23
+ export declare const parseCssColorToRgba: (color: string | undefined, fallback: RgbaColor) => RgbaColor;
24
+ export declare const DEFAULT_BORDER_COLOR = "red";
25
+ export declare const DEFAULT_BORDER_COLOR_RGBA: RgbaColor;
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.15.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: d850b7e9c713f54f0630248dc4ea370721b6965b
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
9
9
  */
10
10
 
11
11
  import { SpriteImageRegisterOptions } from '../types';
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: maplibre-gl-layers
3
- * version: 0.15.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: d850b7e9c713f54f0630248dc4ea370721b6965b
8
+ * git.commit.hash: 8d2149a6811cac25ed9d8c1d97acde73e1a38e25
9
9
  */
10
10
 
11
11
  export interface Rect {