@maptiler/sdk 4.2.0-rc.1 → 5.0.0-beta.m-r.1
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/README.md +276 -30
- package/dist/ImageViewer/ImageViewer.d.ts +6 -8
- package/dist/ImageViewer/ImageViewerMarker.d.ts +9 -9
- package/dist/ImageViewer/monkeyPatchML.d.ts +1 -1
- package/dist/Map.d.ts +155 -11
- package/dist/Marker/Marker.d.ts +397 -0
- package/dist/Marker/MarkerManager.d.ts +137 -0
- package/dist/Marker/altitude-math.d.ts +24 -0
- package/dist/Marker/collision-helpers.d.ts +160 -0
- package/dist/Marker/index.d.ts +2 -0
- package/dist/Marker/marker-adaptive-colors.d.ts +35 -0
- package/dist/Marker/marker-animation-presets.d.ts +60 -0
- package/dist/Marker/marker-constants.d.ts +111 -0
- package/dist/Marker/marker-content-registry.d.ts +17 -0
- package/dist/Marker/marker-dom-utils.d.ts +66 -0
- package/dist/Marker/marker-icons.d.ts +31 -0
- package/dist/Marker/marker-state-helpers.d.ts +2 -0
- package/dist/Marker/marker-svg-config.d.ts +84 -0
- package/dist/Marker/marker-symbols.d.ts +12 -0
- package/dist/Marker/marker-text-fit.d.ts +20 -0
- package/dist/Marker/marker-transitions.d.ts +29 -0
- package/dist/Marker/types.d.ts +458 -0
- package/dist/bundler/maplibre-gl-worker.mjs +13839 -0
- package/dist/bundler/next-worker.mjs +16 -0
- package/dist/bundler/next.cjs +42 -0
- package/dist/bundler/next.d.ts +6 -0
- package/dist/bundler/next.mjs +48 -0
- package/dist/bundler/side-effect.d.ts +2 -0
- package/dist/bundler/vite-worker.mjs +11 -0
- package/dist/bundler/webpack-worker.mjs +11 -0
- package/dist/config.d.ts +18 -0
- package/dist/constants/defaults.d.ts +0 -5
- package/dist/controls/MaptilerGeolocateControl.d.ts +1 -1
- package/dist/controls/MaptilerLogoControl.d.ts +1 -2
- package/dist/controls/MaptilerNavigationControl.d.ts +3 -4
- package/dist/controls/Minimap.d.ts +3 -3
- package/dist/eslint.mjs +4 -4
- package/dist/index.d.ts +9 -81
- package/dist/mapstyle.d.ts +11 -3
- package/dist/maptiler-sdk.css +108 -1
- package/dist/maptiler-sdk.d.ts +1 -1
- package/dist/maptiler-sdk.mjs +16763 -14351
- package/dist/maptiler-sdk.mjs.map +1 -1
- package/dist/routing.d.ts +1 -1
- package/dist/tools.d.ts +6 -7
- package/dist/utils/defaultWorkerUrl.d.ts +17 -0
- package/dist/utils/object.d.ts +1 -0
- package/package.json +26 -8
- package/dist/MLAdapters/AttributionControl.d.ts +0 -5
- package/dist/MLAdapters/BoxZoomHandler.d.ts +0 -7
- package/dist/MLAdapters/CanvasSource.d.ts +0 -5
- package/dist/MLAdapters/CooperativeGesturesHandler.d.ts +0 -5
- package/dist/MLAdapters/FullscreenControl.d.ts +0 -5
- package/dist/MLAdapters/GeoJSONSource.d.ts +0 -5
- package/dist/MLAdapters/GeolocateControl.d.ts +0 -5
- package/dist/MLAdapters/ImageSource.d.ts +0 -5
- package/dist/MLAdapters/KeyboardHandler.d.ts +0 -5
- package/dist/MLAdapters/LogoControl.d.ts +0 -5
- package/dist/MLAdapters/MapMouseEvent.d.ts +0 -5
- package/dist/MLAdapters/MapTouchEvent.d.ts +0 -5
- package/dist/MLAdapters/MapWheelEvent.d.ts +0 -5
- package/dist/MLAdapters/Marker.d.ts +0 -5
- package/dist/MLAdapters/NavigationControl.d.ts +0 -5
- package/dist/MLAdapters/Popup.d.ts +0 -5
- package/dist/MLAdapters/RasterDEMTileSource.d.ts +0 -5
- package/dist/MLAdapters/RasterTileSource.d.ts +0 -5
- package/dist/MLAdapters/ScaleControl.d.ts +0 -5
- package/dist/MLAdapters/ScrollZoomHandler.d.ts +0 -5
- package/dist/MLAdapters/Style.d.ts +0 -5
- package/dist/MLAdapters/TerrainControl.d.ts +0 -5
- package/dist/MLAdapters/TwoFingersTouchPitchHandler.d.ts +0 -5
- package/dist/MLAdapters/VectorTileSource.d.ts +0 -5
- package/dist/MLAdapters/VideoSource.d.ts +0 -5
- package/dist/ml-types.d.ts +0 -638
package/dist/Map.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Map as MapMLGL, StyleSpecification, MapOptions as MapOptionsML, ControlPosition, StyleSwapOptions, StyleOptions, RequestTransformFunction, LayerSpecification, SourceSpecification, CustomLayerInterface, FilterSpecification, StyleSetterOptions, ProjectionSpecification, FlyToOptions, EaseToOptions, FitBoundsOptions, AnimationOptions, LngLatBoundsLike, LngLatLike, AllPaintProperties, AllLayoutProperties, MapEventType, MapLayerEventType, Listener, Subscription, TerrainSpecification, Event as EventML } from 'maplibre-gl';
|
|
2
2
|
import { ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
|
|
3
3
|
import { SdkConfig } from './config';
|
|
4
4
|
import { LanguageInfo } from './language';
|
|
@@ -8,6 +8,7 @@ import { Telemetry } from './Telemetry';
|
|
|
8
8
|
import { CubemapDefinition, CubemapLayer, CubemapLayerConstructorOptions } from './custom-layers/CubemapLayer';
|
|
9
9
|
import { GradientDefinition, RadialGradientLayer, RadialGradientLayerConstructorOptions } from './custom-layers/RadialGradientLayer';
|
|
10
10
|
import { StyleSpecificationWithMetaData } from './custom-layers/extractCustomLayerStyle';
|
|
11
|
+
import { MapTilerMarkerOptions, Marker, MarkerCollisionOptions, RemoveMarkerOptions } from '.';
|
|
11
12
|
export type LoadWithTerrainEvent = {
|
|
12
13
|
type: "loadWithTerrain";
|
|
13
14
|
target: Map;
|
|
@@ -16,6 +17,45 @@ export type LoadWithTerrainEvent = {
|
|
|
16
17
|
exaggeration: number;
|
|
17
18
|
};
|
|
18
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* Shape of an event fired by the SDK on top of the MapLibre events,
|
|
22
|
+
* with the properties passed to `fire(type, properties)` merged in.
|
|
23
|
+
*/
|
|
24
|
+
type SDKMapEvent<TType extends string, TProps extends object = object> = EventML<TType> & {
|
|
25
|
+
target: Map;
|
|
26
|
+
} & TProps;
|
|
27
|
+
/**
|
|
28
|
+
* Events fired by the MapTiler SDK `Map` in addition to the MapLibre ones.
|
|
29
|
+
*/
|
|
30
|
+
export type MaptilerMapEventType = {
|
|
31
|
+
/** Fired once the map style and the SDK controls are ready */
|
|
32
|
+
ready: SDKMapEvent<"ready">;
|
|
33
|
+
/** Fired once the map is loaded and the terrain (if any) is ready */
|
|
34
|
+
loadWithTerrain: LoadWithTerrainEvent;
|
|
35
|
+
/** Fired when the WebGL context is lost unexpectedly (i.e. not after `map.remove()`) */
|
|
36
|
+
webglContextLost: SDKMapEvent<"webglContextLost">;
|
|
37
|
+
terrainAnimationStart: SDKMapEvent<"terrainAnimationStart", {
|
|
38
|
+
terrain: TerrainSpecification | null;
|
|
39
|
+
}>;
|
|
40
|
+
terrainAnimationStop: SDKMapEvent<"terrainAnimationStop", {
|
|
41
|
+
terrain: TerrainSpecification | null;
|
|
42
|
+
}>;
|
|
43
|
+
"projection.change": SDKMapEvent<"projection.change", {
|
|
44
|
+
projection: ProjectionSpecification;
|
|
45
|
+
}>;
|
|
46
|
+
"cubemaplayer:animateindone": SDKMapEvent<"cubemaplayer:animateindone", Partial<CubemapLayer>>;
|
|
47
|
+
"cubemaplayer:animateoutdone": SDKMapEvent<"cubemaplayer:animateoutdone", Partial<CubemapLayer>>;
|
|
48
|
+
"cubemaplayer:onremove": SDKMapEvent<"cubemaplayer:onremove", Partial<CubemapLayer>>;
|
|
49
|
+
"radialgradientlayer:animateindone": SDKMapEvent<"radialgradientlayer:animateindone", Partial<RadialGradientLayer>>;
|
|
50
|
+
"radialgradientlayer:animateoutdone": SDKMapEvent<"radialgradientlayer:animateoutdone", Partial<RadialGradientLayer>>;
|
|
51
|
+
"radialgradientlayer:onremove": SDKMapEvent<"radialgradientlayer:onremove", Partial<RadialGradientLayer>>;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* All the events that can be listened to on a MapTiler SDK `Map`: the MapLibre ones plus the SDK ones.
|
|
55
|
+
* Since MapLibre v6.3, `on`/`once`/`off`/`fire` only accept the keys of `MapEventType`,
|
|
56
|
+
* so the SDK `Map` overrides them to accept its own events as well.
|
|
57
|
+
*/
|
|
58
|
+
export type MapEventTypeSDK = MapEventType & MaptilerMapEventType;
|
|
19
59
|
export declare const GeolocationType: {
|
|
20
60
|
POINT: "POINT";
|
|
21
61
|
COUNTRY: "COUNTRY";
|
|
@@ -25,6 +65,11 @@ export declare const GeolocationType: {
|
|
|
25
65
|
* if falls back to the default Mercator
|
|
26
66
|
*/
|
|
27
67
|
export type ProjectionTypes = "mercator" | "globe" | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* Default zoom at/above which a `"globe"` projection request switches to flat mercator — see
|
|
70
|
+
* {@link MapOptions.globeMercatorSwitchZoom}.
|
|
71
|
+
*/
|
|
72
|
+
export declare const DEFAULT_GLOBE_MERCATOR_SWITCH_ZOOM = 11;
|
|
28
73
|
/**
|
|
29
74
|
* The {@link AttributionControl} options object
|
|
30
75
|
*/
|
|
@@ -157,6 +202,26 @@ export type MapOptions = Omit<MapOptionsML, "style" | "maplibreLogo" | "attribut
|
|
|
157
202
|
* If not provided, the style takes precedence. If provided, overwrite the style.
|
|
158
203
|
*/
|
|
159
204
|
projection?: ProjectionTypes;
|
|
205
|
+
/**
|
|
206
|
+
* MapLibre's plain `type: "globe"` already resolves to
|
|
207
|
+
* `["interpolate", ["linear"], ["zoom"], 11, "vertical-perspective", 12, "mercator"]` —
|
|
208
|
+
* vertical-perspective below zoom 11, linearly blended into flat mercator between 11 and 12.
|
|
209
|
+
* That blend is a MapLibre bug for anything that places objects via its per-projection model
|
|
210
|
+
* matrix (marker altitude, `maptiler-3d-js`): the matrix isn't well-defined mid-blend, only
|
|
211
|
+
* once it's settled fully at one end, so objects placed while zooming through 11-12 jump
|
|
212
|
+
* around.
|
|
213
|
+
*
|
|
214
|
+
* Whenever a projection change resolves to `"globe"` (constructor option, `setProjection`, or
|
|
215
|
+
* the {@link MaptilerProjectionControl}), the SDK requests
|
|
216
|
+
* `{ type: ["step", ["zoom"], "vertical-perspective", globeMercatorSwitchZoom, "mercator"] }`
|
|
217
|
+
* instead of the literal string — spherical below this zoom, flat mercator at and above it,
|
|
218
|
+
* snapping instantly at the threshold instead of blending across that zoom band.
|
|
219
|
+
*
|
|
220
|
+
* Set to `false` to request MapLibre's own `"globe"` literally instead, blend bug and all.
|
|
221
|
+
*
|
|
222
|
+
* Default: `11`
|
|
223
|
+
*/
|
|
224
|
+
globeMercatorSwitchZoom?: number | false;
|
|
160
225
|
/**
|
|
161
226
|
* Turn on/off spacebox.
|
|
162
227
|
*
|
|
@@ -169,11 +234,6 @@ export type MapOptions = Omit<MapOptionsML, "style" | "maplibreLogo" | "attribut
|
|
|
169
234
|
* Default: Unless this is set explicitly to false, the SDK version will be logged to the console.
|
|
170
235
|
*/
|
|
171
236
|
logSDKVersion?: boolean;
|
|
172
|
-
/**
|
|
173
|
-
* Whether to enable the RTL plugin or import a different one.
|
|
174
|
-
* Default is undefined, which means the plugin is enabled by default.
|
|
175
|
-
*/
|
|
176
|
-
rtlTextPlugin?: boolean | string;
|
|
177
237
|
/**
|
|
178
238
|
* Whether to enable the experimental tile preloading feature.
|
|
179
239
|
* Default is false.
|
|
@@ -202,8 +262,36 @@ export interface ProjectionChangeOptions {
|
|
|
202
262
|
/**
|
|
203
263
|
* The Map class can be instanciated to display a map in a `<div>`
|
|
204
264
|
*/
|
|
205
|
-
export declare class Map extends
|
|
265
|
+
export declare class Map extends MapMLGL {
|
|
206
266
|
readonly telemetry: Telemetry;
|
|
267
|
+
/**
|
|
268
|
+
* Adds a listener for events of a specified type, optionally limited to features in one or more layers.
|
|
269
|
+
* Accepts the MapLibre events as well as the SDK events (see {@link MaptilerMapEventType}).
|
|
270
|
+
*/
|
|
271
|
+
on<T extends keyof MapLayerEventType>(type: T, layerIds: string | string[], listener: (ev: MapLayerEventType[T] & object) => void): Subscription;
|
|
272
|
+
on<T extends keyof MapEventTypeSDK>(type: T, listener: (ev: MapEventTypeSDK[T] & object) => void): Subscription;
|
|
273
|
+
on(type: keyof MapEventTypeSDK, listener: Listener): Subscription;
|
|
274
|
+
/**
|
|
275
|
+
* Adds a listener that will be called only once to a specified event type, optionally limited to features in one or more layers.
|
|
276
|
+
* Accepts the MapLibre events as well as the SDK events (see {@link MaptilerMapEventType}).
|
|
277
|
+
*/
|
|
278
|
+
once<T extends keyof MapLayerEventType>(type: T, layerIds: string | string[], listener: (ev: MapLayerEventType[T] & object) => void): this;
|
|
279
|
+
once<T extends keyof MapLayerEventType>(type: T, layerIds: string | string[]): Promise<MapLayerEventType[T] & object>;
|
|
280
|
+
once<T extends keyof MapEventTypeSDK>(type: T, listener: (ev: MapEventTypeSDK[T] & object) => void): this;
|
|
281
|
+
once<T extends keyof MapEventTypeSDK>(type: T): Promise<MapEventTypeSDK[T] & object>;
|
|
282
|
+
once(type: keyof MapEventTypeSDK, listener?: Listener): this | Promise<any>;
|
|
283
|
+
/**
|
|
284
|
+
* Removes an event listener previously added with {@link Map.on} or {@link Map.once}.
|
|
285
|
+
* Accepts the MapLibre events as well as the SDK events (see {@link MaptilerMapEventType}).
|
|
286
|
+
*/
|
|
287
|
+
off<T extends keyof MapLayerEventType>(type: T, layerIds: string | string[], listener: (ev: MapLayerEventType[T] & object) => void): this;
|
|
288
|
+
off<T extends keyof MapEventTypeSDK>(type: T, listener: (ev: MapEventTypeSDK[T] & object) => void): this;
|
|
289
|
+
off(type: keyof MapEventTypeSDK, listener: Listener): this;
|
|
290
|
+
/**
|
|
291
|
+
* Fires an event. Accepts the MapLibre events as well as the SDK events (see {@link MaptilerMapEventType}).
|
|
292
|
+
*/
|
|
293
|
+
fire(event: MapEventTypeSDK[keyof MapEventTypeSDK]): this;
|
|
294
|
+
fire(type: keyof MapEventTypeSDK, properties?: object): this;
|
|
207
295
|
private space?;
|
|
208
296
|
private halo?;
|
|
209
297
|
getSpace(): CubemapLayer | undefined;
|
|
@@ -261,6 +349,7 @@ export declare class Map extends maplibregl.Map {
|
|
|
261
349
|
private terrainAnimationDuration;
|
|
262
350
|
private monitoredStyleUrls;
|
|
263
351
|
private styleInProcess;
|
|
352
|
+
private currentStyleId?;
|
|
264
353
|
private curentProjection;
|
|
265
354
|
private originalLabelStyle;
|
|
266
355
|
private isStyleLocalized;
|
|
@@ -310,6 +399,13 @@ export declare class Map extends maplibregl.Map {
|
|
|
310
399
|
*/
|
|
311
400
|
setStyle(style: null | ReferenceMapStyle | MapStyleVariant | StyleSpecification | StyleSpecificationWithMetaData | string, options?: StyleSwapOptions & StyleOptions): this;
|
|
312
401
|
private spaceboxLoadingState;
|
|
402
|
+
/**
|
|
403
|
+
* Returns the id of the current MapTiler style (e.g. `"streets-v4-dark"`),
|
|
404
|
+
* derived from the value passed to the constructor or `setStyle`.
|
|
405
|
+
* `undefined` when the style is a custom `StyleSpecification` or a URL that
|
|
406
|
+
* doesn't follow the MapTiler Cloud `/maps/<id>/style.json` shape.
|
|
407
|
+
*/
|
|
408
|
+
getStyleId(): string | undefined;
|
|
313
409
|
/**
|
|
314
410
|
* Adds a [MapLibre style layer](https://maplibre.org/maplibre-style-spec/layers)
|
|
315
411
|
* to the map's style.
|
|
@@ -361,6 +457,49 @@ export declare class Map extends maplibregl.Map {
|
|
|
361
457
|
* ```
|
|
362
458
|
*/
|
|
363
459
|
removeLayer(id: string): this;
|
|
460
|
+
/**
|
|
461
|
+
* Adds a marker to the map, registering it for collision handling and style-aware colours.
|
|
462
|
+
* Plays the marker's `enter` animation, if it has one.
|
|
463
|
+
* @param markerOrMarkerConfig - A `Marker`, or the options to create one from.
|
|
464
|
+
*/
|
|
465
|
+
addMarker(markerOrMarkerConfig: Marker | MapTilerMarkerOptions): this;
|
|
466
|
+
/**
|
|
467
|
+
* Removes a marker from the map, playing its `exit` animation first, if it has one.
|
|
468
|
+
* @param id - Id of the marker to remove.
|
|
469
|
+
* @param options.immediate - Removes the marker straight away, without its `exit` animation.
|
|
470
|
+
*/
|
|
471
|
+
removeMarker(id: string, options?: RemoveMarkerOptions): this;
|
|
472
|
+
/**
|
|
473
|
+
* Adds several markers to the map. See {@link Map.addMarker}.
|
|
474
|
+
* @param markers - `Marker`s, or the options to create them from.
|
|
475
|
+
*/
|
|
476
|
+
addMarkers(markers: (Marker | MapTilerMarkerOptions)[]): this;
|
|
477
|
+
/**
|
|
478
|
+
* Removes several markers from the map, playing their `exit` animations first, if they have them.
|
|
479
|
+
* @param markerIds - Ids of the markers to remove. Removes every marker when omitted.
|
|
480
|
+
* @param options.immediate - Removes the markers straight away, without their `exit` animations.
|
|
481
|
+
*/
|
|
482
|
+
removeMarkers(markerIds?: string[], options?: RemoveMarkerOptions): this;
|
|
483
|
+
/** Returns every marker added to the map. */
|
|
484
|
+
getMarkers(): Marker[];
|
|
485
|
+
/** Returns the marker with the given id, or `undefined` if it isn't on the map. */
|
|
486
|
+
getMarker(id: string): Marker | undefined;
|
|
487
|
+
/**
|
|
488
|
+
* Configures marker collision detection for this map.
|
|
489
|
+
* @param options.proximityPadding - Distance in CSS px within which two
|
|
490
|
+
* markers count as "in proximity". Overlap always uses 0.
|
|
491
|
+
* @param options.accuracy - `high` (default) tests rotated markers with
|
|
492
|
+
* their actual rotated box; `low` uses the upright box enclosing it,
|
|
493
|
+
* which is cheaper per pair but over-reports collisions for rotated
|
|
494
|
+
* markers (it never misses a real one).
|
|
495
|
+
* @param options.behaviour - Default collision behaviour applied to every
|
|
496
|
+
* marker on this map (`always-show` | `hide-by-priority` |
|
|
497
|
+
* `minimize-by-priority`). A marker's own `collisionBehaviour` option
|
|
498
|
+
* overrides it. Defaults to `always-show`.
|
|
499
|
+
* @param options.transitionDuration - Duration in ms of the hide/show/minimize fade. Defaults to `150`.
|
|
500
|
+
* @param options.transitionEasing - CSS easing function for the fade. Defaults to `"ease"`.
|
|
501
|
+
*/
|
|
502
|
+
setMarkerCollisionOptions(options: MarkerCollisionOptions): this;
|
|
364
503
|
/**
|
|
365
504
|
* Sets the zoom extent for the specified style layer. The zoom extent includes the
|
|
366
505
|
* [minimum zoom level](https://maplibre.org/maplibre-style-spec/layers/#minzoom)
|
|
@@ -399,7 +538,7 @@ export declare class Map extends maplibregl.Map {
|
|
|
399
538
|
* map.setPaintProperty('my-layer', 'fill-color', '#faafee');
|
|
400
539
|
* ```
|
|
401
540
|
*/
|
|
402
|
-
setPaintProperty(layerId: string, name:
|
|
541
|
+
setPaintProperty<K extends keyof AllPaintProperties>(layerId: string, name: K, value: AllPaintProperties[K], options?: StyleSetterOptions): this;
|
|
403
542
|
/**
|
|
404
543
|
* Sets the value of a layout property in the specified style layer.
|
|
405
544
|
* Layout properties define how the layer is styled.
|
|
@@ -413,7 +552,7 @@ export declare class Map extends maplibregl.Map {
|
|
|
413
552
|
* @param options - Options object.
|
|
414
553
|
* @returns `this`
|
|
415
554
|
*/
|
|
416
|
-
setLayoutProperty(layerId: string, name:
|
|
555
|
+
setLayoutProperty<K extends keyof AllLayoutProperties>(layerId: string, name: K, value: AllLayoutProperties[K], options?: StyleSetterOptions): this;
|
|
417
556
|
/**
|
|
418
557
|
* Sets the value of the style's glyphs property.
|
|
419
558
|
*
|
|
@@ -509,7 +648,11 @@ export declare class Map extends maplibregl.Map {
|
|
|
509
648
|
*/
|
|
510
649
|
getProjection(): ProjectionSpecification;
|
|
511
650
|
/**
|
|
512
|
-
* Returns whether a globe projection is currently
|
|
651
|
+
* Returns whether a globe-family projection is currently configured — `"globe"`,
|
|
652
|
+
* `"vertical-perspective"`, or the `globeMercatorSwitchZoom` step expression this class
|
|
653
|
+
* requests for `"globe"` (see {@link MapOptions.globeMercatorSwitchZoom}). This reflects the
|
|
654
|
+
* configured projection, not the instantaneous rendered state — under the step expression it
|
|
655
|
+
* stays `true` even after zooming past the switch threshold into flat mercator rendering.
|
|
513
656
|
*/
|
|
514
657
|
isGlobeProjection(): boolean;
|
|
515
658
|
/**
|
|
@@ -530,7 +673,7 @@ export declare class Map extends maplibregl.Map {
|
|
|
530
673
|
* Sets the projection to a {@linkcode ProjectionSpecification}.
|
|
531
674
|
* @param projection - the projection specification to set
|
|
532
675
|
*/
|
|
533
|
-
setProjection(projection:
|
|
676
|
+
setProjection(projection: ProjectionSpecification): this;
|
|
534
677
|
/**
|
|
535
678
|
* Forget the persisted projection - from both constructor option and result of any `map.setProjection(..., { persist: true })` calls.
|
|
536
679
|
*/
|
|
@@ -684,3 +827,4 @@ export declare class Map extends maplibregl.Map {
|
|
|
684
827
|
*/
|
|
685
828
|
private resolveCameraPosition;
|
|
686
829
|
}
|
|
830
|
+
export {};
|
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
import { Marker as MLMarker, CustomLayerProjectionData, LngLatLike, PointLike, Subscription } from 'maplibre-gl';
|
|
2
|
+
import { Map as SDKMap } from '../Map';
|
|
3
|
+
import { MapTilerMarkerElementOptions, MapTilerMarkerSVGOptions, PendingMarkerUpdates, Vector2, MapTilerMarkerOptions, MarkerCollisionEventData, MarkerCollisionDisplayState, MapTilerMarkerUIStateName, UIStateSpec, MarkerTransitionProperty, MapTilerMarkerTransitions, MarkerTransitionSpec, MarkerEventTypeSDK, GroundLineOptions, AltitudeReference, SetAltitudeOptions } from './types';
|
|
4
|
+
import { MarkerFootprint } from './collision-helpers';
|
|
5
|
+
import { PendingUpdatesSymbol, DetachFromDOMSymbol, FlushDOMUpdatesSymbol, MarkerElementSymbol, RefreshAdaptiveColorSymbol, CollisionFootprintSymbol, EmitCollisionDiffSymbol, ApplyCollisionDisplayStateSymbol, ApplyAltitudeFrameSymbol, MeasuredElementSizeSymbol, ClearFocusStateSymbol, AttachToMapSymbol } from './marker-symbols';
|
|
6
|
+
/** MapLibre's `Marker` extended with 2-D scale, named shapes, colour tokens, and batched DOM updates. */
|
|
7
|
+
export declare class Marker extends MLMarker {
|
|
8
|
+
/** Construction-time options snapshot — not updated by setters. */
|
|
9
|
+
readonly options: MapTilerMarkerOptions;
|
|
10
|
+
readonly _scale = 1;
|
|
11
|
+
/** Current values of all element-affecting properties. Written only via {@link setProp}. */
|
|
12
|
+
private readonly props;
|
|
13
|
+
/** Whether the shape anchor offset is auto-managed — `false` with an explicit `offset` or custom `element`. */
|
|
14
|
+
private readonly managesOffset;
|
|
15
|
+
/** The DOM element **/
|
|
16
|
+
[MarkerElementSymbol]: HTMLElement;
|
|
17
|
+
/** Property updates waiting to be flushed to the DOM on the next animation frame. */
|
|
18
|
+
[PendingUpdatesSymbol]: PendingMarkerUpdates;
|
|
19
|
+
/** Unscaled CSS pixel size of a custom `element`, measured once at registration. `null` until measured; unused for built-in SVG markers. */
|
|
20
|
+
[MeasuredElementSizeSymbol]: Vector2 | null;
|
|
21
|
+
/** UUID that uniquely identifies this marker instance. */
|
|
22
|
+
readonly id: string;
|
|
23
|
+
/**
|
|
24
|
+
* The `classList` of the marker's wrapper element — the inner transform
|
|
25
|
+
* wrapper of a built-in marker, or the custom `element` itself. Read-only
|
|
26
|
+
* reference; add and remove classes through the returned list.
|
|
27
|
+
*/
|
|
28
|
+
get classList(): DOMTokenList;
|
|
29
|
+
/** How the collision engine is currently displaying this marker. */
|
|
30
|
+
private collisionDisplayState;
|
|
31
|
+
/** Visual props overridden while minimized, restored from {@link props} on un-minimize. Empty when not minimized. */
|
|
32
|
+
private minimizedKeys;
|
|
33
|
+
/** Whether the minimized appearance is currently applied to the DOM. Lags {@link collisionDisplayState} during fades. */
|
|
34
|
+
private minimizedApplied;
|
|
35
|
+
/** Pending mid-fade appearance swap for minimize transitions. */
|
|
36
|
+
private minimizeSwapTimer;
|
|
37
|
+
/** Pending post-fade cull (`display: none`) while hidden. */
|
|
38
|
+
private cullTimer;
|
|
39
|
+
/** Pending release of the collision fade class once no fade/dip is in flight. */
|
|
40
|
+
private fadeClassReleaseTimer;
|
|
41
|
+
/** Registered property overrides per UI state, keyed by state name. */
|
|
42
|
+
private uiStates;
|
|
43
|
+
/** UI states currently active (interaction-driven). */
|
|
44
|
+
private readonly activeUIStates;
|
|
45
|
+
/** Keys owned by the flattened active UI state, masked out of DOM flushes like {@link minimizedKeys}. */
|
|
46
|
+
private appliedUIStateKeys;
|
|
47
|
+
/** Registered per-property transition config, keyed by property name. */
|
|
48
|
+
private transitions;
|
|
49
|
+
/** In-flight transitions, keyed by property — at most one each. `"opacity"` isn't a public {@link MarkerTransitionProperty}, reused for enter/exit fades. */
|
|
50
|
+
private readonly activeTransitions;
|
|
51
|
+
/** The currently-looping `idle` animation, if any — started after `enter` finishes (or immediately), stopped on `remove()`. */
|
|
52
|
+
private idleAnimation;
|
|
53
|
+
/** Configured enter/idle/exit lifecycle animations. */
|
|
54
|
+
private animations;
|
|
55
|
+
/** Set during `addTo()`'s call into the base `addTo()`, which calls `this.remove()` first to detach from any previous map. */
|
|
56
|
+
private suppressLifecycleAnimations;
|
|
57
|
+
/** Altitude in meters, faked via a per-frame pixel offset (MapLibre's Marker has no native Z). 0 by default — see {@link setAltitude}. */
|
|
58
|
+
private altitudeMeters;
|
|
59
|
+
/** What {@link altitudeMeters} is measured from — see {@link AltitudeReference}. */
|
|
60
|
+
private altitudeReference;
|
|
61
|
+
/** True once {@link setAltitude} has been called at least once — see {@link hasActiveAltitude}. */
|
|
62
|
+
private altitudeEngaged;
|
|
63
|
+
/** The offset MapLibre would show with no altitude applied. Only {@link writeOffset} should write the real offset — anything that calls `super.setOffset` directly clobbers altitude. */
|
|
64
|
+
private baseOffset;
|
|
65
|
+
/** Pixel delta from `groundBase` to `elevated`, added to {@link baseOffset}. Null when off-screen/behind camera. */
|
|
66
|
+
private altitudeDelta;
|
|
67
|
+
/** The `elevated` point in absolute canvas CSS pixels — the ground line's position. */
|
|
68
|
+
private groundLineOrigin;
|
|
69
|
+
/** True when off-screen/behind the camera. Not the below-ground case — see {@link altitudeOccluded}. */
|
|
70
|
+
private altitudeHidden;
|
|
71
|
+
/** True when below ground (`computeAltitudeProjection`'s `belowGround`). */
|
|
72
|
+
private altitudeOccluded;
|
|
73
|
+
private groundLineEnabled;
|
|
74
|
+
private groundLineOptions;
|
|
75
|
+
private groundLineEl;
|
|
76
|
+
/**
|
|
77
|
+
* Creates a marker from a pre-built DOM or SVG element.
|
|
78
|
+
*
|
|
79
|
+
* `shape`/`size` don't apply. Color/shadow options still apply as CSS
|
|
80
|
+
* custom properties for the element's own styles to consume.
|
|
81
|
+
*/
|
|
82
|
+
constructor(options: MapTilerMarkerElementOptions);
|
|
83
|
+
/** Creates a marker styled via the built-in SVG system (`shape`, `size`, colour tokens, shadow). With no options, uses the default appearance. */
|
|
84
|
+
constructor(options?: MapTilerMarkerSVGOptions);
|
|
85
|
+
/**
|
|
86
|
+
* Adds a listener for events of a specified type.
|
|
87
|
+
* Accepts the MapLibre events as well as the SDK events (see {@link MaptilerMarkerEventType}).
|
|
88
|
+
*/
|
|
89
|
+
on<T extends keyof MarkerEventTypeSDK>(type: T, listener: (ev: MarkerEventTypeSDK[T]) => void): Subscription;
|
|
90
|
+
/**
|
|
91
|
+
* Adds a listener that will be called only once to a specified event type.
|
|
92
|
+
* Accepts the MapLibre events as well as the SDK events (see {@link MaptilerMarkerEventType}).
|
|
93
|
+
*/
|
|
94
|
+
once<T extends keyof MarkerEventTypeSDK>(type: T): Promise<MarkerEventTypeSDK[T]>;
|
|
95
|
+
once<T extends keyof MarkerEventTypeSDK>(type: T, listener: (ev: MarkerEventTypeSDK[T]) => void): this;
|
|
96
|
+
/**
|
|
97
|
+
* Removes an event listener previously added with {@link Marker.on} or {@link Marker.once}.
|
|
98
|
+
* Accepts the MapLibre events as well as the SDK events (see {@link MaptilerMarkerEventType}).
|
|
99
|
+
*/
|
|
100
|
+
off<T extends keyof MarkerEventTypeSDK>(type: T, listener: (ev: MarkerEventTypeSDK[T]) => void): this;
|
|
101
|
+
/**
|
|
102
|
+
* Adds the marker to a map. Equivalent to `map.addMarker(marker)`, which it delegates to.
|
|
103
|
+
* @deprecated Use `map.addMarker(marker)` instead. Kept for MapLibre-style call sites and will be removed in a future major version.
|
|
104
|
+
* @param map - Target map instance.
|
|
105
|
+
*/
|
|
106
|
+
addTo(map: SDKMap): this;
|
|
107
|
+
/**
|
|
108
|
+
* Attaches the marker to a map, and plays the configured `enter` animation (if any) once attached.
|
|
109
|
+
* Called only by `MarkerManager` during registration.
|
|
110
|
+
* @param map - Target map instance.
|
|
111
|
+
*/
|
|
112
|
+
[AttachToMapSymbol](map: SDKMap): this;
|
|
113
|
+
/** Recomputes the shape anchor offset so the shape's tip stays on the lngLat. No-op with an explicit `offset` or custom `element`. */
|
|
114
|
+
private applyShapeAnchorOffset;
|
|
115
|
+
/**
|
|
116
|
+
* Records a property's new value and schedules a DOM flush on the next
|
|
117
|
+
* animation frame via {@link MarkerManager}.
|
|
118
|
+
* @param prop - The element property to update.
|
|
119
|
+
* @param value - The new value for the property.
|
|
120
|
+
*/
|
|
121
|
+
private setProp;
|
|
122
|
+
/**
|
|
123
|
+
* Applies all pending property updates to the marker element and clears
|
|
124
|
+
* the batch. Called by {@link MarkerManager} on the next animation frame.
|
|
125
|
+
*/
|
|
126
|
+
[FlushDOMUpdatesSymbol](): void;
|
|
127
|
+
/** Returns the style id of the map this marker is on, or `undefined` when detached. */
|
|
128
|
+
private getCurrentStyleId;
|
|
129
|
+
/** Queues re-resolving every unset colour against the current map style. */
|
|
130
|
+
[RefreshAdaptiveColorSymbol](): void;
|
|
131
|
+
/** Sets one colour prop; `undefined` returns it to its map-style default (resolved at flush time, so nothing to transition to). */
|
|
132
|
+
private setColorProp;
|
|
133
|
+
/** A colour prop's value in effect — the explicit one, else the default for the map's style. */
|
|
134
|
+
private getEffectiveColor;
|
|
135
|
+
/** Resolves the marker's screen footprint for collision detection. Always full-size, even minimized. */
|
|
136
|
+
[CollisionFootprintSymbol](): MarkerFootprint;
|
|
137
|
+
/** Shape/size keys, or minimized substitutes. */
|
|
138
|
+
private effectiveShapeAndSize;
|
|
139
|
+
/** Screen offset for the collision footprint. */
|
|
140
|
+
private footprintOffset;
|
|
141
|
+
/** Fires the collision transition event (`markeroverlap`/`markerproximity`). */
|
|
142
|
+
[EmitCollisionDiffSymbol](data: MarkerCollisionEventData): void;
|
|
143
|
+
/**
|
|
144
|
+
* Applies the collision engine's display-state decision.
|
|
145
|
+
*
|
|
146
|
+
* Every transition fades. Hide/show fade in place; visible<->minimized
|
|
147
|
+
* fades *through* zero (dip out, swap at the invisible midpoint, fade back in).
|
|
148
|
+
*/
|
|
149
|
+
[ApplyCollisionDisplayStateSymbol](state: MarkerCollisionDisplayState): void;
|
|
150
|
+
/** Toggles the collision-hidden fade and reschedules releasing the fade class — see {@link fadeClassReleaseTimer}. */
|
|
151
|
+
private setCollisionHidden;
|
|
152
|
+
/** The fade duration (ms) configured for this marker's map, or the SDK default when off a map. */
|
|
153
|
+
private collisionTransitionMs;
|
|
154
|
+
/** Applies or restores the minimized appearance if it differs from what the DOM shows. */
|
|
155
|
+
private setMinimizedApplied;
|
|
156
|
+
/** Returns how the collision engine is currently displaying this marker. */
|
|
157
|
+
getCollisionDisplayState(): MarkerCollisionDisplayState;
|
|
158
|
+
/** The visual props the minimized appearance overrides for this marker. */
|
|
159
|
+
private minimizedOverrides;
|
|
160
|
+
/** Applies or restores the minimized appearance, straight to the DOM (never {@link setProp}). */
|
|
161
|
+
private applyMinimizedAppearance;
|
|
162
|
+
/** Builds the batch restoring `keys` to their prop values. */
|
|
163
|
+
private restoreUpdates;
|
|
164
|
+
/**
|
|
165
|
+
* Sets the marker's geographical position.
|
|
166
|
+
* @param lnglat - The new position.
|
|
167
|
+
*/
|
|
168
|
+
setLngLat(lnglat: LngLatLike): this;
|
|
169
|
+
/**
|
|
170
|
+
* Sets the marker's screen-space pixel offset. Composes with altitude (see {@link writeOffset}) rather than replacing it.
|
|
171
|
+
* @param offset - Offset in pixels (+y down).
|
|
172
|
+
*/
|
|
173
|
+
setOffset(offset: PointLike): this;
|
|
174
|
+
/** The only path that should write MapLibre's real offset: records `offset` as {@link baseOffset}, then writes `base + altitudeDelta`. Callers must never use `super.setOffset` directly, or altitude gets silently dropped. */
|
|
175
|
+
private writeOffset;
|
|
176
|
+
/**
|
|
177
|
+
* Sets the 2-D scale of the marker as `[x, y]`.
|
|
178
|
+
* @param scaleVector - Scale factors for the x and y axes.
|
|
179
|
+
*/
|
|
180
|
+
setScale(scaleVector: Vector2): void;
|
|
181
|
+
/** Returns the current 2-D scale. Defaults to `[1, 1]`. */
|
|
182
|
+
getScale(): Vector2 | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* Sets the marker shape. Applies the new anchor offset (see {@link applyShapeAnchorOffset}).
|
|
185
|
+
* @param shape - Marker shape key.
|
|
186
|
+
*/
|
|
187
|
+
setShape(shape: MapTilerMarkerOptions["shape"]): void;
|
|
188
|
+
/** Returns the current shape, or `undefined` if never set. */
|
|
189
|
+
getShape(): import('./types').MapTilerMarkerShape | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Sets the marker size.
|
|
192
|
+
* @param size - Marker size key.
|
|
193
|
+
*/
|
|
194
|
+
setSize(size: MapTilerMarkerOptions["size"]): void;
|
|
195
|
+
/** Returns the current size, or `undefined` if never explicitly set. */
|
|
196
|
+
getSize(): import('./types').MapTilerMarkerSize | undefined;
|
|
197
|
+
/**
|
|
198
|
+
* Sets the drop-shadow intensity.
|
|
199
|
+
* @param shadow - Shadow intensity preset, or `undefined` to reset to the default (`"medium"`). Use `"none"` to disable.
|
|
200
|
+
*/
|
|
201
|
+
setShadow(shadow: MapTilerMarkerOptions["shadow"]): void;
|
|
202
|
+
/** Returns the current shadow preset, or `undefined` if none is set. */
|
|
203
|
+
getShadow(): import('./types').MapTilerMarkerShadow | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Sets the fill colour of the outer body of the marker.
|
|
206
|
+
* @param color - Any valid CSS colour string, or `undefined` to return to the map-style default.
|
|
207
|
+
*/
|
|
208
|
+
setOuterColor(color: MapTilerMarkerOptions["outerColor"]): void;
|
|
209
|
+
/** Returns the outer body colour currently in effect — the explicit `outerColor`, else the default for the map's style. */
|
|
210
|
+
getOuterColor(): string;
|
|
211
|
+
/**
|
|
212
|
+
* Sets an explicit fill colour for the inner area of the marker, replacing
|
|
213
|
+
* the map-style default.
|
|
214
|
+
* @param color - Any valid CSS colour string, or `undefined` to return to the map-style default.
|
|
215
|
+
*/
|
|
216
|
+
setInnerColor(color: MapTilerMarkerOptions["innerColor"]): void;
|
|
217
|
+
/** Returns the inner area colour currently in effect — the explicit `innerColor`, else the default for the map's style. */
|
|
218
|
+
getInnerColor(): string;
|
|
219
|
+
/**
|
|
220
|
+
* Sets the colour applied to the marker content (icon, text, etc.).
|
|
221
|
+
* @param color - Any valid CSS colour string, or `undefined` to return to the map-style default.
|
|
222
|
+
*/
|
|
223
|
+
setContentColor(color: MapTilerMarkerOptions["contentColor"]): void;
|
|
224
|
+
/** Returns the content colour currently in effect — the explicit `contentColor`, else the default for the map's style. */
|
|
225
|
+
getContentColor(): string;
|
|
226
|
+
/**
|
|
227
|
+
* Sets the stroke colour of the marker outline.
|
|
228
|
+
* Has no visible effect unless {@link setOutline} is also called.
|
|
229
|
+
* @param color - Any valid CSS colour string, or `undefined` to return to the map-style default.
|
|
230
|
+
*/
|
|
231
|
+
setOutlineColor(color: MapTilerMarkerOptions["outlineColor"]): void;
|
|
232
|
+
/** Returns the outline stroke colour currently in effect — the explicit `outlineColor`, else the default for the map's style. */
|
|
233
|
+
getOutlineColor(): string;
|
|
234
|
+
/**
|
|
235
|
+
* Sets the outline stroke width on the marker body.
|
|
236
|
+
* @param outline - `true` for the default width, a positive `number` for an
|
|
237
|
+
* explicit pixel width, or `undefined` to remove the outline.
|
|
238
|
+
*/
|
|
239
|
+
setOutline(outline: MapTilerMarkerOptions["outline"]): void;
|
|
240
|
+
/** Returns the current outline value (`true`, a pixel width, or `undefined`). */
|
|
241
|
+
getOutline(): number | true | undefined;
|
|
242
|
+
/**
|
|
243
|
+
* Sets the `title` attribute on the marker's root element (native tooltip).
|
|
244
|
+
* @param title - Tooltip string, or `undefined` to remove the attribute.
|
|
245
|
+
*/
|
|
246
|
+
setTitle(title: MapTilerMarkerOptions["title"]): void;
|
|
247
|
+
/** Returns the current title string. */
|
|
248
|
+
getTitle(): string | undefined;
|
|
249
|
+
/**
|
|
250
|
+
* Sets the text content displayed inside the marker body.
|
|
251
|
+
* @param content - Label string, or `undefined` to clear.
|
|
252
|
+
*/
|
|
253
|
+
setContent(content: MapTilerMarkerOptions["content"]): void;
|
|
254
|
+
/** Returns the current content string. */
|
|
255
|
+
getContent(): string | undefined;
|
|
256
|
+
/**
|
|
257
|
+
* Sets the rendering priority.
|
|
258
|
+
* @param priority - Numeric priority, a MapLibre-style expression, or
|
|
259
|
+
* `undefined` to restore DOM-order stacking.
|
|
260
|
+
*/
|
|
261
|
+
setPriority(priority: MapTilerMarkerOptions["priority"]): void;
|
|
262
|
+
/** Returns the current rendering priority, or `undefined` if never set. */
|
|
263
|
+
getPriority(): number | import('./types').MarkerPriorityExpression | undefined;
|
|
264
|
+
/**
|
|
265
|
+
* Shows or hides the debug overlay, which renders the marker's bounding
|
|
266
|
+
* box and center point on top of the marker element.
|
|
267
|
+
* @param debug - `true` to show the overlay, `false`/`undefined` to hide it.
|
|
268
|
+
*/
|
|
269
|
+
setDebug(debug: MapTilerMarkerOptions["debug"]): void;
|
|
270
|
+
/** Returns whether the debug overlay is currently enabled. */
|
|
271
|
+
getDebug(): boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Rotates the marker's inner shell element in degrees, via the CSS
|
|
274
|
+
* `scale(x, y) rotate(deg)` transform on the inner wrapper — independent
|
|
275
|
+
* of MapLibre's own rotation on the outer container.
|
|
276
|
+
* @param rotation - Clockwise rotation in degrees.
|
|
277
|
+
*/
|
|
278
|
+
setRotation(rotation: number): this;
|
|
279
|
+
/**
|
|
280
|
+
* Returns the current inner-shell rotation in degrees.
|
|
281
|
+
* @returns Rotation in degrees; `0` if never set.
|
|
282
|
+
*/
|
|
283
|
+
getRotation(): number;
|
|
284
|
+
private attachUIStateListeners;
|
|
285
|
+
/** Blurs the marker's focusable element. Called by {@link MarkerManager} on map `click`. */
|
|
286
|
+
[ClearFocusStateSymbol](): void;
|
|
287
|
+
private setUIStateActive;
|
|
288
|
+
private applyUIStates;
|
|
289
|
+
/**
|
|
290
|
+
* Registers (or replaces) the property overrides applied while `name` is
|
|
291
|
+
* active. Applies immediately if that state is currently active.
|
|
292
|
+
* @param name - UI state to configure.
|
|
293
|
+
* @param spec - Property overrides to apply while the state is active.
|
|
294
|
+
*/
|
|
295
|
+
setUIState(name: MapTilerMarkerUIStateName, spec: UIStateSpec): void;
|
|
296
|
+
/**
|
|
297
|
+
* Configures (or clears) the easing used the next time `property` changes.
|
|
298
|
+
* @param property - Transitionable property to configure.
|
|
299
|
+
* @param transition - `[duration, easing?, delay?]` in milliseconds, or `null` to make future changes snap immediately again.
|
|
300
|
+
*/
|
|
301
|
+
setTransitionForProperty(property: MarkerTransitionProperty, transition: MarkerTransitionSpec | null): void;
|
|
302
|
+
/** Returns a copy of the currently configured per-property transitions. */
|
|
303
|
+
getTransitions(): MapTilerMarkerTransitions;
|
|
304
|
+
/**
|
|
305
|
+
* Applies `to` to `property`, either immediately or by easing from `from`
|
|
306
|
+
* when a transition is configured. Fires `transitionstart`/`transitionend`.
|
|
307
|
+
* @param property - Transitionable property being changed.
|
|
308
|
+
* @param from - Current value.
|
|
309
|
+
* @param to - Value being set.
|
|
310
|
+
* @param codec - Bridges `T` to/from the flat numeric props the underlying animation interpolates.
|
|
311
|
+
* @param apply - Writes an interpolated (or the immediate) value to the marker.
|
|
312
|
+
*/
|
|
313
|
+
private applyTransitionable;
|
|
314
|
+
/** Cancels any transition in flight for `property`, leaving its current (mid-transition) value as-is. */
|
|
315
|
+
private cancelTransition;
|
|
316
|
+
/** Cancels every transition in flight. Called on removal so a destroyed marker's props can't keep animating. */
|
|
317
|
+
private cancelAllTransitions;
|
|
318
|
+
/** Runs `preset`'s enter/exit motion (opacity + scale + lift) from `from` to `to`. */
|
|
319
|
+
private playLifecycleTransition;
|
|
320
|
+
/** Runs a `custom` enter/exit animation: an eased `0`→`1` alpha handed to `spec.custom` every frame. */
|
|
321
|
+
private playCustomLifecycleAnimation;
|
|
322
|
+
/** Clears the enter-mask opacity set at construction. Idempotent, safe to call unconditionally — each enter/exit path (preset or `custom`) is responsible for calling it on its own first frame, since the SDK can't know in advance whether a `custom` callback touches opacity. */
|
|
323
|
+
private clearEnterMask;
|
|
324
|
+
/** Plays the configured `enter` animation, easing from {@link enterPresetHiddenValue} up to the marker's own configured state. */
|
|
325
|
+
private playEnterAnimation;
|
|
326
|
+
/** Plays the configured `exit` animation, easing from the marker's own configured state down to {@link exitPresetHiddenValue}. */
|
|
327
|
+
private playExitAnimation;
|
|
328
|
+
/** Wires play/iteration/stop bookkeeping around a `value`-keyframed animation, and plays it. */
|
|
329
|
+
private runIdleAnimation;
|
|
330
|
+
/** Starts the configured `idle` loop — `preset`'s single channel (see {@link IDLE_PRESET_CONFIG}), or a `custom` callback fed a `0`→`1` alpha. */
|
|
331
|
+
private startIdleAnimation;
|
|
332
|
+
/** Stops the currently-looping `idle` animation, if any, leaving the marker at its current (mid-loop) state. */
|
|
333
|
+
private stopIdleAnimation;
|
|
334
|
+
/**
|
|
335
|
+
* Sets altitude in meters above the ground plane (negative is fine — below
|
|
336
|
+
* ground/sea level), faked via a per-frame pixel offset. `options.relativeTo`
|
|
337
|
+
* (default `"ground"`) picks what the meters are measured from. There is
|
|
338
|
+
* deliberately no fast path for `meters: 0`: MapLibre's native marker
|
|
339
|
+
* position is already terrain-elevated whenever the map has terrain, so
|
|
340
|
+
* doing nothing at `0` would leave the marker on the terrain, not at
|
|
341
|
+
* ground/sea level.
|
|
342
|
+
*
|
|
343
|
+
* Pass `false` to unset: deregisters and clamps to MapLibre's own native
|
|
344
|
+
* (terrain-aware) position, same as a marker that never called this.
|
|
345
|
+
* @param meters - Altitude in meters, measured per `options.relativeTo`, or `false` to unset altitude entirely.
|
|
346
|
+
* @param options - See {@link SetAltitudeOptions}. Ignored when `meters` is `false`.
|
|
347
|
+
* @experimental
|
|
348
|
+
*/
|
|
349
|
+
setAltitude(meters: false): this;
|
|
350
|
+
setAltitude(meters: number, options?: SetAltitudeOptions): this;
|
|
351
|
+
/**
|
|
352
|
+
* Returns the current altitude in meters, or 0 if never set.
|
|
353
|
+
* @experimental
|
|
354
|
+
*/
|
|
355
|
+
getAltitude(): number;
|
|
356
|
+
/**
|
|
357
|
+
* Returns what {@link getAltitude}'s meters are measured from. Defaults to `"ground"`.
|
|
358
|
+
* @experimental
|
|
359
|
+
*/
|
|
360
|
+
getAltitudeReference(): AltitudeReference;
|
|
361
|
+
/**
|
|
362
|
+
* True from the first {@link setAltitude} call onward.
|
|
363
|
+
* @experimental
|
|
364
|
+
*/
|
|
365
|
+
hasActiveAltitude(): boolean;
|
|
366
|
+
/** Stamps `altitude`/`altitudeReference`/`altitudeEngaged` onto every `dragstart`/`drag`/`dragend` event. */
|
|
367
|
+
fire(event: string | {
|
|
368
|
+
type: string;
|
|
369
|
+
}, properties?: Record<string, unknown>): this;
|
|
370
|
+
/**
|
|
371
|
+
* Toggles a dashed line from the marker down (or up) to its ground point.
|
|
372
|
+
* Off by default. See `.maptiler-marker-groundline` in
|
|
373
|
+
* the SDK stylesheet and {@link GroundLineOptions.className}.
|
|
374
|
+
* @param enabled - Whether to show the line.
|
|
375
|
+
* @param options - Optional extra CSS class for styling.
|
|
376
|
+
* @experimental
|
|
377
|
+
*/
|
|
378
|
+
setGroundLine(enabled: boolean, options?: GroundLineOptions): this;
|
|
379
|
+
/**
|
|
380
|
+
* Per-frame altitude hook, called by {@link MarkerManager} for every altitude-active marker. Returns the elevated point's camera depth (used to rank z-index among altitude-active markers), or `null` when off-screen/behind the camera.
|
|
381
|
+
*/
|
|
382
|
+
[ApplyAltitudeFrameSymbol](projectionData: CustomLayerProjectionData, map: SDKMap): number | null;
|
|
383
|
+
/** Idempotent toggle for {@link altitudeHidden} — cheap to call every frame regardless of whether the state actually changed. */
|
|
384
|
+
private setAltitudeHidden;
|
|
385
|
+
/** Idempotent toggle for {@link altitudeOccluded} — cheap to call every frame regardless of whether the state actually changed. */
|
|
386
|
+
private setAltitudeOccluded;
|
|
387
|
+
/**
|
|
388
|
+
* Creates/updates/removes the ground-line element. Geometry (position/width/rotation) comes from {@link altitudeDelta}/{@link groundLineOrigin}. Lives in a shared container at the map level ({@link MarkerManager.getGroundLineContainer}), not nested in this marker's own element — otherwise a long line would inherit its marker's camera-depth z-index and could paint over another marker's icon.
|
|
389
|
+
*/
|
|
390
|
+
private updateGroundLineElement;
|
|
391
|
+
/** Removes the marker from the DOM directly, bypassing {@link MarkerManager}. */
|
|
392
|
+
[DetachFromDOMSymbol](): void;
|
|
393
|
+
/** Removes the marker, playing the configured `exit` animation first (if any) before detaching from the DOM. */
|
|
394
|
+
remove(): this;
|
|
395
|
+
/** Deregisters (if registered) and detaches from the DOM immediately — no exit animation. */
|
|
396
|
+
private detachImmediately;
|
|
397
|
+
}
|