@maptiler/sdk 3.8.0 → 3.9.0-rc.2

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.
@@ -1,8 +1,10 @@
1
- import { DoubleClickZoomHandler, DragPanHandler, EaseToOptions, PointLike, TwoFingersTouchZoomRotateHandler, default as MapLibre } from 'maplibre-gl';
2
- import { FlyToOptions, MapDataEvent, MapOptions, JumpToOptions, ScrollZoomHandler, BoxZoomHandler, KeyboardHandler, CooperativeGesturesHandler } from '..';
1
+ import { default as MaplibreGL } from 'maplibre-gl';
2
+ import { EaseToOptions, DoubleClickZoomHandler, DragPanHandler, TwoFingersTouchZoomRotateHandler, FlyToOptions, MapOptions, JumpToOptions, ScrollZoomHandler, BoxZoomHandler, KeyboardHandler, CooperativeGesturesHandler, LngLat, MapDataEvent, PointLike } from '..';
3
3
  import { Map } from '../Map';
4
+ import { ImageViewerFitImageToBoundsControl } from '../controls/ImageViewerFitImageToBoundsControl';
5
+ import { lngLatToPxInternalSymbolKey, pxToLngLatInternalSymbolKey } from './symbols';
6
+ declare const Evented: typeof MaplibreGL.Evented;
4
7
  export type AllowedConstrcutorOptions = "container" | "apiKey" | "maxZoom" | "minZoom" | "zoom" | "bearing";
5
- declare const Evented: typeof MapLibre.Evented;
6
8
  export type ImageViewerFlyToOptions = Omit<FlyToOptions, "pitch"> & {
7
9
  center: [number, number];
8
10
  };
@@ -64,7 +66,6 @@ export default class ImageViewer extends Evented {
64
66
  /**
65
67
  * The metadata of the image.
66
68
  *
67
- * @internal
68
69
  */
69
70
  private imageMetadata?;
70
71
  /**
@@ -97,6 +98,10 @@ export default class ImageViewer extends Evented {
97
98
  * The version of the ImageViewer / SDK.
98
99
  */
99
100
  get version(): string;
101
+ /**
102
+ * The control to fit the image to the viewport.
103
+ */
104
+ fitToBoundsControlInstance: ImageViewerFitImageToBoundsControl;
100
105
  /**
101
106
  * The constructor for the ImageViewer.
102
107
  *
@@ -283,26 +288,42 @@ export default class ImageViewer extends Evented {
283
288
  * @returns {[number, number]} The px coordinate.
284
289
  */
285
290
  private pxToLngLat;
291
+ /**
292
+ * Get the internal SDK instance.
293
+ *
294
+ * @returns {Map} The internal SDK instance.
295
+ * @internal
296
+ */
297
+ getSDKInternal(): Map;
298
+ /**
299
+ * Get the canvas of the internal SDK instance.
300
+ *
301
+ * @returns {HTMLCanvasElement} The canvas of the internal SDK instance.
302
+ */
303
+ getCanvas(): HTMLCanvasElement;
286
304
  /**
287
305
  * Fly to a given center.
288
306
  *
289
307
  * @param {ImageViewerFlyToOptions} options - The options for the fly to.
290
308
  * @param {MapDataEvent} eventData - The event data.
309
+ * @returns {ImageViewer} The ImageViewer instance.
291
310
  */
292
- flyTo(options: ImageViewerFlyToOptions, eventData?: MapDataEvent): Map;
311
+ flyTo(options: ImageViewerFlyToOptions, eventData?: MapDataEvent): this;
293
312
  /**
294
313
  * Jump to a given center.
295
314
  *
296
315
  * @param {ImageViewerJumpToOptions} options - The options for the jump to.
297
316
  * @param {MapDataEvent} eventData - The event data.
317
+ * @returns {ImageViewer} The ImageViewer instance.
298
318
  */
299
- jumpTo(options: ImageViewerJumpToOptions, eventData?: MapDataEvent): Map;
319
+ jumpTo(options: ImageViewerJumpToOptions, eventData?: MapDataEvent): this;
300
320
  /**
301
321
  * Set the zoom level.
302
322
  *
303
323
  * @param {number} zoom - The zoom level.
324
+ * @returns {ImageViewer} The ImageViewer instance.
304
325
  */
305
- setZoom(zoom: number): void;
326
+ setZoom(zoom: number): this;
306
327
  /**
307
328
  * Get the zoom level.
308
329
  *
@@ -320,14 +341,16 @@ export default class ImageViewer extends Evented {
320
341
  * Set the center of the ImageViewer in pixels.
321
342
  *
322
343
  * @param {number} center - The center of the ImageViewer.
344
+ * @returns {ImageViewer} The ImageViewer instance.
323
345
  */
324
- setCenter(center: [number, number]): void;
346
+ setCenter(center: [number, number]): this;
325
347
  /**
326
348
  * Set the bearing of the ImageViewer in degrees.
327
349
  *
328
350
  * @param {number} bearing - The bearing of the ImageViewer.
351
+ * @returns {ImageViewer} The ImageViewer instance.
329
352
  */
330
- setBearing(bearing: number): void;
353
+ setBearing(bearing: number): this;
331
354
  /**
332
355
  * Get the bearing of the ImageViewer in degrees.
333
356
  *
@@ -340,15 +363,46 @@ export default class ImageViewer extends Evented {
340
363
  * @param {PointLike} delta - The delta to pan by.
341
364
  * @param {ImageViewerEaseToOptions} options - The options for the pan.
342
365
  * @param {any} eventData - The event data.
366
+ * @returns {ImageViewer} The ImageViewer instance.
343
367
  */
344
- panBy(delta: PointLike, options?: ImageViewerEaseToOptions, eventData?: any): void;
368
+ panBy(delta: PointLike, options?: ImageViewerEaseToOptions, eventData?: any): this;
345
369
  /**
346
370
  * Pan to a given center in pixels.
347
371
  *
348
372
  * @param {number} center - The center to pan to.
349
373
  * @param {ImageViewerEaseToOptions} options - The options for the pan.
350
374
  * @param {any} eventData - The event data.
375
+ * @returns {ImageViewer} The ImageViewer instance.
376
+ */
377
+ panTo(center: [number, number], options?: ImageViewerEaseToOptions, eventData?: any): this;
378
+ /**
379
+ * Get the image metadata.
380
+ *
381
+ * @returns {ImageMetadata} The image metadata.
382
+ */
383
+ getImageMetadata(): ImageMetadata | undefined;
384
+ /**
385
+ * Get the visible bounds of the image in the viewport in imagePixels.
386
+ * [topLeft, bottomRight]
387
+ *
388
+ * @returns {[[number, number], [number, number]]} The visible bounds of the image.
389
+ */
390
+ getImageBounds(): number[][];
391
+ /**
392
+ * Set the bounds of the image.
393
+ *
394
+ * @param {[[number, number], [number, number]]} bounds - The bounds of the image.
395
+ * @returns {ImageViewer} The ImageViewer instance.
396
+ */
397
+ fitImageBounds([tl, br]: [[number, number], [number, number]]): this;
398
+ /**
399
+ * Destroys the ImageViewer, removes the map instance and all event listeners. Useful for cleanup.
400
+ *
401
+ * @returns {ImageViewer} The ImageViewer instance.
351
402
  */
352
- panTo(center: [number, number], options?: ImageViewerEaseToOptions, eventData?: any): void;
403
+ remove(): void;
404
+ pointIsWithinImageBounds(px: [number, number]): boolean;
405
+ [lngLatToPxInternalSymbolKey]: (lngLat: LngLat) => [number, number];
406
+ [pxToLngLatInternalSymbolKey]: (px: [number, number]) => LngLat;
353
407
  }
354
408
  export {};
@@ -0,0 +1,236 @@
1
+ import { Alignment, Subscription, MarkerOptions, PointLike, Popup } from '../index';
2
+ import { default as MapLibreGL } from 'maplibre-gl';
3
+ import { default as ImageViewer } from './ImageViewer';
4
+ declare const Evented: typeof MapLibreGL.Evented;
5
+ export type ImageViewerMarkerOptions = MarkerOptions & {};
6
+ export interface ImageViewerMarkerInterface {
7
+ on(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void): Subscription;
8
+ off(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void): void;
9
+ fire(event: ImageViewerMarkerEvent): void;
10
+ getPosition(): [number, number];
11
+ getOffset(): PointLike;
12
+ getPitchAlignment(): Alignment;
13
+ getPopup(): Popup;
14
+ getRotation(): number;
15
+ getRotationAlignment(): Alignment;
16
+ isDraggable(): boolean;
17
+ remove(): void;
18
+ removeClassName(className: string): void;
19
+ setDraggable(draggable: boolean): void;
20
+ setPosition(px: [number, number]): void;
21
+ setOffset(offset: PointLike): void;
22
+ setOpacity(opacity?: string, opacityWhenCovered?: string): void;
23
+ setPitchAlignment(pitchAlignment: Alignment): void;
24
+ setPopup(popup: Popup): void;
25
+ setRotation(rotation: number): void;
26
+ setRotationAlignment(rotationAlignment: Alignment): void;
27
+ setSubpixelPositioning(subpixelPositioning: boolean): void;
28
+ toggleClassName(className: string): void;
29
+ togglePopup(): void;
30
+ }
31
+ export declare class ImageViewerMarker extends Evented {
32
+ private viewer;
33
+ private readonly marker;
34
+ private readonly position;
35
+ constructor({ ...markerOptions }: ImageViewerMarkerOptions);
36
+ /**
37
+ * Adds the ImageViewerMarker to an instance of ImageViewer.
38
+ *
39
+ * @param {ImageViewer} viewer - The instance of ImageViewer to add the ImageViewerMarker to.
40
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
41
+ */
42
+ addTo(viewer: ImageViewer): this;
43
+ /**
44
+ * Adds a class name to the ImageViewerMarker.
45
+ *
46
+ * @param {string} className - The class name to add to the ImageViewerMarker.
47
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
48
+ */
49
+ addClassName(className: string): this;
50
+ /**
51
+ * Gets the element of the ImageViewerMarker.
52
+ *
53
+ * @returns {HTMLElement} The element of the ImageViewerMarker.
54
+ */
55
+ getElement(): HTMLElement;
56
+ /**
57
+ * Gets the position of the ImageViewerMarker.
58
+ *
59
+ * @returns {PointLike} The position of the ImageViewerMarker.
60
+ * @see [PointLike](https://docs.maptiler.com/sdk-js/api/geography/#pointlike)
61
+ *
62
+ */
63
+ getPosition(): [number, number];
64
+ /**
65
+ * Gets the offset of the ImageViewerMarker.
66
+ *
67
+ * @returns {PointLike} The offset of the ImageViewerMarker.
68
+ * @see [PointLike](https://docs.maptiler.com/sdk-js/api/geography/#pointlike)
69
+ */
70
+ getOffset(): MapLibreGL.Point;
71
+ /**
72
+ * Gets the pitch alignment of the ImageViewerMarker.
73
+ *
74
+ * @returns {Alignment} The pitch alignment of the ImageViewerMarker.
75
+ * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)
76
+ */
77
+ getPitchAlignment(): Alignment;
78
+ /**
79
+ * Gets the popup of the ImageViewerMarker.
80
+ *
81
+ * @returns {Popup} The popup of the ImageViewerMarker.
82
+ * @see [Popup](https://docs.maptiler.com/sdk-js/api/markers/#popup)
83
+ */
84
+ getPopup(): MapLibreGL.Popup;
85
+ /**
86
+ * Gets the rotation of the ImageViewerMarker.
87
+ *
88
+ * @returns {number} The rotation of the ImageViewerMarker.
89
+ */
90
+ getRotation(): number;
91
+ /**
92
+ * Gets the rotation alignment of the ImageViewerMarker.
93
+ *
94
+ * @returns {Alignment} The rotation alignment of the ImageViewerMarker.
95
+ * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)
96
+ */
97
+ getRotationAlignment(): Alignment;
98
+ /**
99
+ * Checks if the ImageViewerMarker is draggable.
100
+ *
101
+ * @returns {boolean} True if the ImageViewerMarker is draggable, false otherwise.
102
+ */
103
+ isDraggable(): boolean;
104
+ /**
105
+ * Fires an event on the ImageViewerMarker.
106
+ *
107
+ * @param {MarkerEventTypes | Event} event - The event to fire.
108
+ * @param {Record<string, any>} data - The data to fire the event with.
109
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
110
+ */
111
+ fire(event: MarkerEventTypes | Event, data?: Record<string, any>): this;
112
+ /**
113
+ * Removes an event listener from the ImageViewerMarker.
114
+ *
115
+ * @param {MarkerEventTypes} event - The event to remove the listener from.
116
+ * @param {ImageViewerMarkerEvent} listener - The listener to remove.
117
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
118
+ */
119
+ off(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void): this;
120
+ /**
121
+ * Adds an event listener to the ImageViewerMarker.
122
+ *
123
+ * @param {MarkerEventTypes} event - The event to add the listener to.
124
+ * @param {ImageViewerMarkerEvent} listener - The listener to add.
125
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
126
+ */
127
+ on(event: MarkerEventTypes, listener: (e: ImageViewerMarkerEvent) => void): Subscription;
128
+ /**
129
+ * Checks if the ImageViewerMarker is within the image bounds.
130
+ *
131
+ * @returns {boolean} True if the ImageViewerMarker is within the image bounds, false otherwise.
132
+ */
133
+ isWithinImageBounds(): boolean;
134
+ /**
135
+ * Removes the ImageViewerMarker from the ImageViewer and cleans up the event listeners.
136
+ *
137
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
138
+ */
139
+ remove(): this;
140
+ /**
141
+ * Removes a class name from the ImageViewerMarker dom element.
142
+ *
143
+ * @param {string} className - The class name to remove from the ImageViewerMarker.
144
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
145
+ */
146
+ removeClassName(className: string): this;
147
+ /**
148
+ * Sets the draggable state of the ImageViewerMarker.
149
+ *
150
+ * @param {boolean} draggable - The draggable state of the ImageViewerMarker.
151
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
152
+ */
153
+ setDraggable(draggable: boolean): this;
154
+ /**
155
+ * Sets the position of the ImageViewerMarker.
156
+ *
157
+ * @param {[number, number]} px - The position of the ImageViewerMarker in image pixels.
158
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
159
+ */
160
+ setPosition(px: [number, number]): this;
161
+ /**
162
+ * Sets the offset of the ImageViewerMarker.
163
+ *
164
+ * @param {PointLike} offset - The offset of the ImageViewerMarker.
165
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
166
+ */
167
+ setOffset(offset: PointLike): this;
168
+ /**
169
+ * Sets the opacity of the ImageViewerMarker.
170
+ *
171
+ * @param {string} opacity - The opacity of the ImageViewerMarker.
172
+ * @param {string} opacityWhenCovered - The opacity of the ImageViewerMarker when covered.
173
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
174
+ */
175
+ setOpacity(opacity?: string, opacityWhenCovered?: string): this;
176
+ /**
177
+ * Sets the pitch alignment of the ImageViewerMarker.
178
+ *
179
+ * @param {Alignment} pitchAlignment - The pitch alignment of the ImageViewerMarker.
180
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
181
+ * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)
182
+ */
183
+ setPitchAlignment(pitchAlignment: Alignment): this;
184
+ /**
185
+ * Sets the popup of the ImageViewerMarker.
186
+ *
187
+ * @param {Popup} popup - The popup of the ImageViewerMarker.
188
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
189
+ * @see [Popup](https://docs.maptiler.com/sdk-js/api/markers/#popup)
190
+ */
191
+ setPopup(popup: Popup): this;
192
+ /**
193
+ * Sets the rotation of the ImageViewerMarker.
194
+ *
195
+ * @param {number} rotation - The rotation of the ImageViewerMarker.
196
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
197
+ */
198
+ setRotation(rotation: number): this;
199
+ /**
200
+ * Sets the rotation alignment of the ImageViewerMarker.
201
+ *
202
+ * @param {Alignment} rotationAlignment - The rotation alignment of the ImageViewerMarker.
203
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
204
+ * @see [MapLibreGL.Alignment](https://maplibre.org/maplibre-gl-js/docs/API/type-aliases/Alignment/)
205
+ */
206
+ setRotationAlignment(rotationAlignment: Alignment): this;
207
+ /**
208
+ * Sets if subpixel positioning is enabled for the ImageViewerMarker.
209
+ *
210
+ * @param {boolean} subpixelPositioning - The subpixel positioning of the ImageViewerMarker.
211
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
212
+ */
213
+ setSubpixelPositioning(subpixelPositioning: boolean): this;
214
+ /**
215
+ * Toggles a class name on the ImageViewerMarker dom element.
216
+ *
217
+ * @param {string} className - The class name to toggle on the ImageViewerMarker.
218
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
219
+ */
220
+ toggleClassName(className: string): this;
221
+ /**
222
+ * Toggles the popup of the ImageViewerMarker.
223
+ *
224
+ * @returns {ImageViewerMarker} The ImageViewerMarker instance.
225
+ */
226
+ togglePopup(): this;
227
+ }
228
+ declare const MARKER_EVENT_TYPES: readonly ["dragstart", "drag", "dragend"];
229
+ type MarkerEventTypes = (typeof MARKER_EVENT_TYPES)[number];
230
+ export declare class ImageViewerMarkerEvent {
231
+ readonly type: string;
232
+ readonly target: ImageViewerMarker;
233
+ [key: string]: any;
234
+ constructor(type: MarkerEventTypes, marker: ImageViewerMarker, data: Record<string, any>);
235
+ }
236
+ export {};
@@ -6,6 +6,9 @@ export declare class ImageViewerEvent {
6
6
  readonly target: ImageViewer;
7
7
  readonly originalEvent: MouseEvent | TouchEvent | WheelEvent | WebGLContextEvent | null;
8
8
  [key: string]: any;
9
+ imageX: number;
10
+ imageY: number;
11
+ isOutOfBounds: boolean;
9
12
  constructor(type: string, viewer: ImageViewer, originalEvent?: MouseEvent | TouchEvent | WheelEvent | WebGLContextEvent | null, data?: Record<string, any>);
10
13
  }
11
14
  declare const BASE_MAP_EVENT_TYPES: readonly ["idle", "render", "load", "remove", "idle"];
@@ -16,7 +19,7 @@ declare const CAMERA_EVENTS: readonly ["moveend", "movestart", "move", "zoomend"
16
19
  declare const UI_EVENTS: readonly ["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseout", "mouseover", "contextmenu", "touchstart", "touchend", "touchmove", "touchcancel"];
17
20
  declare const COOPERATIVE_GESTURE_EVENTS: readonly ["cooperativegestureprevented"];
18
21
  declare const DATA_EVENTS: readonly ["data", "dataloading", "sourcedata", "sourcedataloading", "dataabort", "sourcedataabort"];
19
- export declare const IMAGE_VIEWER_EVENT_TYPES: ("data" | "error" | "load" | "idle" | "remove" | "render" | "resize" | "webglcontextlost" | "webglcontextrestored" | "dataloading" | "sourcedataloading" | "sourcedata" | "dataabort" | "sourcedataabort" | "boxzoomcancel" | "boxzoomstart" | "boxzoomend" | "touchcancel" | "touchmove" | "touchend" | "touchstart" | "click" | "contextmenu" | "dblclick" | "mousemove" | "mouseup" | "mousedown" | "mouseout" | "mouseover" | "movestart" | "move" | "moveend" | "zoomstart" | "zoom" | "zoomend" | "rotatestart" | "rotate" | "rotateend" | "dragstart" | "drag" | "dragend" | "cooperativegestureprevented")[];
22
+ export declare const IMAGE_VIEWER_EVENT_TYPES: ("error" | "load" | "idle" | "remove" | "render" | "resize" | "webglcontextlost" | "webglcontextrestored" | "dataloading" | "data" | "sourcedataloading" | "sourcedata" | "dataabort" | "sourcedataabort" | "boxzoomcancel" | "boxzoomstart" | "boxzoomend" | "touchcancel" | "touchmove" | "touchend" | "touchstart" | "click" | "contextmenu" | "dblclick" | "mousemove" | "mouseup" | "mousedown" | "mouseout" | "mouseover" | "movestart" | "move" | "moveend" | "zoomstart" | "zoom" | "zoomend" | "rotatestart" | "rotate" | "rotateend" | "dragstart" | "drag" | "dragend" | "cooperativegestureprevented")[];
20
23
  type BaseMapEventKeys = (typeof BASE_MAP_EVENT_TYPES)[number];
21
24
  type UiEventKeys = (typeof UI_EVENTS)[number];
22
25
  type CameraEventKeys = (typeof CAMERA_EVENTS)[number];
@@ -25,7 +28,7 @@ type ResizeEventKeys = (typeof RESIZE_EVENTS)[number];
25
28
  type WebglContextEventKeys = (typeof WEBGL_CONTEXT_EVENTS)[number];
26
29
  type DataEventKeys = (typeof DATA_EVENTS)[number];
27
30
  type CooperativeGestureEventKeys = (typeof COOPERATIVE_GESTURE_EVENTS)[number];
28
- export type ImageViewerEventTypes = BaseMapEventKeys | UiEventKeys | CameraEventKeys | ErrorEventKeys | ResizeEventKeys | WebglContextEventKeys | DataEventKeys | CooperativeGestureEventKeys | "imageviewerready" | "imagevieweriniterror";
31
+ export type ImageViewerEventTypes = BaseMapEventKeys | UiEventKeys | CameraEventKeys | ErrorEventKeys | ResizeEventKeys | WebglContextEventKeys | DataEventKeys | CooperativeGestureEventKeys | "imageviewerready" | "imagevieweriniterror" | "beforeremove";
29
32
  type LngLatToPixel = (lngLat: LngLat) => [number, number];
30
33
  interface SetupGlobalMapEventForwarderOptions {
31
34
  map: Map;
@@ -1,4 +1,5 @@
1
1
  export { default as ImageViewer } from './ImageViewer';
2
+ export { ImageViewerMarker, ImageViewerMarkerEvent, type ImageViewerMarkerOptions } from './ImageViewerMarker';
2
3
  export type { ImageViewerEventTypes } from './events';
3
4
  export type { ImageViewerConstructorOptions, ImageViewerFlyToOptions, ImageViewerJumpToOptions, ImageMetadata } from './ImageViewer';
4
5
  export { ImageViewerEvent } from './events';
@@ -1,4 +1,11 @@
1
- import { LngLat, Point } from '../index';
1
+ import { LngLat, Marker, Point, PositionAnchor } from '../index';
2
2
  import { Map } from '../Map';
3
3
  export declare function unprojectFromWorldCoordinates(worldSize: number, point: Point): LngLat;
4
4
  export declare function monkeyPatchMapTransformInstance(instance: Map): void;
5
+ export declare const anchorTranslate: Record<PositionAnchor, string>;
6
+ /**
7
+ * Monkey patches the Marker instance to remove wrapping. Because pixel projection does not wrap like lnglat.
8
+ * See here https://github.com/maplibre/maplibre-gl-js/blob/14f56b00e0f08784681ef98f0731c60f3923a4a9/src/ui/marker.ts#L601
9
+ * @param {Marker} marker - The Marker instance to patch.
10
+ */
11
+ export declare function monkeyPatchMarkerInstanceToRemoveWrapping(marker: Marker): void;
@@ -0,0 +1,2 @@
1
+ export declare const lngLatToPxInternalSymbolKey: unique symbol;
2
+ export declare const pxToLngLatInternalSymbolKey: unique symbol;
package/dist/src/Map.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { default as maplibregl, StyleSpecification, MapOptions as MapOptionsML, ControlPosition, StyleSwapOptions, StyleOptions, RequestTransformFunction, LayerSpecification, SourceSpecification, CustomLayerInterface, FilterSpecification, StyleSetterOptions } from 'maplibre-gl';
1
+ import { default as maplibregl, StyleSpecification, MapOptions as MapOptionsML, ControlPosition, StyleSwapOptions, StyleOptions, RequestTransformFunction, LayerSpecification, SourceSpecification, CustomLayerInterface, FilterSpecification, StyleSetterOptions, ProjectionSpecification } from 'maplibre-gl';
2
2
  import { ReferenceMapStyle, MapStyleVariant } from '@maptiler/client';
3
3
  import { SdkConfig } from './config';
4
4
  import { LanguageInfo } from './language';
@@ -155,7 +155,7 @@ export declare class Map extends maplibregl.Map {
155
155
  * If an option is not set it will internally revert to the default option
156
156
  * unless explicitly set when calling.
157
157
  */
158
- setSpace(space: CubemapDefinition | boolean): void;
158
+ setSpace(space: CubemapDefinition | boolean, updateOptions?: boolean): void;
159
159
  /**
160
160
  * Enables the animations for the space layer.
161
161
  */
@@ -439,6 +439,15 @@ export declare class Map extends maplibregl.Map {
439
439
  * map.setTransformRequest((url: string, resourceType: string) => {});
440
440
  */
441
441
  setTransformRequest(transformRequest: RequestTransformFunction): this;
442
+ /**
443
+ * Gets the {@link ProjectionSpecification}.
444
+ * @returns the projection specification.
445
+ * @example
446
+ * ```ts
447
+ * let projection = map.getProjection();
448
+ * ```
449
+ */
450
+ getProjection(): ProjectionSpecification;
442
451
  /**
443
452
  * Returns whether a globe projection is currently being used
444
453
  */
@@ -451,6 +460,7 @@ export declare class Map extends maplibregl.Map {
451
460
  * Activate the mercator projection.
452
461
  */
453
462
  enableMercatorProjection(): void;
463
+ setProjection(projection: maplibregl.ProjectionSpecification): this;
454
464
  /**
455
465
  * Returns `true` is the language was ever updated, meaning changed
456
466
  * from what is delivered in the style.
@@ -1,6 +1,5 @@
1
1
  import { default as maplibregl } from 'maplibre-gl';
2
2
  export type * from 'maplibre-gl';
3
- export type { ColorRamp as ColorRampML } from 'maplibre-gl';
4
3
  /**
5
4
  * Get the version of MapTiler SDK, this is declared in the vite config
6
5
  * to avoid importing the entire package.json
@@ -32,7 +31,15 @@ declare const TwoFingersTouchPitchHandlerMLGL: typeof maplibregl.TwoFingersTouch
32
31
  declare const MapWheelEventMLGL: typeof maplibregl.MapWheelEvent;
33
32
  declare const MapTouchEventMLGL: typeof maplibregl.MapTouchEvent;
34
33
  declare const MapMouseEventMLGL: typeof maplibregl.MapMouseEvent;
35
- declare const configMLGL: maplibregl.Config;
34
+ declare const configMLGL: {
35
+ MAX_PARALLEL_IMAGE_REQUESTS: number;
36
+ MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME: number;
37
+ MAX_TILE_CACHE_ZOOM_LEVELS: number;
38
+ REGISTERED_PROTOCOLS: {
39
+ [x: string]: maplibregl.AddProtocolAction;
40
+ };
41
+ WORKER_URL: string;
42
+ };
36
43
  declare const getMapLibreVersion: typeof maplibregl.getVersion;
37
44
  declare const setRTLTextPlugin: typeof maplibregl.setRTLTextPlugin, getRTLTextPluginStatus: typeof maplibregl.getRTLTextPluginStatus, LngLat: typeof maplibregl.LngLat, LngLatBounds: typeof maplibregl.LngLatBounds, MercatorCoordinate: typeof maplibregl.MercatorCoordinate, Evented: typeof maplibregl.Evented, AJAXError: typeof maplibregl.AJAXError, prewarm: typeof maplibregl.prewarm, clearPrewarmedResources: typeof maplibregl.clearPrewarmedResources, Hash: typeof maplibregl.Hash, Point: typeof maplibregl.Point, EdgeInsets: typeof maplibregl.EdgeInsets, DragRotateHandler: typeof maplibregl.DragRotateHandler, DragPanHandler: typeof maplibregl.DragPanHandler, TwoFingersTouchZoomRotateHandler: typeof maplibregl.TwoFingersTouchZoomRotateHandler, DoubleClickZoomHandler: typeof maplibregl.DoubleClickZoomHandler, TwoFingersTouchZoomHandler: typeof maplibregl.TwoFingersTouchZoomHandler, TwoFingersTouchRotateHandler: typeof maplibregl.TwoFingersTouchRotateHandler, getWorkerCount: typeof maplibregl.getWorkerCount, setWorkerCount: typeof maplibregl.setWorkerCount, getMaxParallelImageRequests: typeof maplibregl.getMaxParallelImageRequests, setMaxParallelImageRequests: typeof maplibregl.setMaxParallelImageRequests, getWorkerUrl: typeof maplibregl.getWorkerUrl, setWorkerUrl: typeof maplibregl.setWorkerUrl, addSourceType: (name: string, SourceType: maplibregl.SourceClass) => Promise<void>, importScriptInWorkers: typeof maplibregl.importScriptInWorkers, addProtocol: typeof maplibregl.addProtocol, removeProtocol: typeof maplibregl.removeProtocol;
38
45
  export { setRTLTextPlugin, getRTLTextPluginStatus, LngLat, LngLatBounds, MercatorCoordinate, Evented, AJAXError, prewarm, clearPrewarmedResources, Hash, Point, EdgeInsets, DragRotateHandler, DragPanHandler, TwoFingersTouchZoomRotateHandler, DoubleClickZoomHandler, TwoFingersTouchZoomHandler, TwoFingersTouchRotateHandler, getWorkerCount, setWorkerCount, getMaxParallelImageRequests, setMaxParallelImageRequests, getWorkerUrl, setWorkerUrl, addSourceType, importScriptInWorkers, addProtocol, removeProtocol, getMapLibreVersion, MapMLGL, MarkerMLGL, PopupMLGL, StyleMLGL, CanvasSourceMLGL, GeoJSONSourceMLGL, ImageSourceMLGL, RasterTileSourceMLGL, RasterDEMTileSourceMLGL, VectorTileSourceMLGL, VideoSourceMLGL, NavigationControMLGL, GeolocateControlMLGL, AttributionControlMLGL, LogoControlMLGL, ScaleControlMLGL, FullscreenControlMLGL, TerrainControMLGL, BoxZoomHandlerMLGL, ScrollZoomHandlerMLGL, CooperativeGesturesHandlerMLGL, KeyboardHandlerMLGL, TwoFingersTouchPitchHandlerMLGL, MapWheelEventMLGL, MapTouchEventMLGL, MapMouseEventMLGL, configMLGL, };
@@ -13,5 +13,5 @@ type StyleValidationReport = {
13
13
  isValidStyle: boolean;
14
14
  styleObject: maplibregl.StyleSpecification | null;
15
15
  };
16
- export declare function convertToStyleSpecificationString(str: string): StyleValidationReport;
16
+ export declare function convertStringToStyleSpecification(str: string): StyleValidationReport;
17
17
  export {};
@@ -1,6 +1,6 @@
1
1
  import { default as maplibregl, RequestParameters, ResourceType, RequestTransformFunction } from 'maplibre-gl';
2
2
  import { Map as MapSDK } from './Map';
3
- export declare function enableRTL(): void;
3
+ export declare function enableRTL(customPluginURL?: string): Promise<void>;
4
4
  export declare function bindAll(fns: Array<string>, context: any): void;
5
5
  /**
6
6
  * This function is meant to be used as transformRequest by any Map instance created.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maptiler/sdk",
3
- "version": "3.8.0",
3
+ "version": "3.9.0-rc.2",
4
4
  "description": "The Javascript & TypeScript map SDK tailored for MapTiler Cloud",
5
5
  "author": "MapTiler",
6
6
  "module": "dist/maptiler-sdk.mjs",
@@ -86,12 +86,12 @@
86
86
  "vitest": "^3.0.9"
87
87
  },
88
88
  "dependencies": {
89
- "@maplibre/maplibre-gl-style-spec": "~23.3.0",
90
- "@maptiler/client": "~2.5.1",
89
+ "@maplibre/maplibre-gl-style-spec": "~24.2.0",
90
+ "@maptiler/client": "2.6.0-rc.3",
91
91
  "events": "^3.3.0",
92
92
  "gl-matrix": "^3.4.3",
93
93
  "js-base64": "^3.7.7",
94
- "maplibre-gl": "~5.6.0",
94
+ "maplibre-gl": "~5.9.0",
95
95
  "uuid": "^11.0.5"
96
96
  }
97
97
  }