maplibre-gl-layers 0.3.0 → 0.4.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 +2 -2
- package/dist/easing.d.ts +2 -2
- package/dist/index.cjs +289 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +289 -36
- package/dist/index.mjs.map +1 -1
- package/dist/interpolation.d.ts +2 -2
- package/dist/location.d.ts +2 -2
- package/dist/math.d.ts +17 -11
- package/dist/numericInterpolation.d.ts +2 -2
- package/dist/rotationInterpolation.d.ts +2 -2
- package/dist/types.d.ts +31 -13
- package/dist/utils.d.ts +2 -2
- package/package.json +7 -7
package/dist/interpolation.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.4.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: 366a9e1190bfe770b4002a06284ff627188b5c76
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { EasingFunction, SpriteInterpolationMode, SpriteInterpolationOptions, SpriteLocation } from './types';
|
package/dist/location.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.4.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: 366a9e1190bfe770b4002a06284ff627188b5c76
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteLocation } from './types';
|
package/dist/math.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.4.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: 366a9e1190bfe770b4002a06284ff627188b5c76
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteAnchor, SpriteImageOffset, SpriteLocation, SpriteScalingOptions } from './types';
|
|
@@ -30,11 +30,6 @@ export declare const RAD2DEG: number;
|
|
|
30
30
|
* @constant
|
|
31
31
|
*/
|
|
32
32
|
export declare const TILE_SIZE = 512;
|
|
33
|
-
/**
|
|
34
|
-
* Default values that fill in missing {@link SpriteScalingOptions} fields supplied by callers.
|
|
35
|
-
* @constant
|
|
36
|
-
*/
|
|
37
|
-
export declare const DEFAULT_SPRITE_SCALING_OPTIONS: SpriteScalingOptions;
|
|
38
33
|
/**
|
|
39
34
|
* Structure holding resolved sprite scaling options.
|
|
40
35
|
* @property {number} metersPerPixel - Effective number of meters represented by each rendered pixel.
|
|
@@ -45,7 +40,7 @@ export declare const DEFAULT_SPRITE_SCALING_OPTIONS: SpriteScalingOptions;
|
|
|
45
40
|
* @property {number} spriteMinPixel - Lower clamp for sprite size in pixels.
|
|
46
41
|
* @property {number} spriteMaxPixel - Upper clamp for sprite size in pixels.
|
|
47
42
|
*/
|
|
48
|
-
export
|
|
43
|
+
export interface ResolvedSpriteScalingOptions {
|
|
49
44
|
metersPerPixel: number;
|
|
50
45
|
zoomMin: number;
|
|
51
46
|
zoomMax: number;
|
|
@@ -53,7 +48,7 @@ export type ResolvedSpriteScalingOptions = {
|
|
|
53
48
|
scaleMax: number;
|
|
54
49
|
spriteMinPixel: number;
|
|
55
50
|
spriteMaxPixel: number;
|
|
56
|
-
}
|
|
51
|
+
}
|
|
57
52
|
/**
|
|
58
53
|
* Fills missing {@link SpriteScalingOptions} values with defaults so downstream math can assume a complete object.
|
|
59
54
|
* @param options Optional scaling configuration from the caller.
|
|
@@ -140,7 +135,11 @@ export declare const calculateBillboardAnchorShiftPixels: (halfWidth: number, ha
|
|
|
140
135
|
* @param {number} zoomScaleFactor - Zoom-dependent scale multiplier.
|
|
141
136
|
* @returns {{ width: number; height: number }} Dimensions expressed as world-space meters.
|
|
142
137
|
*/
|
|
143
|
-
export declare const calculateSurfaceWorldDimensions: (imageWidth: number | undefined, imageHeight: number | undefined, baseMetersPerPixel: number, imageScale: number, zoomScaleFactor: number
|
|
138
|
+
export declare const calculateSurfaceWorldDimensions: (imageWidth: number | undefined, imageHeight: number | undefined, baseMetersPerPixel: number, imageScale: number, zoomScaleFactor: number, options?: {
|
|
139
|
+
effectivePixelsPerMeter?: number;
|
|
140
|
+
spriteMinPixel?: number;
|
|
141
|
+
spriteMaxPixel?: number;
|
|
142
|
+
}) => {
|
|
144
143
|
width: number;
|
|
145
144
|
height: number;
|
|
146
145
|
};
|
|
@@ -160,9 +159,10 @@ export declare const calculateSurfaceAnchorShiftMeters: (halfWidthMeters: number
|
|
|
160
159
|
* Calculates surface image offsets in meters.
|
|
161
160
|
* @param {SpriteImageOffset | undefined} offset - Offset configuration for the surface sprite.
|
|
162
161
|
* @param {number} imageScale - User-provided scale multiplier applied to the offset distance.
|
|
162
|
+
* @param {number} zoomScaleFactor - Zoom-dependent scale multiplier.
|
|
163
163
|
* @returns {{ east: number; north: number }} Offset vector in meters.
|
|
164
164
|
*/
|
|
165
|
-
export declare const calculateSurfaceOffsetMeters: (offset: SpriteImageOffset | undefined, imageScale: number) => {
|
|
165
|
+
export declare const calculateSurfaceOffsetMeters: (offset: SpriteImageOffset | undefined, imageScale: number, zoomScaleFactor: number) => {
|
|
166
166
|
east: number;
|
|
167
167
|
north: number;
|
|
168
168
|
};
|
|
@@ -399,6 +399,9 @@ export declare const calculateBillboardCornerScreenPositions: (params: Billboard
|
|
|
399
399
|
* @property {number} totalRotateDeg - Rotation applied to the sprite in degrees.
|
|
400
400
|
* @property {SpriteAnchor} [anchor] - Anchor definition normalized between -1 and 1.
|
|
401
401
|
* @property {SpriteImageOffset} [offset] - Offset definition applied in meters/deg.
|
|
402
|
+
* @property {number} [effectivePixelsPerMeter] - Conversion rate from meters to on-screen pixels.
|
|
403
|
+
* @property {number} [spriteMinPixel] - Lower clamp for the sprite's largest pixel dimension.
|
|
404
|
+
* @property {number} [spriteMaxPixel] - Upper clamp for the sprite's largest pixel dimension.
|
|
402
405
|
* @property {ProjectLngLatFn} [project] - Projection function mapping longitude/latitude to screen space.
|
|
403
406
|
* @property {ProjectToClipSpaceFn} [projectToClipSpace] - Projection into clip space when available.
|
|
404
407
|
* @property {number} [drawingBufferWidth] - WebGL drawing buffer width in device pixels.
|
|
@@ -417,6 +420,9 @@ export type SurfaceCenterParams = {
|
|
|
417
420
|
totalRotateDeg: number;
|
|
418
421
|
anchor?: SpriteAnchor;
|
|
419
422
|
offset?: SpriteImageOffset;
|
|
423
|
+
effectivePixelsPerMeter?: number;
|
|
424
|
+
spriteMinPixel?: number;
|
|
425
|
+
spriteMaxPixel?: number;
|
|
420
426
|
project?: ProjectLngLatFn;
|
|
421
427
|
projectToClipSpace?: ProjectToClipSpaceFn;
|
|
422
428
|
drawingBufferWidth?: number;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.4.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: 366a9e1190bfe770b4002a06284ff627188b5c76
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { EasingFunction, SpriteNumericInterpolationOptions } from './types';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.4.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: 366a9e1190bfe770b4002a06284ff627188b5c76
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { SpriteNumericInterpolationOptions } from './types';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.4.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: 366a9e1190bfe770b4002a06284ff627188b5c76
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import { CustomLayerInterface } from 'maplibre-gl';
|
|
@@ -449,11 +449,14 @@ export type SpriteLayerEventListener<T, K extends keyof SpriteLayerEventMap<T>>
|
|
|
449
449
|
* @property {number | undefined} zoomMax - Maximum zoom level before scaling adjustments apply.
|
|
450
450
|
* @property {number | undefined} scaleMin - Lower limit for scale clamping.
|
|
451
451
|
* @property {number | undefined} scaleMax - Upper limit for scale clamping.
|
|
452
|
-
* @property {number | undefined} spriteMinPixel - Minimum on-screen pixel size for sprites.
|
|
453
|
-
* @property {number | undefined} spriteMaxPixel - Maximum on-screen pixel size for sprites.
|
|
452
|
+
* @property {number | undefined} spriteMinPixel - Minimum on-screen pixel size for sprites (0 disables the lower clamp).
|
|
453
|
+
* @property {number | undefined} spriteMaxPixel - Maximum on-screen pixel size for sprites (0 disables the upper clamp).
|
|
454
454
|
*/
|
|
455
455
|
export interface SpriteScalingOptions {
|
|
456
|
-
/**
|
|
456
|
+
/**
|
|
457
|
+
* Overrides the baseline meters-per-pixel ratio.
|
|
458
|
+
* We strongly recommend specifying the default value of 1, as this value affects all calculations.
|
|
459
|
+
*/
|
|
457
460
|
metersPerPixel?: number;
|
|
458
461
|
/** Minimum zoom level before scaling adjustments apply. */
|
|
459
462
|
zoomMin?: number;
|
|
@@ -463,16 +466,26 @@ export interface SpriteScalingOptions {
|
|
|
463
466
|
scaleMin?: number;
|
|
464
467
|
/** Upper limit for scale clamping. */
|
|
465
468
|
scaleMax?: number;
|
|
466
|
-
/** Minimum on-screen pixel size for sprites. */
|
|
469
|
+
/** Minimum on-screen pixel size for sprites (0 disables the lower clamp). */
|
|
467
470
|
spriteMinPixel?: number;
|
|
468
|
-
/** Maximum on-screen pixel size for sprites. */
|
|
471
|
+
/** Maximum on-screen pixel size for sprites (0 disables the upper clamp). */
|
|
469
472
|
spriteMaxPixel?: number;
|
|
470
473
|
}
|
|
474
|
+
/**
|
|
475
|
+
* Unlimited (default) values that fill in missing {@link SpriteScalingOptions} fields supplied by callers.
|
|
476
|
+
* metersPerPixel is 1.
|
|
477
|
+
*/
|
|
478
|
+
export declare const UNLIMITED_SPRITE_SCALING_OPTIONS: SpriteScalingOptions;
|
|
479
|
+
/**
|
|
480
|
+
* Standard values that fill in missing {@link SpriteScalingOptions} fields supplied by callers.
|
|
481
|
+
* metersPerPixel is 1.
|
|
482
|
+
*/
|
|
483
|
+
export declare const STANDARD_SPRITE_SCALING_OPTIONS: SpriteScalingOptions;
|
|
471
484
|
/**
|
|
472
485
|
* Options accepted when creating a SpriteLayer.
|
|
473
486
|
*
|
|
474
487
|
* @property {string | undefined} id - Optional layer identifier supplied to MapLibre.
|
|
475
|
-
* @property {SpriteScalingOptions | undefined} spriteScaling - Optional scaling controls.
|
|
488
|
+
* @property {SpriteScalingOptions | undefined} spriteScaling - Optional scaling controls. Default is UNLIMITED_SPRITE_SCALING_OPTIONS.
|
|
476
489
|
*/
|
|
477
490
|
export interface SpriteLayerOptions {
|
|
478
491
|
/** Optional layer identifier supplied to MapLibre. */
|
|
@@ -489,6 +502,8 @@ export type SpriteTextGlyphPaddingPixel = number | {
|
|
|
489
502
|
bottom?: number;
|
|
490
503
|
left?: number;
|
|
491
504
|
};
|
|
505
|
+
/** Border sides that can be rendered for a text glyph outline. */
|
|
506
|
+
export type SpriteTextGlyphBorderSide = 'top' | 'right' | 'bottom' | 'left';
|
|
492
507
|
/** Additional size options accepted by registerTextGlyph. */
|
|
493
508
|
export type SpriteTextGlyphDimensions = {
|
|
494
509
|
readonly lineHeightPixel: number;
|
|
@@ -501,7 +516,6 @@ export type SpriteTextGlyphDimensions = {
|
|
|
501
516
|
* Text glyph appearance options.
|
|
502
517
|
*
|
|
503
518
|
* @property {string | undefined} fontFamily - Font family name.
|
|
504
|
-
* @property {number | undefined} fontSizePixel - Font size in pixels.
|
|
505
519
|
* @property {string | undefined} fontWeight - CSS font-weight value.
|
|
506
520
|
* @property {'normal' | 'italic' | undefined} fontStyle - CSS font-style value.
|
|
507
521
|
* @property {string | undefined} color - Text fill color.
|
|
@@ -510,15 +524,15 @@ export type SpriteTextGlyphDimensions = {
|
|
|
510
524
|
* @property {SpriteTextGlyphPaddingPixel | undefined} paddingPixel - Padding around the glyph.
|
|
511
525
|
* @property {string | undefined} borderColor - Outline color.
|
|
512
526
|
* @property {number | undefined} borderWidthPixel - Outline width in pixels.
|
|
527
|
+
* @property {SpriteTextGlyphBorderSide[] | undefined} borderSides - Border sides to draw (defaults to all four).
|
|
513
528
|
* @property {number | undefined} borderRadiusPixel - Border radius in pixels.
|
|
514
529
|
* @property {SpriteTextGlyphHorizontalAlign | undefined} textAlign - Horizontal alignment of multiline text.
|
|
515
|
-
* @property {number | undefined}
|
|
530
|
+
* @property {number | undefined} fontSizePixelHint - It is not specified normally. Preferred font size in pixels before dimension constraints are enforced.
|
|
531
|
+
* @property {number | undefined} renderPixelRatio - Canvas pixel ratio multiplier (defaults to 1) applied before the glyph is resampled to its logical size.
|
|
516
532
|
*/
|
|
517
533
|
export interface SpriteTextGlyphOptions {
|
|
518
534
|
/** Font family name. */
|
|
519
535
|
fontFamily?: string;
|
|
520
|
-
/** Font size in pixels. */
|
|
521
|
-
fontSizePixel?: number;
|
|
522
536
|
/** CSS font-weight value. */
|
|
523
537
|
fontWeight?: string;
|
|
524
538
|
/** CSS font-style value. */
|
|
@@ -535,11 +549,15 @@ export interface SpriteTextGlyphOptions {
|
|
|
535
549
|
borderColor?: string;
|
|
536
550
|
/** Outline width in pixels. */
|
|
537
551
|
borderWidthPixel?: number;
|
|
552
|
+
/** Border sides to draw; defaults to all four sides when omitted. */
|
|
553
|
+
borderSides?: readonly SpriteTextGlyphBorderSide[];
|
|
538
554
|
/** Border radius in pixels. */
|
|
539
555
|
borderRadiusPixel?: number;
|
|
540
556
|
/** Horizontal alignment of multiline text. */
|
|
541
557
|
textAlign?: SpriteTextGlyphHorizontalAlign;
|
|
542
|
-
/**
|
|
558
|
+
/** It is not specified normally. Preferred font size in pixels; may shrink automatically to satisfy provided dimensions. */
|
|
559
|
+
fontSizePixelHint?: number;
|
|
560
|
+
/** Pixel ratio used when rendering the glyph; defaults to 1 and values > 1 render at higher resolution before downscaling. */
|
|
543
561
|
renderPixelRatio?: number;
|
|
544
562
|
}
|
|
545
563
|
/**
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: maplibre-gl-layers
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 0.4.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: 366a9e1190bfe770b4002a06284ff627188b5c76
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/**
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"git": {
|
|
3
3
|
"tags": [
|
|
4
|
-
"0.
|
|
4
|
+
"0.4.0"
|
|
5
5
|
],
|
|
6
6
|
"branches": [
|
|
7
7
|
"main"
|
|
8
8
|
],
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.4.0",
|
|
10
10
|
"commit": {
|
|
11
|
-
"hash": "
|
|
12
|
-
"shortHash": "
|
|
13
|
-
"date": "2025-10-
|
|
11
|
+
"hash": "366a9e1190bfe770b4002a06284ff627188b5c76",
|
|
12
|
+
"shortHash": "366a9e1",
|
|
13
|
+
"date": "2025-10-29T22:23:19+09:00Z",
|
|
14
14
|
"message": "Merge branch 'develop'"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
"version": "0.
|
|
17
|
+
"version": "0.4.0",
|
|
18
18
|
"description": "MapLibre's layer extension library enabling the display, movement, and modification of large numbers of dynamic sprite images",
|
|
19
19
|
"author": "Kouji Matsui (@kekyo@mi.kekyo.net)",
|
|
20
20
|
"license": "MIT",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
],
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "vite build",
|
|
57
|
-
"dev": "
|
|
57
|
+
"dev": "npm run build",
|
|
58
58
|
"test": "npm run build && vitest run",
|
|
59
59
|
"test:e2e": "npm run build && playwright test",
|
|
60
60
|
"pack": "npm run build && screw-up pack --pack-destination ../artifacts"
|