maplibre-gl-layers 0.18.0 → 0.19.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/dist/SpriteLayer.d.ts +3 -3
- package/dist/config.d.ts +2 -2
- package/dist/const.d.ts +7 -4
- package/dist/default.d.ts +2 -2
- package/dist/gl/atlas.d.ts +2 -2
- package/dist/gl/hitTest.d.ts +3 -3
- package/dist/gl/mouseEvents.d.ts +36 -0
- package/dist/gl/shader.d.ts +2 -2
- package/dist/gl/text.d.ts +2 -2
- package/dist/gl/tracking.d.ts +36 -0
- package/dist/host/calculationHost.d.ts +15 -13
- 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 +7 -7
- package/dist/host/wasmHost.d.ts +2 -2
- package/dist/host/wasmProjectionHost.d.ts +2 -2
- package/dist/index.cjs +1136 -1102
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1136 -1102
- package/dist/index.mjs.map +1 -1
- package/dist/internalTypes.d.ts +18 -46
- package/dist/interpolation/degreeInterpolation.d.ts +8 -40
- package/dist/interpolation/distanceInterpolation.d.ts +9 -23
- package/dist/interpolation/easing.d.ts +2 -2
- package/dist/interpolation/interpolationChannels.d.ts +18 -6
- package/dist/interpolation/locationInterpolation.d.ts +30 -0
- package/dist/interpolation/rotationInterpolation.d.ts +2 -3
- package/dist/types.d.ts +57 -53
- package/dist/utils/color.d.ts +2 -2
- package/dist/utils/image.d.ts +2 -2
- package/dist/utils/looseQuadTree.d.ts +2 -2
- package/dist/utils/math.d.ts +38 -58
- package/dist/utils/utils.d.ts +2 -2
- package/dist/wasm/config.json.d.ts +2 -2
- package/package.json +6 -6
- package/dist/interpolation/interpolation.d.ts +0 -48
package/dist/internalTypes.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.19.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: 7bc93c11d7855dedb8d60f140af4e413252c32a7
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { SpriteMode, SpriteAnchor, SpriteInterpolationOptions, SpriteImageOriginLocation, SpriteLocation, SpriteTextGlyphHorizontalAlign, SpriteTextureMagFilter, SpriteTextureMinFilter, SpriteInterpolationMode, SpriteScreenPoint, SpritePoint, SpriteEasingParam, SpriteImageLineAttributeState, SpriteImageState, SpriteInterpolatedValues, SpriteImageInterpolatedOffset } from './types';
|
|
11
|
+
import { SpriteMode, SpriteAnchor, SpriteInterpolationOptions, SpriteImageOriginLocation, SpriteLocation, SpriteTextGlyphHorizontalAlign, SpriteTextureMagFilter, SpriteTextureMinFilter, SpriteInterpolationMode, SpriteScreenPoint, SpritePoint, SpriteEasingParam, SpriteImageLineAttributeState, SpriteImageState, SpriteInterpolatedValues, SpriteImageInterpolatedOffset, SpriteCurrentState } from './types';
|
|
12
12
|
import { ResolvedSpriteScalingOptions, SurfaceCorner } from './utils/math';
|
|
13
13
|
export interface Releasable {
|
|
14
14
|
readonly release: () => void;
|
|
@@ -245,8 +245,6 @@ export interface PrepareDrawSpriteImageParamsBase {
|
|
|
245
245
|
readonly imageResources: ImageResourceTable;
|
|
246
246
|
readonly imageHandleBuffers: Readonly<ImageHandleBuffers>;
|
|
247
247
|
readonly baseMetersPerPixel: number;
|
|
248
|
-
readonly spriteMinPixel: number;
|
|
249
|
-
readonly spriteMaxPixel: number;
|
|
250
248
|
readonly drawingBufferWidth: number;
|
|
251
249
|
readonly drawingBufferHeight: number;
|
|
252
250
|
readonly pixelRatio: number;
|
|
@@ -256,7 +254,6 @@ export interface PrepareDrawSpriteImageParamsBefore<TTag> extends PrepareDrawSpr
|
|
|
256
254
|
readonly bucket: readonly Readonly<RenderTargetEntryLike<TTag>>[];
|
|
257
255
|
readonly bucketBuffers: Readonly<RenderTargetBucketBuffers>;
|
|
258
256
|
readonly resolvedScaling: ResolvedSpriteScalingOptions;
|
|
259
|
-
readonly zoomScaleFactor: number;
|
|
260
257
|
}
|
|
261
258
|
export interface PrepareDrawSpriteImageParamsAfter extends PrepareDrawSpriteImageParamsBase {
|
|
262
259
|
readonly identityScaleX: number;
|
|
@@ -310,8 +307,6 @@ export interface PreparedDrawSpriteImageParams<T> {
|
|
|
310
307
|
*/
|
|
311
308
|
export interface RenderInterpolationFrameContext {
|
|
312
309
|
readonly baseMetersPerPixel: number;
|
|
313
|
-
readonly spriteMinPixel: number;
|
|
314
|
-
readonly spriteMaxPixel: number;
|
|
315
310
|
}
|
|
316
311
|
/**
|
|
317
312
|
* Parameters consumed when processing sprite interpolations.
|
|
@@ -430,30 +425,8 @@ export interface SpriteInterpolationState<TValue> {
|
|
|
430
425
|
/** Epoch millisecond when the interpolation started, or -1 when uninitialized. */
|
|
431
426
|
startTimestamp: number;
|
|
432
427
|
}
|
|
433
|
-
export interface
|
|
434
|
-
readonly
|
|
435
|
-
readonly timestamp: number;
|
|
436
|
-
}
|
|
437
|
-
export interface DistanceInterpolationEvaluationResult {
|
|
438
|
-
readonly value: number;
|
|
439
|
-
readonly completed: boolean;
|
|
440
|
-
readonly effectiveStartTimestamp: number;
|
|
441
|
-
}
|
|
442
|
-
export interface DegreeInterpolationEvaluationParams {
|
|
443
|
-
readonly state: SpriteInterpolationState<number>;
|
|
444
|
-
readonly timestamp: number;
|
|
445
|
-
}
|
|
446
|
-
export interface DegreeInterpolationEvaluationResult {
|
|
447
|
-
readonly value: number;
|
|
448
|
-
readonly completed: boolean;
|
|
449
|
-
readonly effectiveStartTimestamp: number;
|
|
450
|
-
}
|
|
451
|
-
export interface SpriteInterpolationEvaluationParams {
|
|
452
|
-
readonly state: SpriteInterpolationState<SpriteLocation>;
|
|
453
|
-
readonly timestamp: number;
|
|
454
|
-
}
|
|
455
|
-
export interface SpriteInterpolationEvaluationResult {
|
|
456
|
-
readonly location: SpriteLocation;
|
|
428
|
+
export interface SpriteInterpolationEvaluationResult<TValue> {
|
|
429
|
+
readonly value: TValue;
|
|
457
430
|
readonly completed: boolean;
|
|
458
431
|
readonly effectiveStartTimestamp: number;
|
|
459
432
|
}
|
|
@@ -552,7 +525,7 @@ export interface ResolvedSpriteImageLineAttribute extends SpriteImageLineAttribu
|
|
|
552
525
|
readonly rgba: RgbaColor;
|
|
553
526
|
}
|
|
554
527
|
/**
|
|
555
|
-
* Base
|
|
528
|
+
* Base mutable attribute view for an image that composes a sprite.
|
|
556
529
|
*/
|
|
557
530
|
export interface InternalSpriteImageState extends SpriteImageState {
|
|
558
531
|
subLayer: number;
|
|
@@ -560,47 +533,46 @@ export interface InternalSpriteImageState extends SpriteImageState {
|
|
|
560
533
|
imageId: string;
|
|
561
534
|
imageHandle: number;
|
|
562
535
|
mode: SpriteMode;
|
|
563
|
-
opacity: MutableSpriteInterpolatedValues<number>;
|
|
564
|
-
lodOpacity: number;
|
|
565
536
|
scale: number;
|
|
566
537
|
anchor: Readonly<SpriteAnchor>;
|
|
567
538
|
border: ResolvedSpriteImageLineAttribute | undefined;
|
|
568
539
|
borderPixelWidth: number;
|
|
569
540
|
leaderLine: ResolvedSpriteImageLineAttribute | undefined;
|
|
570
541
|
leaderLinePixelWidth: number;
|
|
542
|
+
rotateDeg: number;
|
|
543
|
+
opacity: number;
|
|
544
|
+
lodOpacity: number;
|
|
545
|
+
finalOpacity: MutableSpriteInterpolatedValues<number>;
|
|
571
546
|
offset: MutableSpriteImageInterpolatedOffset;
|
|
572
|
-
|
|
573
|
-
rotationCommandDeg: number;
|
|
574
|
-
displayedRotateDeg: number;
|
|
547
|
+
finalRotateDeg: MutableSpriteInterpolatedValues<number>;
|
|
575
548
|
autoRotation: boolean;
|
|
576
549
|
autoRotationMinDistanceMeters: number;
|
|
577
|
-
resolvedBaseRotateDeg: number;
|
|
578
550
|
originLocation: Readonly<SpriteImageOriginLocation> | undefined;
|
|
579
551
|
originReferenceKey: SpriteOriginReferenceKey;
|
|
580
552
|
originRenderTargetIndex: SpriteOriginReferenceIndex;
|
|
581
553
|
interpolationDirty: boolean;
|
|
582
|
-
surfaceShaderInputs
|
|
583
|
-
hitTestCorners
|
|
554
|
+
surfaceShaderInputs: Readonly<SurfaceShaderInputs> | undefined;
|
|
555
|
+
hitTestCorners: [
|
|
584
556
|
MutableSpriteScreenPoint,
|
|
585
557
|
MutableSpriteScreenPoint,
|
|
586
558
|
MutableSpriteScreenPoint,
|
|
587
559
|
MutableSpriteScreenPoint
|
|
588
|
-
];
|
|
560
|
+
] | undefined;
|
|
589
561
|
}
|
|
590
562
|
/**
|
|
591
|
-
* Current sprite state tracked internally by the layer.
|
|
563
|
+
* Current sprite mutable state view tracked internally by the layer.
|
|
592
564
|
*/
|
|
593
|
-
export interface InternalSpriteCurrentState<TTag> {
|
|
565
|
+
export interface InternalSpriteCurrentState<TTag> extends SpriteCurrentState<TTag> {
|
|
594
566
|
spriteId: string;
|
|
595
567
|
handle: IdHandle;
|
|
596
568
|
isEnabled: boolean;
|
|
597
|
-
visibilityDistanceMeters
|
|
569
|
+
visibilityDistanceMeters: number | undefined;
|
|
598
570
|
opacityMultiplier: number;
|
|
599
571
|
location: MutableSpriteInterpolatedValues<SpriteLocation>;
|
|
600
572
|
images: Map<number, Map<number, InternalSpriteImageState>>;
|
|
601
573
|
tag: TTag | null;
|
|
602
574
|
lastAutoRotationLocation: Readonly<SpriteLocation>;
|
|
603
|
-
|
|
575
|
+
currentAutoRotateDeg: number;
|
|
604
576
|
autoRotationInvalidated: boolean;
|
|
605
577
|
interpolationDirty: boolean;
|
|
606
578
|
cachedMercator: Readonly<SpriteMercatorCoordinate>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.19.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: 7bc93c11d7855dedb8d60f140af4e413252c32a7
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteInterpolationOptions } from '../types';
|
|
12
|
-
import {
|
|
12
|
+
import { SpriteInterpolationEvaluationResult, InternalSpriteImageState, SpriteInterpolationState } from '../internalTypes';
|
|
13
|
+
import { SpriteInterpolationChannelDescriptor } from './interpolationChannels';
|
|
13
14
|
/**
|
|
14
15
|
* Parameters required to construct a {@link DegreeInterpolationState}.
|
|
15
16
|
*/
|
|
@@ -38,43 +39,10 @@ export interface CreateDegreeInterpolationStateResult {
|
|
|
38
39
|
* @returns {CreateDegreeInterpolationStateResult} State data plus a flag indicating if animation is needed.
|
|
39
40
|
*/
|
|
40
41
|
export declare const createDegreeInterpolationState: (params: CreateDegreeInterpolationStateParams) => CreateDegreeInterpolationStateResult;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
export interface EvaluateDegreeInterpolationParams {
|
|
45
|
-
/** State generated via {@link createDegreeInterpolationState}. */
|
|
46
|
-
state: SpriteInterpolationState<number>;
|
|
47
|
-
/** Timestamp in milliseconds used to sample the interpolation curve. */
|
|
48
|
-
timestamp: number;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Result of evaluating a numeric interpolation at a specific timestamp.
|
|
52
|
-
*/
|
|
53
|
-
export interface EvaluateDegreeInterpolationResult {
|
|
54
|
-
/** Current interpolated value (or final value after completion). */
|
|
55
|
-
readonly value: number;
|
|
56
|
-
/** Indicates whether interpolation reached the end. */
|
|
57
|
-
readonly completed: boolean;
|
|
58
|
-
/** Start timestamp applied during evaluation. */
|
|
59
|
-
readonly effectiveStartTimestamp: number;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Evaluates a numeric interpolation against the provided timestamp.
|
|
63
|
-
* @param {EvaluateDegreeInterpolationParams} params - Inputs containing interpolation state and sample timestamp.
|
|
64
|
-
* @returns {EvaluateDegreeInterpolationResult} Current value, completion flag, and effective start time.
|
|
65
|
-
*/
|
|
66
|
-
export declare const evaluateDegreeInterpolation: (params: EvaluateDegreeInterpolationParams) => EvaluateDegreeInterpolationResult;
|
|
67
|
-
interface DegreeInterpolationChannelDescriptor {
|
|
68
|
-
readonly resolveInterpolation: (image: InternalSpriteImageState) => MutableSpriteInterpolation<number>;
|
|
69
|
-
readonly normalize?: (value: number) => number;
|
|
70
|
-
readonly applyValue: (image: InternalSpriteImageState, value: number) => void;
|
|
71
|
-
readonly applyFinalValue?: (image: InternalSpriteImageState, value: number) => void;
|
|
72
|
-
}
|
|
73
|
-
export interface DegreeInterpolationWorkItem {
|
|
74
|
-
readonly descriptor: DegreeInterpolationChannelDescriptor;
|
|
42
|
+
export declare const evaluateDegreeInterpolation: (state: SpriteInterpolationState<number>, timestamp: number) => SpriteInterpolationEvaluationResult<number>;
|
|
43
|
+
export interface DegreeInterpolationWorkItem extends SpriteInterpolationState<number> {
|
|
44
|
+
readonly descriptor: SpriteInterpolationChannelDescriptor;
|
|
75
45
|
readonly image: InternalSpriteImageState;
|
|
76
|
-
readonly state: SpriteInterpolationState<number>;
|
|
77
46
|
}
|
|
78
47
|
export declare const collectDegreeInterpolationWorkItems: (image: InternalSpriteImageState, workItems: DegreeInterpolationWorkItem[]) => void;
|
|
79
|
-
export declare const applyDegreeInterpolationEvaluations: (workItems: readonly DegreeInterpolationWorkItem[], evaluations: readonly
|
|
80
|
-
export {};
|
|
48
|
+
export declare const applyDegreeInterpolationEvaluations: (workItems: readonly DegreeInterpolationWorkItem[], evaluations: readonly SpriteInterpolationEvaluationResult<number>[], timestamp: number) => boolean;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.19.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: 7bc93c11d7855dedb8d60f140af4e413252c32a7
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteInterpolationOptions } from '../types';
|
|
12
|
-
import {
|
|
12
|
+
import { InternalSpriteImageState, SpriteInterpolationEvaluationResult, SpriteInterpolationState } from '../internalTypes';
|
|
13
|
+
import { SpriteInterpolationChannelDescriptor } from './interpolationChannels';
|
|
13
14
|
export interface CreateDistanceInterpolationStateParams {
|
|
14
15
|
currentValue: number;
|
|
15
16
|
targetValue: number;
|
|
@@ -21,25 +22,10 @@ export interface CreateDistanceInterpolationStateResult {
|
|
|
21
22
|
readonly requiresInterpolation: boolean;
|
|
22
23
|
}
|
|
23
24
|
export declare const createDistanceInterpolationState: (params: CreateDistanceInterpolationStateParams) => CreateDistanceInterpolationStateResult;
|
|
24
|
-
export declare const evaluateDistanceInterpolation: (
|
|
25
|
-
interface
|
|
26
|
-
readonly
|
|
27
|
-
readonly normalize?: (value: number) => number;
|
|
28
|
-
readonly applyValue: (image: InternalSpriteImageState, value: number) => void;
|
|
29
|
-
readonly applyFinalValue?: (image: InternalSpriteImageState, value: number) => void;
|
|
30
|
-
}
|
|
31
|
-
declare const DISTANCE_INTERPOLATION_CHANNELS: Record<'offsetMeters' | 'opacity', DistanceInterpolationChannelDescriptor>;
|
|
32
|
-
export type DistanceInterpolationChannelDescriptorMap = typeof DISTANCE_INTERPOLATION_CHANNELS;
|
|
33
|
-
export type DistanceInterpolationChannelName = keyof DistanceInterpolationChannelDescriptorMap;
|
|
34
|
-
export interface DistanceInterpolationWorkItem {
|
|
35
|
-
readonly descriptor: DistanceInterpolationChannelDescriptorMap[DistanceInterpolationChannelName];
|
|
25
|
+
export declare const evaluateDistanceInterpolation: (state: SpriteInterpolationState<number>, timestamp: number) => SpriteInterpolationEvaluationResult<number>;
|
|
26
|
+
export interface DistanceInterpolationWorkItem extends SpriteInterpolationState<number> {
|
|
27
|
+
readonly descriptor: SpriteInterpolationChannelDescriptor;
|
|
36
28
|
readonly image: InternalSpriteImageState;
|
|
37
|
-
readonly state: SpriteInterpolationState<number>;
|
|
38
|
-
}
|
|
39
|
-
export interface CollectDistanceInterpolationWorkItemOptions {
|
|
40
|
-
readonly includeOffsetMeters?: boolean;
|
|
41
|
-
readonly includeOpacity?: boolean;
|
|
42
29
|
}
|
|
43
|
-
export declare const collectDistanceInterpolationWorkItems: (image: InternalSpriteImageState, workItems: DistanceInterpolationWorkItem[],
|
|
44
|
-
export declare const applyDistanceInterpolationEvaluations: (workItems: readonly DistanceInterpolationWorkItem[], evaluations: readonly
|
|
45
|
-
export {};
|
|
30
|
+
export declare const collectDistanceInterpolationWorkItems: (image: InternalSpriteImageState, workItems: DistanceInterpolationWorkItem[], includeOffsetMeters: boolean, includeOpacity: boolean) => void;
|
|
31
|
+
export declare const applyDistanceInterpolationEvaluations: (workItems: readonly DistanceInterpolationWorkItem[], evaluations: readonly SpriteInterpolationEvaluationResult<number>[], timestamp: number) => boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.19.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: 7bc93c11d7855dedb8d60f140af4e413252c32a7
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { EasingFunction } from '../internalTypes';
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.19.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: 7bc93c11d7855dedb8d60f140af4e413252c32a7
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { SpriteInterpolationOptions
|
|
12
|
-
import { InternalSpriteImageState } from '../internalTypes';
|
|
11
|
+
import { SpriteInterpolationOptions } from '../types';
|
|
12
|
+
import { InternalSpriteImageState, MutableSpriteInterpolation } from '../internalTypes';
|
|
13
|
+
export interface SpriteInterpolationChannelDescriptor {
|
|
14
|
+
readonly resolveInterpolation: (image: InternalSpriteImageState) => MutableSpriteInterpolation<number>;
|
|
15
|
+
readonly normalize?: (value: number) => number;
|
|
16
|
+
readonly applyValue: (image: InternalSpriteImageState, value: number) => void;
|
|
17
|
+
readonly applyFinalValue?: (image: InternalSpriteImageState, value: number) => void;
|
|
18
|
+
}
|
|
13
19
|
/**
|
|
14
20
|
* Ensures the rotation channel reflects the latest targets, optionally overriding interpolation.
|
|
15
21
|
*/
|
|
16
|
-
export declare const syncImageRotationChannel: (image: InternalSpriteImageState, optionsOverride?: SpriteInterpolationOptions | null) => void;
|
|
22
|
+
export declare const syncImageRotationChannel: (image: InternalSpriteImageState, spriteAutoRotationDeg: number, optionsOverride?: SpriteInterpolationOptions | null) => void;
|
|
17
23
|
/**
|
|
18
24
|
* Clears any running offset angle interpolation.
|
|
19
25
|
*/
|
|
20
26
|
export declare const clearOffsetDegInterpolation: (image: InternalSpriteImageState) => void;
|
|
27
|
+
type OffsetUpdate = {
|
|
28
|
+
offsetMeters: number;
|
|
29
|
+
offsetDeg: number;
|
|
30
|
+
};
|
|
21
31
|
/**
|
|
22
32
|
* Clears any running offset distance interpolation in meters.
|
|
23
33
|
*/
|
|
@@ -34,6 +44,7 @@ export type ImageInterpolationStepperId = 'rotation' | 'offsetDeg' | 'offsetMete
|
|
|
34
44
|
*/
|
|
35
45
|
export interface StepSpriteImageInterpolationOptions {
|
|
36
46
|
readonly skipChannels?: Partial<Record<ImageInterpolationStepperId, boolean>>;
|
|
47
|
+
readonly autoRotationDeg?: number;
|
|
37
48
|
}
|
|
38
49
|
export declare const stepSpriteImageInterpolations: (image: InternalSpriteImageState, timestamp: number, options?: StepSpriteImageInterpolationOptions) => boolean;
|
|
39
50
|
export declare const hasActiveImageInterpolations: (image: InternalSpriteImageState) => boolean;
|
|
@@ -44,4 +55,5 @@ export interface ApplyOffsetUpdateOptions {
|
|
|
44
55
|
/**
|
|
45
56
|
* Applies offset updates across both angular and radial channels.
|
|
46
57
|
*/
|
|
47
|
-
export declare const applyOffsetUpdate: (image: InternalSpriteImageState, nextOffset:
|
|
58
|
+
export declare const applyOffsetUpdate: (image: InternalSpriteImageState, nextOffset: OffsetUpdate, options?: ApplyOffsetUpdateOptions) => void;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: maplibre-gl-layers
|
|
3
|
+
* version: 0.19.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: 7bc93c11d7855dedb8d60f140af4e413252c32a7
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { SpriteInterpolationOptions, SpriteLocation } from '../types';
|
|
12
|
+
import { InternalSpriteCurrentState, SpriteInterpolationEvaluationResult, SpriteInterpolationState } from '../internalTypes';
|
|
13
|
+
export interface CreateLocationInterpolationStateParams {
|
|
14
|
+
currentLocation: SpriteLocation;
|
|
15
|
+
lastCommandLocation?: SpriteLocation;
|
|
16
|
+
nextCommandLocation: SpriteLocation;
|
|
17
|
+
options: SpriteInterpolationOptions;
|
|
18
|
+
}
|
|
19
|
+
export interface CreateLocationInterpolationStateResult {
|
|
20
|
+
readonly state: SpriteInterpolationState<SpriteLocation>;
|
|
21
|
+
readonly requiresInterpolation: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const createLocationInterpolationState: (params: CreateLocationInterpolationStateParams) => CreateLocationInterpolationStateResult;
|
|
24
|
+
export declare const evaluateLocationInterpolation: (state: SpriteInterpolationState<SpriteLocation>, timestamp: number) => SpriteInterpolationEvaluationResult<SpriteLocation>;
|
|
25
|
+
export declare const evaluateLocationInterpolationsBatch: (states: readonly SpriteInterpolationState<SpriteLocation>[], timestamp: number) => SpriteInterpolationEvaluationResult<SpriteLocation>[];
|
|
26
|
+
export interface LocationInterpolationWorkItem<TTag> extends SpriteInterpolationState<SpriteLocation> {
|
|
27
|
+
readonly sprite: InternalSpriteCurrentState<TTag>;
|
|
28
|
+
}
|
|
29
|
+
export declare const collectLocationInterpolationWorkItems: <TTag>(sprite: InternalSpriteCurrentState<TTag>, workItems: LocationInterpolationWorkItem<TTag>[]) => void;
|
|
30
|
+
export declare const applyLocationInterpolationEvaluations: <TTag>(workItems: readonly LocationInterpolationWorkItem<TTag>[], evaluations: readonly SpriteInterpolationEvaluationResult<SpriteLocation>[], timestamp: number) => boolean;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.19.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: 7bc93c11d7855dedb8d60f140af4e413252c32a7
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteInterpolationOptions } from '../types';
|
|
12
12
|
import { SpriteInterpolationState } from '../internalTypes';
|
|
13
|
-
export { normalizeAngleDeg } from '../utils/math';
|
|
14
13
|
/**
|
|
15
14
|
* Parameters describing the rotation update request.
|
|
16
15
|
*/
|
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.19.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: 7bc93c11d7855dedb8d60f140af4e413252c32a7
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { CustomLayerInterface } from 'maplibre-gl';
|
|
@@ -20,22 +20,6 @@ export interface SpriteLocation {
|
|
|
20
20
|
/** Elevation or virtual height. Defaults to 0 and is currently unused. */
|
|
21
21
|
z?: number;
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Offset describing where to place an image relative to its anchor point.
|
|
25
|
-
* Specifies distance and angle from the anchor, not from the sprite's base coordinate.
|
|
26
|
-
*/
|
|
27
|
-
export interface SpriteImageOffset {
|
|
28
|
-
/**
|
|
29
|
-
* Distance in meters from the image anchor. Zero keeps the image at the anchor point.
|
|
30
|
-
*/
|
|
31
|
-
offsetMeters: number;
|
|
32
|
-
/**
|
|
33
|
-
* Angle describing the offset direction. This is not the image rotation.
|
|
34
|
-
* Billboard mode: Clockwise degrees relative to the screen, 0 deg points upward.
|
|
35
|
-
* Surface mode: Clockwise degrees from geographic north.
|
|
36
|
-
*/
|
|
37
|
-
offsetDeg: number;
|
|
38
|
-
}
|
|
39
23
|
/**
|
|
40
24
|
* Line attribute.
|
|
41
25
|
*/
|
|
@@ -171,14 +155,14 @@ export interface SpriteInterpolationOptions {
|
|
|
171
155
|
* Interpolation configuration.
|
|
172
156
|
*/
|
|
173
157
|
export interface SpriteImageInterpolationOptions {
|
|
174
|
-
/** Interpolation settings for
|
|
175
|
-
|
|
158
|
+
/** Interpolation settings for finalRotateDeg; `null` will disable interpolation. */
|
|
159
|
+
finalRotateDeg?: SpriteInterpolationOptions | null;
|
|
176
160
|
/** Interpolation settings for offset.offsetDeg; `null` will disable interpolation. */
|
|
177
161
|
offsetDeg?: SpriteInterpolationOptions | null;
|
|
178
162
|
/** Interpolation settings for offset.offsetMeters; `null` will disable interpolation. */
|
|
179
163
|
offsetMeters?: SpriteInterpolationOptions | null;
|
|
180
|
-
/** Interpolation settings for
|
|
181
|
-
|
|
164
|
+
/** Interpolation settings for finalOpacity; `null` will disable interpolation. */
|
|
165
|
+
finalOpacity?: SpriteInterpolationOptions | null;
|
|
182
166
|
}
|
|
183
167
|
/**
|
|
184
168
|
* Sprite rendering modes.
|
|
@@ -200,8 +184,10 @@ export interface SpriteImageDefinitionInit {
|
|
|
200
184
|
scale?: number;
|
|
201
185
|
/** Anchor within the image. Defaults to [0.0, 0.0]. */
|
|
202
186
|
anchor?: SpriteAnchor;
|
|
203
|
-
/** Offset from the sprite coordinate. Defaults to
|
|
204
|
-
|
|
187
|
+
/** Offset distance in meters from the sprite coordinate. Defaults to 0. */
|
|
188
|
+
offsetMeters?: number;
|
|
189
|
+
/** Offset angle in degrees. Defaults to 0. */
|
|
190
|
+
offsetDeg?: number;
|
|
205
191
|
/** Optional border rendered around the image. */
|
|
206
192
|
border?: SpriteImageLineAttribute;
|
|
207
193
|
/** Optional leader line rendered toward the origin image. */
|
|
@@ -245,8 +231,10 @@ export interface SpriteImageDefinitionUpdate {
|
|
|
245
231
|
scale?: number;
|
|
246
232
|
/** Anchor within the image. */
|
|
247
233
|
anchor?: SpriteAnchor;
|
|
248
|
-
/** Offset from the sprite coordinate. */
|
|
249
|
-
|
|
234
|
+
/** Offset distance in meters from the sprite coordinate. */
|
|
235
|
+
offsetMeters?: number;
|
|
236
|
+
/** Offset angle in degrees. */
|
|
237
|
+
offsetDeg?: number;
|
|
250
238
|
/** Border rendered around the image. Specify null to remove. */
|
|
251
239
|
border?: SpriteImageLineAttribute | null;
|
|
252
240
|
/** Leader line rendered toward the origin image. Specify null to remove. */
|
|
@@ -367,27 +355,24 @@ export interface SpriteImageState {
|
|
|
367
355
|
readonly scale: number;
|
|
368
356
|
/** Anchor coordinates resolved for the image. */
|
|
369
357
|
readonly anchor: Readonly<SpriteAnchor>;
|
|
370
|
-
/**
|
|
371
|
-
readonly
|
|
358
|
+
/** User-specified rotation angle. */
|
|
359
|
+
readonly rotateDeg: number;
|
|
360
|
+
/** User-specified opacity. */
|
|
361
|
+
readonly opacity: number;
|
|
372
362
|
/** Offset applied relative to the anchor point. */
|
|
373
363
|
readonly offset: SpriteImageInterpolatedOffset;
|
|
374
364
|
/** Optional border rendered around the image. */
|
|
375
365
|
readonly border: SpriteImageLineAttributeState | undefined;
|
|
376
366
|
/** Optional leader line rendered toward the origin image. */
|
|
377
367
|
readonly leaderLine: SpriteImageLineAttributeState | undefined;
|
|
378
|
-
/**
|
|
379
|
-
* Additional rotation in degrees with interpolation metadata.
|
|
380
|
-
* `from`/`to` are `undefined` when no rotation animation is running.
|
|
381
|
-
*/
|
|
382
|
-
readonly rotateDeg: SpriteInterpolatedValues<number>;
|
|
383
368
|
/** Indicates whether auto-rotation is active. */
|
|
384
369
|
readonly autoRotation: boolean;
|
|
385
370
|
/** Minimum travel distance before auto-rotation updates. */
|
|
386
371
|
readonly autoRotationMinDistanceMeters: number;
|
|
387
|
-
/**
|
|
388
|
-
readonly
|
|
389
|
-
/**
|
|
390
|
-
readonly
|
|
372
|
+
/** Rotation angle applied when rendering (includes auto-rotation). */
|
|
373
|
+
readonly finalRotateDeg: SpriteInterpolatedValues<number>;
|
|
374
|
+
/** Opacity applied when rendering (includes multipliers). */
|
|
375
|
+
readonly finalOpacity: SpriteInterpolatedValues<number>;
|
|
391
376
|
/** Optional reference to another image used for anchoring. */
|
|
392
377
|
readonly originLocation: Readonly<SpriteImageOriginLocation> | undefined;
|
|
393
378
|
}
|
|
@@ -603,7 +588,7 @@ export interface SpriteLayerEventMap<TTag> {
|
|
|
603
588
|
*/
|
|
604
589
|
export type SpriteLayerEventListener<TTag, K extends keyof SpriteLayerEventMap<TTag>> = (event: SpriteLayerEventMap<TTag>[K]) => void;
|
|
605
590
|
/**
|
|
606
|
-
* Options controlling
|
|
591
|
+
* Options controlling distance-aware scaling.
|
|
607
592
|
*/
|
|
608
593
|
export interface SpriteScalingOptions {
|
|
609
594
|
/**
|
|
@@ -611,18 +596,16 @@ export interface SpriteScalingOptions {
|
|
|
611
596
|
* We strongly recommend specifying the default value of 1, as this value affects all calculations.
|
|
612
597
|
*/
|
|
613
598
|
metersPerPixel?: number;
|
|
614
|
-
/**
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
/** Maximum on-screen pixel size for sprites (0 disables the upper clamp). */
|
|
625
|
-
spriteMaxPixel?: number;
|
|
599
|
+
/**
|
|
600
|
+
* Distance (meters) from the camera at which sprites stop growing when getting closer.
|
|
601
|
+
* Set to 0 or omit to disable the near-distance clamp.
|
|
602
|
+
*/
|
|
603
|
+
minScaleDistanceMeters?: number;
|
|
604
|
+
/**
|
|
605
|
+
* Distance (meters) from the camera at which sprites stop shrinking when moving away.
|
|
606
|
+
* Set to 0 or omit to disable the far-distance clamp.
|
|
607
|
+
*/
|
|
608
|
+
maxScaleDistanceMeters?: number;
|
|
626
609
|
}
|
|
627
610
|
/**
|
|
628
611
|
* Allowed minification filters for sprite textures.
|
|
@@ -831,11 +814,11 @@ export interface SpriteLayerInterface<TTag = any> extends CustomLayerInterface {
|
|
|
831
814
|
*/
|
|
832
815
|
readonly getSpriteState: (spriteId: string) => SpriteCurrentState<TTag> | undefined;
|
|
833
816
|
/**
|
|
834
|
-
*
|
|
817
|
+
* Returns all sprite IDs currently managed by the layer.
|
|
835
818
|
*
|
|
836
|
-
* @
|
|
819
|
+
* @returns {string[]} Array of sprite identifiers.
|
|
837
820
|
*/
|
|
838
|
-
readonly
|
|
821
|
+
readonly getAllSpriteIds: () => string[];
|
|
839
822
|
/**
|
|
840
823
|
* Attaches an image definition to a sprite.
|
|
841
824
|
*
|
|
@@ -902,6 +885,27 @@ export interface SpriteLayerInterface<TTag = any> extends CustomLayerInterface {
|
|
|
902
885
|
* @param moveable - Continuous calculation for movement interpolation when value is true.
|
|
903
886
|
*/
|
|
904
887
|
readonly setInterpolationCalculation: (moveable: boolean) => void;
|
|
888
|
+
/**
|
|
889
|
+
* Enables or disables hit-test.
|
|
890
|
+
*
|
|
891
|
+
* @param {boolean} detect - When false, hit testing is skipped.
|
|
892
|
+
*/
|
|
893
|
+
readonly setHitTestDetection: (detect: boolean) => void;
|
|
894
|
+
/**
|
|
895
|
+
* Starts tracking a sprite so the map recenters on it every animation frame.
|
|
896
|
+
* When `trackRotation` is true (default), the sprite's final rotation follows the map bearing.
|
|
897
|
+
*
|
|
898
|
+
* @param {string} spriteId - Identifier of the sprite to track.
|
|
899
|
+
* @param {boolean} [trackRotation=true] - Whether to align the sprite's rotation to the map bearing.
|
|
900
|
+
* @returns {void}
|
|
901
|
+
*/
|
|
902
|
+
readonly trackSprite: (spriteId: string, trackRotation?: boolean) => void;
|
|
903
|
+
/**
|
|
904
|
+
* Stops tracking any sprite previously targeted via {@link trackSprite}.
|
|
905
|
+
*
|
|
906
|
+
* @returns {void}
|
|
907
|
+
*/
|
|
908
|
+
readonly untrackSprite: () => void;
|
|
905
909
|
/**
|
|
906
910
|
* Adds an event listener.
|
|
907
911
|
*
|
package/dist/utils/color.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.19.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: 7bc93c11d7855dedb8d60f140af4e413252c32a7
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { RgbaColor } from '../internalTypes';
|
package/dist/utils/image.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.19.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: 7bc93c11d7855dedb8d60f140af4e413252c32a7
|
|
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.
|
|
3
|
+
* version: 0.19.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: 7bc93c11d7855dedb8d60f140af4e413252c32a7
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
export interface Rect {
|