@mappedin/mappedin-js 5.10.2 → 5.12.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.
@@ -1,9 +1,9 @@
1
1
  // Generated by dts-bundle v0.7.3
2
2
  // Dependencies for this module:
3
+ // ../@mappedin/mvf
3
4
  // ../three
4
5
  // ../@tweenjs/tween.js
5
6
  // ../minisearch
6
- // ../@mappedin/mvf
7
7
  // ../stats.js
8
8
 
9
9
  declare module '@mappedin/mappedin-js' {
@@ -26,6 +26,7 @@ declare module '@mappedin/mappedin-js' {
26
26
  export type { BlueDot } from '@mappedin/mappedin-js/renderer/public/api/BlueDot';
27
27
  export type { Markers } from '@mappedin/mappedin-js/renderer/public/api/Markers';
28
28
  export type { Paths } from '@mappedin/mappedin-js/renderer/public/api/Paths';
29
+ export type { TOOLTIP_ANCHOR } from '@mappedin/mappedin-js/renderer/internal/Mappedin.SmartTooltip';
29
30
  export type TMappedinInitializeOutput = {
30
31
  mapView: MapView;
31
32
  venue: Mappedin;
@@ -118,16 +119,46 @@ declare module '@mappedin/mappedin-js/renderer/public/MapView' {
118
119
  import { Paths } from '@mappedin/mappedin-js/renderer/public/api/Paths';
119
120
  import { BlueDot } from '@mappedin/mappedin-js/renderer/public/api/BlueDot';
120
121
  import { Camera } from '@mappedin/mappedin-js/renderer/public/api/Camera';
122
+ /**
123
+ * Primary API class for controlling and interacting with a 3D map.
124
+ */
121
125
  export class MapView extends PubSub<E_SDK_EVENT_PAYLOAD, E_SDK_EVENT> {
122
126
  #private;
127
+ /**
128
+ * API for representing sets of directions on the map.
129
+ */
123
130
  Journey: Journey;
131
+ /**
132
+ * API for controlling the camera in the scene.
133
+ */
124
134
  Camera: Camera;
135
+ /**
136
+ * API for controlling flat labels.
137
+ */
125
138
  FlatLabels: IFlatLabels<void>;
139
+ /**
140
+ * API for controlling floating labels.
141
+ */
126
142
  FloatingLabels: IFloatingLabels<void>;
143
+ /**
144
+ * API for adding 2D markers.
145
+ */
127
146
  Markers: Markers;
147
+ /**
148
+ * API for drawing arbitrary paths.
149
+ */
128
150
  Paths: Paths;
151
+ /**
152
+ * API for handling a user's position on the map.
153
+ */
129
154
  BlueDot: BlueDot;
155
+ /**
156
+ * The options that the mapView was instantiated with.
157
+ */
130
158
  options: TMapViewOptions;
159
+ /**
160
+ * @hidden
161
+ */
131
162
  constructor(container: HTMLElement, venue: Mappedin, options?: TMapViewOptions & {
132
163
  onFirstMapLoaded: () => void;
133
164
  });
@@ -140,75 +171,184 @@ declare module '@mappedin/mappedin-js/renderer/public/MapView' {
140
171
  */
141
172
  labelAllLocations(options?: TLabelAllLocationFloatingLabelOptions | TLabelAllLocationFlatLabelOptions): never[];
142
173
  /**
143
- * Get Nearest Node to a screen coordinate x, y, map. Useful for doing directions from any place on the map
174
+ * Get the nearest {@link MappedinNode} on a map to an XY-coordinate on the screen.
175
+ * This can be useful for generating directions from an arbitrary point on the map.
176
+ *
177
+ * ```
178
+ * // Get the nearest node on map[0] to (100,100)
179
+ * const nearestNode = mapView.getNearestNodeByScreenCoordinates(100, 100, mapView.venue.maps[0]);
180
+ * const destination = mapView.venue.locations.find((l) => l.name === "Apple")!;
181
+ *
182
+ * // Find out how to get from that node to Apple
183
+ * const directions = nearestNode.directionsTo(destination);
184
+ * ```
144
185
  *
145
- * @param x
146
- * @param y
147
- * @param mapOrMapId Map of MapId
186
+ * @param x The x position of a coordinate on the screen.
187
+ * @param y The y position of a coordinate on the screen.
188
+ * @param mapOrMapId The {@link MappedinMap} the node should belong to.
148
189
  */
149
190
  getNearestNodeByScreenCoordinates(x: number, y: number, mapOrMapId?: MappedinMap | MappedinMap['id']): MappedinNode;
150
191
  /**
151
- * Unsubscribe from SDK events
192
+ * Subscribe a function to an {@link E_SDK_EVENT}.
193
+ *
194
+ * ```ts
195
+ * // Set a polygon to be red when it is clicked
196
+ * const mapClickHandler = ({ polygons }: E_SDK_EVENT_PAYLOAD["CLICK"]) => {
197
+ * if (polygons.length > 0) {
198
+ * mapView.setPolygonColor(polygons[0], 'red');
199
+ * }
200
+ * }
201
+ * mapView.on(E_SDK_EVENT.CLICK, mapClickHandler);
202
+ * ```
203
+ *
204
+ * @param eventName An {@link E_SDK_EVENT} which, when fired, will call the provided
205
+ * function.
206
+ * @param fn A callback that gets called when the corresponding event is fired. The
207
+ * callback will get passed an argument with a type that's one of {@link E_SDK_EVENT_PAYLOAD}.
208
+ */
209
+ on: PubSub<E_SDK_EVENT_PAYLOAD, E_SDK_EVENT>['on'];
210
+ /**
211
+ * Unsubscribe a function previously subscribed with {@link on} from
212
+ * and {@link E_SDK_EVENT}.
213
+ *
214
+ * ```ts
215
+ * mapView.on(E_SDK_EVENT.CLICK, mapClickHandler);
216
+ *
217
+ * ...
218
+ *
219
+ * // Something changed and I no longer want this event
220
+ * mapView.off(E_SDK_EVENT.CLICK, mapClickHandler);
221
+ * ```
222
+ *
223
+ * @param eventName An {@link E_SDK_EVENT} to which the provided function was previously
224
+ * subscribed.
225
+ * @param fn A function that was previously passed to {@link on}. The function must
226
+ * have the same reference as the function that was subscribed.
227
+ */
228
+ off: PubSub<E_SDK_EVENT_PAYLOAD, E_SDK_EVENT>['off'];
229
+ /**
230
+ * Set state of the mapView to one of {@link STATE}.
231
+ *
232
+ * @param state The {@link STATE} to set the SDK to.
152
233
  */
153
234
  setState(state: STATE): Promise<void>;
235
+ /**
236
+ * The current {@link STATE} on the mapView.
237
+ */
154
238
  get state(): STATE;
155
239
  /**
156
- * The Venue data this MapView is using.
157
- *
158
- * @property venue {MappedinVenue}
159
- * @final
240
+ * The {@link Mappedin} data this mapView is using.
160
241
  */
161
242
  get venue(): Mappedin;
162
243
  /**
163
- * The div MapView is using.
164
- *
165
- * @property container {Div}
166
- * @final
244
+ * The HTML element that the mapView is rendered into.
167
245
  */
168
246
  get container(): HTMLElement;
169
247
  /**
170
- * The current map being displayed
248
+ * The current {@link MappedinMap} being displayed.
171
249
  */
172
250
  get currentMap(): MappedinMap;
173
251
  /**
174
- * Remove all interactive polygons
252
+ * Prevent any polygons from showing a hover effect and being clicked on.
253
+ * See also {@link addInteractivePolygon} and {@link addInteractivePolygonsForAllLocations}.
254
+ *
255
+ * ```ts
256
+ * mapView.removeAllInteractivePolygons()
257
+ * ```
175
258
  */
176
259
  removeAllInteractivePolygons(): void;
177
260
  /**
178
- * Change the currently displayed Map to a new one.
261
+ * Change the currently displayed {@link MappedinMap} to a new one.
262
+ *
263
+ * ```ts
264
+ * await mapView.setMap(mapView.venue.maps[1]);
265
+ * ```
179
266
  *
180
- * @method setMap
181
- * @param mapOrMapId The Map ID or Map Object to change the Map to.
267
+ * @param mapOrMapId The {@link MappedinMap} to display.
268
+ * @returns A promise that resolves when the map is fully switched.
182
269
  */
183
270
  setMap(mapOrMapId: MappedinMap | string): Promise<null>;
184
271
  /**
185
- * Given a polygon, set it to a specific color.
272
+ * Given a {@link MappedinPolygon}, set it to a specific color.
273
+ *
274
+ * ```ts
275
+ * // Find the polygons of the Apple store and change them to blue
276
+ * const location = mapView.venue.locations.find((l) => l.name === "Apple")!;
277
+ * for (const polygon of location.polygons) {
278
+ * mapView.setPolygonColor(polygon, "#0000ff");
279
+ * }
280
+ * ```
186
281
  *
187
- * @param polygon The Polygon ({@link MappedinPolygon}) to change the color of.
188
- * @param color The color to use.
282
+ * @param polygon The {@link MappedinPolygon} to change the color of.
283
+ * @param color A hexidecimal color string to use as the new color.
189
284
  */
190
285
  setPolygonColor(polygon: MappedinPolygon, color: string): void;
191
286
  /**
192
- * Resets a Polygon back to it's original color.
193
- * If the user is hovering over a polygon, it will still have the hover effect.
287
+ * Resets a {@link MappedinPolygon} back to it's original color. See also {@link clearAllPolygonColors} and
288
+ * {@link setPolygonColor}. If the user is hovering over a polygon, it will still
289
+ * have the hover color set by {@link setHoverColor}.
290
+ *
291
+ * ```ts
292
+ * mapView.setPolygonColor(polygon, "#0000ff");
293
+ *
294
+ * ...
194
295
  *
195
- * @param polygonOrPolygonId The Polygon/Polygon ID to reset.
296
+ * // Reset the polygon color
297
+ * mapView.clearPolygonColor(polygon);
298
+ * ```
299
+ *
300
+ * @param polygonOrPolygonId The {@link MappedinPolygon} to reset the color of.
196
301
  */
197
302
  clearPolygonColor(polygonOrPolygonId: MappedinPolygon | string): void;
198
303
  /**
199
- * Resets ALL Polygons you have changed with {@link MapView.setPolygonColor} back to their original color.
200
- * The hover effect will still be present if the user is currently hovering over a Polygon.
304
+ * Resets all {@link MappedinPolygon} instances back to their original colors. See also {@link clearPolygonColor} and
305
+ * {@link setPolygonColor}. If the user is hovering over a polygon, it will still
306
+ * have the hover color set by {@link setHoverColor}.
307
+ *
308
+ * ```ts
309
+ * mapView.clearAllPolygonColors();
310
+ * ```
201
311
  */
202
312
  clearAllPolygonColors(): void;
203
313
  /**
204
- * Makes a single Polygon hoverable/clickable. Polygons you haven't called this on will be treated as non-interactive and not respond to any mouse events.
314
+ * Makes a {@link MappedinPolygon} interactive. This means it will receive a hover effect and
315
+ * respond to the `CLICK` {@link E_SDK_EVENT}. See also {@link on} and {@link addInteractivePolygonsForAllLocations}.
316
+ *
317
+ * ```ts
318
+ * // Make all washroom polygons clickable
319
+ * const washroom = mapView.venue.find((l) => l.name === "Washroom")!;
320
+ * for (const polygon of washroom.polygons) {
321
+ * mapView.addInteractivePolygon(polygon);
322
+ * }
323
+ *
324
+ * // Now they will be populated in click events
325
+ * mapView.on(E_SDK_EVENT.CLICK, ({ polygons }) -> {
326
+ * if (polygons.length > 0) {
327
+ * console.log("Clicked on a washroom!");
328
+ * }
329
+ * })
330
+ * ```
205
331
  *
332
+ * @param polygonOrPolygonId The {@link MappedinPolygon} to make interactive.
206
333
  */
207
334
  addInteractivePolygon(polygonOrPolygonId: MappedinPolygon | string): void;
208
335
  /**
209
- * Makes all polygons attached to a location hoverable/clickable. Polygons you haven't called this on will be treated as non-interactive
210
- * This is a convenience function for calling {@link MapView.addInteractivePolygon} on all the polygons attached to all locations. You may also make individual polygons interactive with the addInteractivePolygon method instead of, or in addition to this method.
336
+ * Makes all {@link MappedinPolygon} instances with an attached {@link MappedinLocation} interactive.
337
+ * This means they will receive a hover effect and respond to the `CLICK` {@link E_SDK_EVENT}. See also
338
+ * {@link on} and {@link addInteractivePolygon}.
211
339
  *
340
+ * ```ts
341
+ * mapView.addInteractivePolygonsForAllLocations();
342
+ *
343
+ * // Now all polygons with locations can be clicked
344
+ * mapView.on(E_SDK_EVENT.CLICK, ({ polygons }) => {
345
+ * if (polygons.length > 0) {
346
+ * for (const polygon of polygons) {
347
+ * console.log(`clicked on ${polygon.locations[0].name}`)
348
+ * }
349
+ * }
350
+ * });
351
+ * ```
212
352
  */
213
353
  addInteractivePolygonsForAllLocations(options?: {
214
354
  /**
@@ -221,28 +361,33 @@ declare module '@mappedin/mappedin-js/renderer/public/MapView' {
221
361
  locations?: MappedinLocation[];
222
362
  }): void;
223
363
  /**
224
- * Makes a polygon no longer hoverable/clickable.
364
+ * Makes a polygon no longer hoverable/clickable. See also {@link addInteractivePolygon} and
365
+ * {@link addInteractivePolygonsForAllLocations}.
225
366
  *
226
- * @param polygonOrPolygonId The previously interactive Polygon/Polygon ID to make non-interactive.
367
+ * @param polygonOrPolygonId The {@link MappedinPolygon} to make no longer interactive.
227
368
  */
228
369
  removeInteractivePolygon(polygonOrPolygonId: MappedinPolygon | string): void;
229
370
  /**
230
371
  * Attach any HTML to a {@link MappedinNode} or {@link MappedinCoordinate}, and have the marker interact and collide with smart labels and tooltips
231
- * @deprecated use `mapView.Markers.add` instead.
372
+ * @deprecated use {@link Markers.add} instead.
232
373
  */
233
374
  createMarker(nodeOrCoordinate: MappedinNode | MappedinCoordinate, contentHtml: string, options?: TCreateMarkerOptions): Marker;
234
375
  /**
235
376
  * Remove Marker
236
- * @deprecated use `mapView.Markers.remove` instead.
377
+ * @deprecated use {@link Markers.remove} instead.
237
378
  */
238
379
  removeMarker(markerOrMarkerId: Marker | Marker['id']): void;
239
380
  /**
240
381
  * Removes all Markers (from all Maps, not just the current one).
241
- * @deprecated use `mapView.Markers.removeAll` instead.
382
+ * @deprecated use {@link Markers.removeAll} instead.
242
383
  */
243
384
  removeAllMarkers(): void;
244
385
  /**
245
- * Remove all tooltips
386
+ * Remove all tooltips created with {@link createTooltip} or {@link createCustomTooltip}.
387
+ *
388
+ * ```ts
389
+ * mapView.removeAllTooltips();
390
+ * ```
246
391
  */
247
392
  removeAllTooltips(): void;
248
393
  /**
@@ -302,12 +447,12 @@ declare module '@mappedin/mappedin-js/renderer/public/MapView' {
302
447
  */
303
448
  removeTooltip(tooltipOrTooltipId: SmartTooltip | SmartTooltip['id']): void;
304
449
  /**
305
- * Let any image attached to a Polygon attached to a Location flip 180 degrees with the camera so it's always upright.
450
+ * Let any image attached to a Polygon attached to a Location flip 180 degrees with the camera
451
+ * so it's always upright. See also {@link enableImageFlippingForPolygon}.
306
452
  *
307
- * @method enableImageFlippingForAllLocations
308
- * @param options
309
- * @param [options.excludeTypes=[]] {[String]} A list of Location types to skip, if for some reason there are Locations that have logos that shouldn't flip.
310
- * @param [options.locations] {[MappedinLocation]|[String]} An array of Location objects, or Location IDs. If excludeTypes is not sufficient you can explicitly set the Locations you are marking to flip. You can also call {{#crossLink "MapView/enableImageFlippingForPolygon:method"}}{{/crossLink}} manually for every polygon you care about instead.
453
+ * ```ts
454
+ * mapView.enableImageFlippingForAllLocations();
455
+ * ```
311
456
  */
312
457
  enableImageFlippingForAllLocations(options?: {
313
458
  /**
@@ -320,13 +465,29 @@ declare module '@mappedin/mappedin-js/renderer/public/MapView' {
320
465
  locations?: MappedinLocation[] | string[];
321
466
  }): void;
322
467
  /**
323
- * Mark a specific Polygon so, if it has an image, it rotates with the camera.
468
+ * Mark a specific {@link MappedinPolygon} so, if it has an image, it rotates with the camera.
469
+ * See also {@link enableImageFlippingForAllLocations}.
470
+ *
471
+ * ```ts
472
+ * // Enable image flipping for locations with type "Anchor"
473
+ * const anchorStores = mapView.venue.locations.filter((l) => l.type === "Anchor");
474
+ * for(const store of anchorStores) {
475
+ * for(const polygon of anchorStores.polygons) {
476
+ * mapView.enableImageFlippingForPolygon(polygon);
477
+ * }
478
+ * }
479
+ * ```
324
480
  *
481
+ * @param polygon The {@link MappedinPolygon} to enable image flipping for.
325
482
  */
326
483
  enableImageFlippingForPolygon(polygon: MappedinPolygon): void;
484
+ /**
485
+ * Disable image flipping that was enabled with {@link enableImageFlippingForPolygon} or
486
+ * {@link enableImageFlippingForAllLocations}.
487
+ */
327
488
  disableImageFlippingForAllPolygons(): void;
328
489
  /**
329
- * @deprecated Use `mapView.Paths.add` instead.
490
+ * @deprecated Use {@link Paths.add} instead.
330
491
  *
331
492
  * Draws an entire path. It takes a list of Nodes and will break them into separate pathSegments on every map change, putting the resultant segment on the right Map.
332
493
  *
@@ -335,85 +496,125 @@ declare module '@mappedin/mappedin-js/renderer/public/MapView' {
335
496
  */
336
497
  drawPath(path: MappedinNode[], options?: TPathOptions): string;
337
498
  /**
338
- * @deprecated Use `mapView.Paths.remove` instead.
499
+ * @deprecated Use {@link Paths.remove} instead.
339
500
  *
340
501
  * Remove a path by id
341
502
  */
342
503
  removePath(pathId: string): void;
343
504
  /**
344
- * @deprecated Use `mapView.Paths.removeAll` instead.
505
+ * @deprecated Use {@link Paths.removeAll} instead.
345
506
  *
346
507
  * Removes all pathSegments from all Maps.
347
508
  */
348
509
  removeAllPaths(): void;
349
510
  /**
350
- * Sets the clear color of the Map something else, it you want it to fit it more with your website. Otherwise the div will be white where there is no Map visible.
511
+ * Sets the color of empty space in the scene. Useful for matching the aesthetics of the
512
+ * surrounding website of application. Otherwise the container element will be white where
513
+ * there is no map visible.
514
+ *
515
+ * ```ts
516
+ * // Make the background a dark grey
517
+ * mapView.setBackgroundColor("#050505");
518
+ * ```
351
519
  *
352
- * @param color The color to use. Not an HTML color name.
353
- * @param alpha Opacity between 0 and 1.
520
+ * @param color A hexidecimal color string to use.
521
+ * @param alpha A number between 0 and 1 representing opacity.
354
522
  */
355
523
  setBackgroundColor(color: string, alpha?: number): void;
356
524
  /**
357
- * Sets the color for hovering over polygons
525
+ * Sets a color that {@link MappedinPolygon} instances will receive when they are
526
+ * beneath a cursor. This only applies to interactive polygons set using {@link addInteractivePolygon}
527
+ * or {@link addInteractivePolygonsForAllLocations}.
528
+ *
529
+ * ```ts
530
+ * // Make all location polygons interactive and have a red hover color
531
+ * mapView.addInteractivePolygonsForAllLocations()
532
+ * mapView.setHoverColor("#ff0000");
533
+ * ```
358
534
  */
359
535
  setHoverColor(color: string): void;
360
536
  /**
361
- * The scene only renders when something has changed. This should be something a 3rd party developer doesn't need to worry about,
362
- * but if you are doing something weird, or have your own special tween for something, you will want to call this function.
363
- * You can call it as often as you want, it just sets a flag that we need to render again, and renders a few frames if we weren't already doing that.
364
- * Ignored in 2D.
365
- * @deprecated
537
+ * @deprecated This should no longer need to be called externally and is now a no-op.
366
538
  */
367
539
  tryRendering(_renderMode?: any): void;
368
540
  /**
369
- * Finds the main Location associated with a Polygon. This means a Location
370
- * attached to the Polygon that has no parents, or, if there are none of those,
371
- * a Location nearest the top of some hierarchy that does have the Polygon attached.
541
+ * Finds the main {@link MappedinLocation} associated with a {@link MappedinPolygon}.
542
+ * This means a location attached to the polygon that has no parents, or, if there
543
+ * are none of those, a location nearest the top of some hierarchy that does have the
544
+ * polygon attached.
372
545
  *
373
- * This means if there are multiple hierarchies of Locations attached to the Polygon,
546
+ * This means if there are multiple hierarchies of locations attached to the polygon,
374
547
  * the one that gets returned is not guaranteed to be what you want.
375
548
  *
376
- * @param polygon The Polygon you want the primary Location of.
549
+ * ```
550
+ * // Log the primary location of a clicked polygon
551
+ * mapView.on(E_SDK_EVENT.CLICK, ({ polygons }) => {
552
+ * if (polygons.length > 0) {
553
+ * for(const polygon of polygons) {
554
+ * console.log(mapView.getPrimaryLocationForPolygon(polygon));
555
+ * }
556
+ * }
557
+ * });
558
+ * ```
559
+ *
560
+ * @param polygon The {@link MappedinPolygon} you want the primary location of.
377
561
  */
378
562
  getPrimaryLocationForPolygon(polygon: MappedinPolygon): MappedinLocation;
379
563
  /**
380
- * Finds all polygons that contain the specified MappedinCoordinate. If multiple
381
- * polygons are stacked on top of each other, the array of polygons returned will be
564
+ * Finds all {@link MappedinPolygon} instances that contain the specified {@link MappedinCoordinate}.
565
+ * If multiple polygons are stacked on top of each other, the array of polygons returned will be
382
566
  * in the order of top to bottom.
383
567
  *
384
- * By default, this only considers interactive polygons.
568
+ * By default, this only considers interactive polygons set through {@link addInteractivePolygon} or
569
+ * {@link addInteractivePolygonsForAllLocations}. This behaviour can be changed by passing
570
+ * `options.includeNonInteractive`.
385
571
  *
386
- * @param coordinate The MappedinCoordinate to check
387
- * @param options {@link TGetPolygonsAtCoordinateOptions}
388
- * @returns MappedinPolygon[]
572
+ * ```ts
573
+ * const polygons = mapView.getPolygonsAtCoordinate(coordinate);
574
+ * ```
575
+ *
576
+ * @param coordinate The {@link MappedinCoordinate} to check.
577
+ * @param options
578
+ * @returns An array of {@link MappedinPolygon} instances intersecting the given coordinate.
389
579
  */
390
580
  getPolygonsAtCoordinate(coordinate: MappedinCoordinate, options?: TGetPolygonsAtCoordinateOptions): MappedinPolygon[];
391
581
  /**
392
- * Finds all the polygons on a screen coordinate x and y. If multiple
393
- * polygons are stacked on top of each other, the array of polygons returned will be
394
- * in the order of farthest to closest.
582
+ * Finds all {@link MappedinPolygon} instances that intersect the specified XY-coordinate on screen.
583
+ * If multiple polygons are stacked on top of each other, the array of polygons returned will be
584
+ * in the order of top to bottom.
395
585
  *
396
- * By default, this only considers interactive polygons.
586
+ * By default, this only considers interactive polygons set through {@link addInteractivePolygon} or
587
+ * {@link addInteractivePolygonsForAllLocations}. This behaviour can be changed by passing
588
+ * `options.includeNonInteractive`.
397
589
  *
398
- * @param x
399
- * @param y
400
- * @param options {@link TGetPolygonsAtCoordinateOptions}
401
- * @returns MappedinPolygon[]
590
+ * ```ts
591
+ * const polygons = mapView.getPolygonsAtScreenCoordinate(100, 100);
592
+ * ```
593
+ *
594
+ * @param x The x value of a screen coordinate
595
+ * @param y The y value of a screen coordinate
596
+ * @param options
597
+ * @returns An array of {@link MappedinPolygon} instances intersecting the given coordinate.
402
598
  */
403
599
  getPolygonsAtScreenCoordinate(x: number, y: number, options?: TGetPolygonsAtCoordinateOptions): MappedinPolygon[];
404
600
  /**
405
- * Destroy instance and reclaim memory. Note: this does not destroy the instance of {@link Mappedin}
406
- * that was passed in. For applications that require destroying and re-creating the mapView, it is
407
- * recommended to keep the {@link Mappedin} object around.
601
+ * Destroy the mapView instance and reclaim memory.
602
+ *
603
+ * NOTE: this does not destroy the instance of {@link Mappedin} that was passed in. For applications that
604
+ * require destroying and re-creating the mapView, it is recommended to keep the {@link Mappedin} object
605
+ * around.
606
+ *
607
+ * ```ts
608
+ * mapView.destroy();
609
+ * ```
408
610
  */
409
611
  destroy(): void;
410
612
  }
411
613
  }
412
614
 
413
615
  declare module '@mappedin/mappedin-js/get-venue' {
414
- import type { TGetVenueOptions } from '@mappedin/mappedin-js/get-venue/Mappedin.types';
616
+ import type { TGetVenueOptions, TVenueMetadata } from '@mappedin/mappedin-js/get-venue/Mappedin.types';
415
617
  import { Mappedin } from '@mappedin/mappedin-js/get-venue/Mappedin';
416
- export { E_SDK_LOG_LEVEL, setLoggerLevel } from '@mappedin/mappedin-js/--/common/Mappedin.Logger';
417
618
  /**
418
619
  * This is how we can avoid bundling in node-fetch (via isomorphic fetch),
419
620
  * which keeps popping up in security advisories
@@ -462,6 +663,7 @@ declare module '@mappedin/mappedin-js/get-venue' {
462
663
  export type { TLocationType, TNode, TImage, TLogo, TGalleryImage, TPhone, TSocial, TColor, TVortex, TPicture, TOpeningHours, TSiblingGroup, TState, TCategory, TEvent, TGeoReference, TMap, TMapGroup, TBuilding, TLocation, TPolygon, TPolygonRanking, TVenue, TMappedinAPI, } from '@mappedin/mappedin-js/get-venue/Mappedin.API.types';
463
664
  export type { TGetVenueOptions } from '@mappedin/mappedin-js/get-venue/Mappedin.types';
464
665
  import { MAP_RENDER_MODE } from '@mappedin/mappedin-js/get-venue/Mappedin.types';
666
+ import { ParsedMVF } from '@mappedin/mvf';
465
667
  export type TShowVenueOptions = {
466
668
  /**
467
669
  * Sets the initial background color of the map, including while loading.
@@ -498,6 +700,7 @@ declare module '@mappedin/mappedin-js/get-venue' {
498
700
  * Get Venue Data for a Mappedin Venue
499
701
  */
500
702
  export function getVenue(userOptions: TGetVenueOptions): Promise<Mappedin>;
703
+ export function getVenueMetadata(userOptions: TGetVenueOptions): Promise<TVenueMetadata>;
501
704
  /**
502
705
  * @internal
503
706
  */
@@ -546,7 +749,7 @@ declare module '@mappedin/mappedin-js/get-venue' {
546
749
  /**
547
750
  * @internal
548
751
  */
549
- export function downloadVenueBundleMVF(options: TGetVenueBundleOptions): Promise<unknown>;
752
+ export function downloadVenueBundleMVF(options: TGetVenueBundleOptions): Promise<Uint8Array>;
550
753
  /**
551
754
  * Returns a {@link Mappedin} object hydrated with JSON data.
552
755
  * @param {string|Object} mappedinSerializableData A JSON string or object representing a venue.
@@ -554,6 +757,11 @@ declare module '@mappedin/mappedin-js/get-venue' {
554
757
  * @returns {Mappedin} A new Mappedin object with data from the mappedinSerializableData parameter.
555
758
  */
556
759
  export function hydrateVenue(mappedinSerializableData: any, shouldPopulateBundledImagesAsBlobs?: boolean): Promise<Mappedin>;
760
+ /**
761
+ * @internal
762
+ * Returns a {@link Mappedin} object hydrated with MVF data.
763
+ */
764
+ export function hydrateVenueMVF(mvfData: ParsedMVF): Promise<Mappedin>;
557
765
  }
558
766
 
559
767
  declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.BlueDot/Mappedin.BlueDot.core' {
@@ -836,6 +1044,9 @@ declare module '@mappedin/mappedin-js/renderer/MapView.types' {
836
1044
  location?: MappedinLocation;
837
1045
  };
838
1046
  export type TMarkerTemplateFn = ({ icon, location }: TMarkerTemplateProps) => string;
1047
+ /**
1048
+ * Configure the behaviour of a {@link Journey}.
1049
+ */
839
1050
  export type TJourneyOptions = {
840
1051
  /**
841
1052
  * What color to highlight departure and destination polygons
@@ -1052,10 +1263,20 @@ declare module '@mappedin/mappedin-js/renderer/MapView.types' {
1052
1263
  */
1053
1264
  firstMap?: MappedinMap | string;
1054
1265
  /**
1266
+ * @experimental
1267
+ *
1055
1268
  * Multi-buffer rendering should improve performance but may cause issues on older GPUs/browsers
1056
- * @default true
1269
+ * @default false
1057
1270
  */
1058
1271
  multiBufferRendering?: boolean;
1272
+ /**
1273
+ * @experimental
1274
+ *
1275
+ * Journey path will be visible through other objects. Note: this is on by default, but requires the
1276
+ * `multiBufferRendering` option (which is off by default) to be turned on.
1277
+ * @default true
1278
+ */
1279
+ xRayPath?: boolean;
1059
1280
  /**
1060
1281
  * True if the `opacity` argument to `setBackgroundColor` should be considered.
1061
1282
  * @default true
@@ -1120,6 +1341,9 @@ declare module '@mappedin/mappedin-js/renderer/MapView.types' {
1120
1341
  onWebGLContextRestored?: () => void;
1121
1342
  onWebGLRendererError?: () => void;
1122
1343
  };
1344
+ /**
1345
+ * Control how a flat label looks
1346
+ */
1123
1347
  export type TFlatLabelOptions = {
1124
1348
  text: string;
1125
1349
  /**
@@ -1148,6 +1372,9 @@ declare module '@mappedin/mappedin-js/renderer/MapView.types' {
1148
1372
  align: 'left' | 'right' | 'center';
1149
1373
  };
1150
1374
  };
1375
+ /**
1376
+ * Control how a flat label looks
1377
+ */
1151
1378
  export type TFlatLabelAppearance = {
1152
1379
  /**
1153
1380
  * By default this is the upper bounds of the Polygon. If you don't have a Polygon, or want a custom height for some reason, you can set this.
@@ -1253,6 +1480,9 @@ declare module '@mappedin/mappedin-js/renderer/MapView.types' {
1253
1480
  };
1254
1481
  /**
1255
1482
  * @deprecated
1483
+ *
1484
+ * Use {@link FlatLabels.add} or {@link FloatingLabels.add} to get more fine tuned control when labelling
1485
+ * all locations.
1256
1486
  */
1257
1487
  export type TLabelAllLocationFlatLabelOptions = TLabelAllLocationCommonOptions & {
1258
1488
  /**
@@ -1262,10 +1492,16 @@ declare module '@mappedin/mappedin-js/renderer/MapView.types' {
1262
1492
  flatLabels: true;
1263
1493
  appearance?: TFlatLabelAppearance;
1264
1494
  };
1495
+ /**
1496
+ * Options for controlling bulk location labelling
1497
+ */
1265
1498
  export type TFloatingLabelAllLocationsOptions = TLabelAllLocationCommonOptions & {
1266
1499
  appearance?: TFloatingLabelAppearance;
1267
1500
  interactive?: boolean;
1268
1501
  };
1502
+ /**
1503
+ * Options for controlling bulk location labelling
1504
+ */
1269
1505
  export type TFlatLabelAllLocationsOptions = TLabelAllLocationCommonOptions & {
1270
1506
  appearance?: TFlatLabelAppearance;
1271
1507
  };
@@ -1309,6 +1545,9 @@ declare module '@mappedin/mappedin-js/renderer/MapView.types' {
1309
1545
  */
1310
1546
  paths?: Path[];
1311
1547
  };
1548
+ /**
1549
+ * Arguments that get passed to listeners of an {@link E_SDK_EVENT}.
1550
+ */
1312
1551
  export type E_SDK_EVENT_PAYLOAD = {
1313
1552
  [E_SDK_EVENT.CLICK]: TMapClickEvent;
1314
1553
  [E_SDK_EVENT.STATE_CHANGE]: STATE;
@@ -1316,6 +1555,9 @@ declare module '@mappedin/mappedin-js/renderer/MapView.types' {
1316
1555
  [E_SDK_EVENT.NOTHING_CLICKED]: undefined;
1317
1556
  [E_SDK_EVENT.MAP_CHANGED]: MappedinMap;
1318
1557
  };
1558
+ /**
1559
+ * Arguments that get passed to listeners of an {@link E_BLUEDOT_EVENT}.
1560
+ */
1319
1561
  export type E_BLUEDOT_EVENT_PAYLOAD = {
1320
1562
  /**
1321
1563
  * Emitted when the BlueDot position updates
@@ -1327,7 +1569,7 @@ declare module '@mappedin/mappedin-js/renderer/MapView.types' {
1327
1569
  [E_BLUEDOT_EVENT.STATE_CHANGE]: TBlueDotStateChange;
1328
1570
  };
1329
1571
  /**
1330
- * @enum
1572
+ * Arguments that get passed to listeners of an {@link E_CAMERA_EVENT}.
1331
1573
  */
1332
1574
  export type CAMERA_EVENT_PAYLOAD = {
1333
1575
  [E_CAMERA_EVENT.USER_INTERACTION_START]: void;
@@ -1408,7 +1650,7 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.Marker' {
1408
1650
 
1409
1651
  declare module '@mappedin/mappedin-js/renderer/private/controllers/MarkersController' {
1410
1652
  import { MappedinCoordinate, MappedinNode } from '@mappedin/mappedin-js/get-venue';
1411
- import type { ICore, TCreateMarkerOptions, TAnimationOptions } from '@mappedin/mappedin-js/renderer/internal';
1653
+ import { ICore, TCreateMarkerOptions, TAnimationOptions } from '@mappedin/mappedin-js/renderer/internal';
1412
1654
  import { InternalMarker } from '@mappedin/mappedin-js/renderer/internal';
1413
1655
  import TWEEN from '@tweenjs/tween.js';
1414
1656
  /**
@@ -1614,34 +1856,93 @@ declare module '@mappedin/mappedin-js/renderer/public/api/FlatLabels' {
1614
1856
  import { MappedinPolygon } from '@mappedin/mappedin-js/get-venue';
1615
1857
  import FlatLabelsController from '@mappedin/mappedin-js/renderer/private/controllers/FlatLabelsController';
1616
1858
  import { TFlatLabelAllLocationsOptions, TAddFlatLabelOptions, TFlatLabelAppearance } from '@mappedin/mappedin-js/renderer/MapView.types';
1859
+ /**
1860
+ * API to add and remove flat labels on the map.
1861
+ */
1617
1862
  export interface IFlatLabels<T = void> {
1618
1863
  /**
1619
- * Adds a flat label to the polygons associated with all locations on the venue.
1864
+ * Add a flat label to the polygons associated with all locations on the venue.
1620
1865
  * The text is automatically determined based on location data.
1866
+ *
1867
+ * ```ts
1868
+ * // Draw red labels on all polygons with a location
1869
+ * mapView.FlatLabels.labelAllLocations({
1870
+ * appearance: {
1871
+ * color: 'red',
1872
+ * }
1873
+ * });
1874
+ * ```
1875
+ * @param options
1621
1876
  */
1622
1877
  labelAllLocations(options?: TFlatLabelAllLocationsOptions): T;
1623
1878
  /**
1624
- * Adds a flat label to a single polygon.
1879
+ * Add a flat label to a single polygon.
1880
+ *
1881
+ * ```ts
1882
+ * // Label the apple store with the label "Apple Store"
1883
+ * const location = mapView.venue.locations.find((l) => l.name === "Apple")!;
1884
+ * mapView.FlatLabels.add(location.polygons[0], "Apple Store");
1885
+ * ```
1886
+ *
1887
+ * @param polygon The {@link MappedinPolygon} to label.
1888
+ * @param text The text to display on the label.
1889
+ * @param options
1625
1890
  */
1626
1891
  add(polygon: MappedinPolygon, text: string, options?: TAddFlatLabelOptions): T;
1627
1892
  /**
1628
- * Removes a flat label from a single polygon.
1893
+ * Remove a flat label from a single polygon.
1894
+ *
1895
+ * ```ts
1896
+ * mapView.FlatLabels.add(polygon, "Label");
1897
+ *
1898
+ * ...
1899
+ *
1900
+ * // Remove the label currently on this polygon
1901
+ * mapView.FlatLabels.remove(polygon);
1902
+ * ```
1903
+ *
1904
+ * @param polygon The {@link MappedinPolygon} with a label to remove.
1629
1905
  */
1630
1906
  remove(polygon: MappedinPolygon): T;
1631
1907
  /**
1632
- * Removes all flat labels from the venue.
1908
+ * Remove all flat labels from the venue.
1909
+ *
1910
+ * ```ts
1911
+ * mapView.FlatLabels.add(polygon1, "Label 1");
1912
+ * mapView.FlatLabels.add(polygon2, "Label 2");
1913
+ *
1914
+ * ...
1915
+ *
1916
+ * // Remove all labels from all polygons
1917
+ * mapView.FlatLabels.removeAll();
1918
+ * ```
1633
1919
  */
1634
1920
  removeAll(): T;
1635
1921
  /**
1636
- * Updates the appearance attributes of an already-existing label. If the
1922
+ * Update the appearance attributes of an already-existing label. If the
1637
1923
  * provided polygon does not have a label already, this is a no-op.
1924
+ *
1925
+ * ```ts
1926
+ * mapView.FlatLabels.setAppearance(polygon, {
1927
+ * color: 'blue',
1928
+ * font: 'times',
1929
+ * });
1930
+ * ```
1931
+ *
1932
+ * @param polygon The {@link MappedinPolygon} with a label to update.
1933
+ * @param appearance The new {@link TFlatLabelAppearance} settings to apply to the polygon's label.
1638
1934
  */
1639
1935
  setAppearance(polygon: MappedinPolygon, appearance: TFlatLabelAppearance): T;
1640
1936
  /**
1641
- * Sets the hover text color for all Flat Labels.
1642
- * Expects color in hexadecimal string e.g. `#2e2e2e`
1937
+ * Set the hover text color for all Flat Labels. To set hover color for all polygons,
1938
+ * see {@link MapView.setHoverColor}.
1643
1939
  *
1644
- * To set hover color for all polygons, see {@link MapView.setHoverColor}.
1940
+ * ```ts
1941
+ * // Make all flat labels turn red on hover
1942
+ * mapView.FlatLabels.setHoverColorForAll('#ff0000');
1943
+ * ```
1944
+ *
1945
+ * @param color A hexidecimal string representing the hover color.
1645
1946
  */
1646
1947
  setHoverColorForAll(color: string): T;
1647
1948
  }
@@ -1664,37 +1965,117 @@ declare module '@mappedin/mappedin-js/renderer/public/api/FloatingLabels' {
1664
1965
  import { MappedinNode, MappedinPolygon } from '@mappedin/mappedin-js/get-venue';
1665
1966
  import { TAddFloatingLabelOptions, TFloatingLabelAllLocationsOptions, TFloatingLabelAppearance } from '@mappedin/mappedin-js/renderer/MapView.types';
1666
1967
  import FloatingLabelsController from '@mappedin/mappedin-js/renderer/private/controllers/FloatingLabelsController';
1968
+ /**
1969
+ * API to add and remove floating labels on the map.
1970
+ */
1667
1971
  export interface IFloatingLabels<T = void> {
1668
1972
  /**
1669
- * Adds a floating label to the polygons associated with all locations on the venue.
1670
- * The text is automatically determined based on location data.
1973
+ * Add a floating label to one entrance node of each polygons associated with all
1974
+ * locations on the venue. The text is automatically determined based on location data.
1975
+ *
1976
+ * ```ts
1977
+ * // Draw red labels with black outlines on an entrance node of all polygons with a location
1978
+ * mapView.FloatingLabels.labelAllLocations({
1979
+ * appearance: {
1980
+ * text: {
1981
+ * foregroundColor: 'red',
1982
+ * backgroundColor: 'black',
1983
+ * }
1984
+ * }
1985
+ * });
1986
+ * ```
1987
+ * @param options
1671
1988
  */
1672
1989
  labelAllLocations(options?: TFloatingLabelAllLocationsOptions): T;
1673
1990
  /**
1674
- * Adds a floating label to a single polygon or node.
1991
+ * Add a floating label to a single polygon or node. When labelling a polygon,
1992
+ * all entrance nodes of that polygon receive a label.
1993
+ *
1994
+ * ```ts
1995
+ * // Label the apple store with the label "Apple Store"
1996
+ * const location = mapView.venue.locations.find((l) => l.name === "Apple")!;
1997
+ * mapView.FloatingLabels.add(location.nodes[0], "Apple Store");
1998
+ * ```
1999
+ *
2000
+ * @param polygonOrNode The {@link MappedinPolygon} or {@link MappedinNode} to label.
2001
+ * @param text The text to display on the label.
2002
+ * @param options
1675
2003
  */
1676
2004
  add(polygonOrNode: MappedinPolygon | MappedinNode, text: string, options?: TAddFloatingLabelOptions): T;
1677
2005
  /**
1678
- * Updates the appearance of the label of a single polygon or node
2006
+ * Update the appearance attributes of an already-existing label. If the
2007
+ * provided polygon or node does not have a label already, this is a no-op.
2008
+ *
2009
+ * ```ts
2010
+ * mapView.FloatingLabels.setAppearance(node, {
2011
+ * text: {
2012
+ * size: 25,
2013
+ * }
2014
+ * });
2015
+ * ```
2016
+ *
2017
+ * @param polygonOrNode The {@link MappedinPolygon} or {@link MappedinNode} with a label to update.
2018
+ * @param appearance The new {@link TFlatLabelAppearance} settings to apply to the polygon's label.
1679
2019
  */
1680
2020
  setAppearance(polygonOrNode: MappedinPolygon | MappedinNode, appearance: TFloatingLabelAppearance): T;
1681
2021
  /**
1682
- * Removes a floating label from a single polygon or node.
2022
+ * Remove a floating label from a single polygon or node.
2023
+ *
2024
+ * ```ts
2025
+ * mapView.FloatingLabels.add(polygon, "Label");
2026
+ *
2027
+ * ...
2028
+ *
2029
+ * // Remove the label currently on this polygon's first entrance
2030
+ * mapView.FloatingLabels.remove(polygon.entrances[0]);
2031
+ * ```
2032
+ *
2033
+ * @param polygonOrNode The {@link MappedinPolygon} or {@link MappedinNode} with a label to remove.
1683
2034
  */
1684
2035
  remove(polygonOrNode: MappedinPolygon | MappedinNode): T;
1685
2036
  /**
1686
- * Removes all floating labels from the venue.
2037
+ * Remove all floating labels from the venue.
2038
+ *
2039
+ * ```ts
2040
+ * mapView.FloatingLabels.add(polygon, "Label 1");
2041
+ * mapView.FloatingLabels.add(node, "Label 2");
2042
+ *
2043
+ * ...
2044
+ *
2045
+ * // Remove all labels from all polygons
2046
+ * mapView.FloatingLabels.removeAll();
2047
+ * ```
1687
2048
  */
1688
2049
  removeAll(): T;
1689
2050
  /**
1690
2051
  * Updates the priority of an existing floating label (or labels, in the case
1691
2052
  * of a polygon). This controls whether it is preferred over other labels
1692
2053
  * during collisions.
2054
+ *
2055
+ * ```ts
2056
+ * // Polygon 1's label should always show above polygon 2's label
2057
+ * mapView.FloatingLabels.setPriority(polygon0, 0);
2058
+ * mapView.FloatingLabels.setPriority(polygon1, 1);
2059
+ * ```
2060
+ *
2061
+ * @param polygonOrNode The {@link MappedinPolygon} or {@link MappedinNode} with a label to update.
1693
2062
  */
1694
2063
  setPriority(polygonOrNode: MappedinPolygon | MappedinNode, priority: number): T;
1695
2064
  /**
1696
2065
  * Resets the priority of an existing floating label (or labels, in the case
1697
2066
  * of a polygon)
2067
+ *
2068
+ * ```ts
2069
+ * mapView.FloatingLabels.setPriority(polygon0, 0);
2070
+ * mapView.FloatingLabels.setPriority(polygon1, 1);
2071
+ *
2072
+ * ...
2073
+ *
2074
+ * // Labels should now behave as they did by default
2075
+ * mapView.FloatingLabels.resetPriority();
2076
+ * ```
2077
+ *
2078
+ * @param polygonOrNode The {@link MappedinPolygon} or {@link MappedinNode} with a label to update.
1698
2079
  */
1699
2080
  resetPriority(polygonOrNode: MappedinPolygon | MappedinNode): T;
1700
2081
  }
@@ -1717,6 +2098,9 @@ declare module '@mappedin/mappedin-js/renderer/public/api/FloatingLabels' {
1717
2098
  declare module '@mappedin/mappedin-js/renderer/public/api/Camera' {
1718
2099
  import { E_CAMERA_DIRECTION } from '@mappedin/mappedin-js/renderer/MapView.enums';
1719
2100
  import CameraController, { TCameraAnimationOptions, TCameraTargets, TCameraTransform, TFocusOnCameraOptions } from '@mappedin/mappedin-js/renderer/private/controllers/CameraController';
2101
+ /**
2102
+ * API to control and respond to the state of the camera within the scene.
2103
+ */
1720
2104
  export class Camera {
1721
2105
  #private;
1722
2106
  /**
@@ -1932,17 +2316,73 @@ declare module '@mappedin/mappedin-js/renderer/public/api/Camera' {
1932
2316
 
1933
2317
  declare module '@mappedin/mappedin-js/renderer/public/api/BlueDot' {
1934
2318
  import { BlueDotController, TEnableBlueDotOptions } from '@mappedin/mappedin-js/renderer/MapView.types';
2319
+ /**
2320
+ * API to enable and respond to user position updates.
2321
+ */
1935
2322
  export class BlueDot {
1936
2323
  #private;
2324
+ /**
2325
+ * @hidden
2326
+ */
1937
2327
  constructor(controller: BlueDotController);
2328
+ /**
2329
+ * Subscribe a function to be called when an {@link E_BLUEDOT_EVENT} is fired.
2330
+ *
2331
+ * ```ts
2332
+ * const blueDotChangeHandler = ({ map, nearestNode, position, bearing }) => {
2333
+ * // Do something with the new values
2334
+ * };
2335
+ * mapView.BlueDot.on(E_BLUEDOT_EVENT.POSITION_UPDATE, blueDotChangeHandler);
2336
+ * ```
2337
+ *
2338
+ * @param eventName An {@link E_BLUEDOT_EVENT} that is fired when the blue dot changes.
2339
+ * @param fn A callback that gets called when the corresponding event is fired. The
2340
+ * callback will get passed an argument with a type that's one of {@link E_BLUEDOT_EVENT_PAYLOAD}.
2341
+ */
1938
2342
  on: BlueDotController['on'];
2343
+ /**
2344
+ * Unsubscribe a function that was previously subscribed with {@link on}.
2345
+ *
2346
+ * ```ts
2347
+ * mapView.BlueDot.on(E_BLUEDOT_EVENT.POSITION_UPDATE, blueDotChangeHandler);
2348
+ *
2349
+ * ...
2350
+ *
2351
+ * // Something changed and I no longer want this event to fire
2352
+ * mapView.BlueDot.off(E_BLUEDOT_EVENT.POSITION_UPDATE, blueDotChangeHandler);
2353
+ * ```
2354
+ *
2355
+ * @param eventName An {@link E_BLUEDOT_EVENT} that is fired when the blue dot changes.
2356
+ * @param fn A function that was previously passed to {@link on}. The function must
2357
+ * have the same reference as the function that was subscribed.
2358
+ */
1939
2359
  off: BlueDotController['off'];
1940
2360
  /**
1941
- * Enables Blue Dot. BlueDot then emits {@link TBlueDotStateChange} and {@link TBlueDotPositionUpdate} events via {@link E_BLUEDOT_EVENT}
2361
+ * Enables Blue Dot. A blue dot will appear on the map that responds to the device's geolocation
2362
+ * updates. It then emits {@link TBlueDotStateChange} and {@link TBlueDotPositionUpdate} events
2363
+ * via {@link E_BLUEDOT_EVENT}.
2364
+ *
2365
+ * ```ts
2366
+ * // Enable blue dot
2367
+ * mapView.BlueDot.enable();
2368
+ *
2369
+ * // Disable blue dot
2370
+ * mapView.BlueDot.disable();
2371
+ * ```
2372
+ *
2373
+ * @param options
1942
2374
  */
1943
2375
  enable(options?: TEnableBlueDotOptions): void;
1944
2376
  /**
1945
- * Disables Blue Dot and stops emitting events.
2377
+ * Disables Blue Dot that was enabled with {@link enable} and stops emitting events.
2378
+ *
2379
+ * ```ts
2380
+ * // Enable blue dot
2381
+ * mapView.BlueDot.enable();
2382
+ *
2383
+ * // Disable blue dot
2384
+ * mapView.BlueDot.disable();
2385
+ * ```
1946
2386
  */
1947
2387
  disable(): void;
1948
2388
  }
@@ -1953,38 +2393,95 @@ declare module '@mappedin/mappedin-js/renderer/public/api/Markers' {
1953
2393
  import { MappedinCoordinate, MappedinNode } from '@mappedin/mappedin-js/get-venue';
1954
2394
  import { TCreateMarkerOptions } from '@mappedin/mappedin-js/renderer/index.rn';
1955
2395
  import MarkersController, { Marker } from '@mappedin/mappedin-js/renderer/private/controllers/MarkersController';
2396
+ /**
2397
+ * API to control adding 2D markers to the scene.
2398
+ */
1956
2399
  export class Markers {
1957
2400
  #private;
2401
+ /**
2402
+ * @hidden
2403
+ */
1958
2404
  constructor(markersController: MarkersController);
2405
+ /**
2406
+ * An array of {@link Marker} instances that currently exist.
2407
+ */
1959
2408
  get markers(): Marker[];
1960
2409
  /**
1961
- * Create a new Marker, containing some HTML, at the specified position
1962
- * @param nodeOrCoordinate the position for the Marker
1963
- * @param contentHtml the content to show in the Marker
1964
- * @param options options for the display of the Marker
1965
- * @returns the Marker object that was created.
2410
+ * Create a new {@link Marker}, containing some HTML, at the specified position.
2411
+ *
2412
+ * ```ts
2413
+ * mapView.Markers.add(coordinate, `
2414
+ * <div
2415
+ * id="my-marker"
2416
+ * style="width:100px;height:40px;background:red;"
2417
+ * >
2418
+ * My Marker
2419
+ * </div>
2420
+ * `);
2421
+ * ```
2422
+ *
2423
+ * @param nodeOrCoordinate The {@link MappedinNode} or {@link MappedinCoordinate} to
2424
+ * which the marker is pinned.
2425
+ * @param contentHtml Stringified HTML content to render inside the Marker.
2426
+ * @param options
2427
+ * @returns The {@link Marker} object that was created.
1966
2428
  */
1967
2429
  add(nodeOrCoordinate: MappedinNode | MappedinCoordinate, contentHtml: string, options?: TCreateMarkerOptions): Marker;
1968
2430
  /**
1969
- * Moves a Marker to a new position instantaneously.
1970
- * @param markerOrMarkerId the Marker to move
1971
- * @param target the new position for this Marker
2431
+ * Moves an existing {@link Marker} to a new position instantaneously. See
2432
+ * also {@link animate}.
2433
+ *
2434
+ * ```ts
2435
+ * const marker = mapView.Markers.add(...);
2436
+ *
2437
+ * // Move the marker to a new coordinate
2438
+ * mapView.Markers.setPosition(marker, newCoordinate);
2439
+ * ```
2440
+ *
2441
+ * @param markerOrMarkerId The {@link Marker} to move.
2442
+ * @param target The {@link MappedinNode} or {@link MappedinCoordinate} to
2443
+ * which the marker should be moved.
1972
2444
  */
1973
2445
  setPosition(markerOrMarkerId: Marker | Marker['id'], target: MappedinNode | MappedinCoordinate): void;
1974
2446
  /**
1975
- * Moves a Marker to a new position over time.
1976
- * @param markerOrMarkerId the Marker to move
1977
- * @param target the new position for this Marker
1978
- * @param options the options for how this movement should be animated
2447
+ * Moves an existing {@link Marker} to a new position smoothly over time.
2448
+ *
2449
+ * ```ts
2450
+ * const marker = mapView.Markers.add(...);
2451
+ *
2452
+ * // Animate the marker to a new coordinate over 500ms
2453
+ * mapView.Markers.animate(marker, newCoordinate, {
2454
+ * duration: 500
2455
+ * });
2456
+ * ```
2457
+ *
2458
+ * @param markerOrMarkerId The {@link Marker} to move.
2459
+ * @param target The {@link MappedinNode} or {@link MappedinCoordinate} to
2460
+ * which the marker should be moved.
2461
+ * @param options
1979
2462
  */
1980
2463
  animate(markerOrMarkerId: Marker | Marker['id'], target: MappedinCoordinate | MappedinNode, options?: TAnimationOptions): Promise<void>;
1981
2464
  /**
1982
- * Removes a Marker.
1983
- * @param markerOrMarkerId the Marker to be removed
2465
+ * Removes an existing {@link Marker}.
2466
+ *
2467
+ * ```ts
2468
+ * const marker = mapView.Markers.add(...);
2469
+ *
2470
+ * ...
2471
+ *
2472
+ * // The marker is no longer needed
2473
+ * mapView.Markers.remove(marker);
2474
+ * ```
2475
+ *
2476
+ * @param markerOrMarkerId the {@link Marker} to be removed.
1984
2477
  */
1985
2478
  remove(markerOrMarkerId: Marker | Marker['id']): void;
1986
2479
  /**
1987
- * Remove all Markers from all maps.
2480
+ * Remove all {@link Marker} instances from all maps.
2481
+ *
2482
+ * ```ts
2483
+ * mapView.Markers.removeAll();
2484
+ * ```
1988
2485
  */
1989
2486
  removeAll(): void;
1990
2487
  }
@@ -1995,33 +2492,138 @@ declare module '@mappedin/mappedin-js/renderer/public/api/Paths' {
1995
2492
  import { TPathOptions } from '@mappedin/mappedin-js/renderer/index.rn';
1996
2493
  import PathsController, { Path } from '@mappedin/mappedin-js/renderer/private/controllers/PathsController';
1997
2494
  /**
1998
- * Add and remove paths from maps.
2495
+ * API to add and remove paths from maps. See also {@link Journey}.
2496
+ */
2497
+ export class Paths {
2498
+ #private;
2499
+ /**
2500
+ * @hidden
2501
+ */
2502
+ constructor(pathsController: PathsController);
2503
+ /**
2504
+ * An array of all {@link Path} instances that are currently drawn.
2505
+ */
2506
+ get paths(): Path[];
2507
+ /**
2508
+ * Takes an array of {@link MappedinNode} instances and draws an {@link Path} with
2509
+ * path segments on each map corresponding to the nodes on that map.
2510
+ *
2511
+ * ```ts
2512
+ * const departure = mapView.venue.locations.find((l) => l.name === "Apple")!;
2513
+ * const destination = mapView.venue.locations.find((l) => l.name === "Cleo")!;
2514
+ * const directions = departure.directionsTo(destination);
2515
+ *
2516
+ * // Draw the above directions as a path on the map
2517
+ * mapView.Paths.add(directions.path);
2518
+ * ```
2519
+ *
2520
+ * @param nodes A {@link MappedinNode} array, probably from a {@link MappedinDirections} instance.
2521
+ * @param options
2522
+ */
2523
+ add(nodes: MappedinNode[], options?: TPathOptions): Path;
2524
+ /**
2525
+ * Remove a {@link Path} from all maps it exists on.
2526
+ *
2527
+ * ```ts
2528
+ * const path = mapView.Paths.add(nodes);
2529
+ *
2530
+ * ...
2531
+ *
2532
+ * // The path is no longer needed
2533
+ * mapView.Paths.remove(path);
2534
+ * ```
2535
+ *
2536
+ * @param path The {@link Path} instance to be removed.
2537
+ */
2538
+ remove(path: Path): void;
2539
+ /**
2540
+ * Remove all {@link Path} instances from all maps.
2541
+ */
2542
+ removeAll(): void;
2543
+ }
2544
+ }
2545
+
2546
+ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.SmartTooltip' {
2547
+ import './Mappedin.SmartTooltip.scss';
2548
+ import { HTMLCollider, COLLISION_RANKING_TIERS } from '@mappedin/mappedin-js/renderer/internal';
2549
+ import type { IHTMLCollider, TColliderStrategy } from '@mappedin/mappedin-js/renderer/internal';
2550
+ import { Vector3 } from 'three';
2551
+ /**
2552
+ *
2553
+ * A Tooltip is an html element that attempts to orient itself around an anchor in 3D space. It will always maintain the same size on the screen, but will attempt to change its orientation based on other colliders in the scene.
2554
+ *
2555
+ * Make your own and add it directly to the map with {{#crossLink "MapView/createTooltip:method"}}{{/crossLink}}, or use the constructor and add it when you want.
2556
+ *
2557
+ * You will need to specify at least `options.position` and one of `options.html` and `options.selector` OR `options.contentHtml`.
2558
+ *
2559
+ *
2560
+ * @class Tooltip
2561
+ *
2562
+ * @constructor
2563
+ * @param options {Object} Passes on options (e.g. html, text, position, map, padding, defaultAnchorType, enabledAnchorTypes, collisionRank) to MapView.Tooltip's options argument.
2564
+ * @param [options.html] Pass in custom html for your marker, if using this method you must also pass in a selector for your content.
2565
+ * @param [options.selector] Used in conjuction with the html property to select the div for repositioning
2566
+ * @param [options.contentHtml] Use mappedin's default tooltip styling with custom inner html content
2567
+ * @param [options.text] Instead of passing html pass in plain text to be displayed in the tooltip
2568
+ * @param [options.position] should be something you got from {{#crossLink "MapView/getPositionPolygon:method"}}{{/crossLink}} or {{#crossLink "MapView/getPositionNode:method"}}{{/crossLink}}.
2569
+ * @param [options.map] The map ID where the tooltip should be displayed
2570
+ * @param [options.defaultAnchorType] The default orientation to place the tooltip.
2571
+ * @param [options.padding] The distance in pixel to offset the tooltip from the anchor point.
2572
+ * @param [options.enabledAnchorTypes] An object used to disable certain anchor positions from being used.
2573
+ * @param [options.collisionRank] The rank of the object used when comparing colliders to determine which should be shown.
2574
+ */
2575
+ export type TSmartTooltipOptions = {
2576
+ html?: string;
2577
+ contentHtml?: string;
2578
+ text?: string;
2579
+ position: Vector3;
2580
+ selector?: string;
2581
+ map: string;
2582
+ padding?: number;
2583
+ collisionRank?: COLLISION_RANKING_TIERS;
2584
+ defaultAnchorType?: string;
2585
+ enabledAnchorTypes?: {
2586
+ [type: string]: boolean;
2587
+ };
2588
+ };
2589
+ type TTooltipStyle = {
2590
+ top?: string;
2591
+ left?: string;
2592
+ };
2593
+ /**
2594
+ * An object that defines which anchors are enabled for a tooltip. An anchor is a direction, relative
2595
+ * to a position, where a tooltip may appear. For example, a tooltip with a `right` anchor will appear
2596
+ * to the right of its position.
1999
2597
  */
2000
- export class Paths {
2598
+ export type TOOLTIP_ANCHOR = {
2599
+ top?: boolean;
2600
+ left?: boolean;
2601
+ topLeft?: boolean;
2602
+ right?: boolean;
2603
+ topRight?: boolean;
2604
+ bottom?: boolean;
2605
+ bottomLeft?: boolean;
2606
+ bottomRight?: boolean;
2607
+ };
2608
+ class SmartTooltip extends HTMLCollider implements IHTMLCollider {
2001
2609
  #private;
2002
- constructor(pathsController: PathsController);
2003
- /**
2004
- * An array of all paths that are currently drawn.
2005
- */
2006
- get paths(): Path[];
2007
- /**
2008
- * Takes an array of nodes and draws path segments on each map for the nodes on that map.
2009
- *
2010
- * @param nodes A {@link MappedinNode} array, probably from a {@link MappedinDirections} instance.
2011
- * @param options A optional {@link TPathOptions} object.
2012
- */
2013
- add(nodes: MappedinNode[], options?: TPathOptions): Path;
2014
- /**
2015
- * Remove a path from all maps it exists on.
2016
- *
2017
- * @param path A {@link Path} instance returned from {@link Paths.add}.
2018
- */
2019
- remove(path: Path): void;
2610
+ className: string;
2611
+ _el: Element | null;
2612
+ style: TTooltipStyle;
2613
+ constructor(options: TSmartTooltipOptions);
2614
+ updateClassName: (className: any) => void;
2615
+ get strategies(): TColliderStrategy[];
2616
+ colliderDidMount(): void;
2020
2617
  /**
2021
- * Remove all paths from all maps.
2618
+ * @internal
2022
2619
  */
2023
- removeAll(): void;
2620
+ updateDimensionsImmediately(): void;
2621
+ setAction(action: any): void;
2622
+ colliderDidNotFindAHome(): void;
2623
+ colliderDidGoOffscreen(): void;
2624
+ colliderDidUpdateVisiblity(): void;
2024
2625
  }
2626
+ export default SmartTooltip;
2025
2627
  }
2026
2628
 
2027
2629
  declare module '@mappedin/mappedin-js/renderer/MapView.enums' {
@@ -2107,6 +2709,9 @@ declare module '@mappedin/mappedin-js/renderer/MapView.enums' {
2107
2709
  */
2108
2710
  UNCERTAIN = 3
2109
2711
  }
2712
+ /**
2713
+ * @enum The state of the {@link MapView}.
2714
+ */
2110
2715
  export enum STATE {
2111
2716
  /**
2112
2717
  * The map is in exploration mode where the user controls the camera position.
@@ -2148,6 +2753,9 @@ declare module '@mappedin/mappedin-js/renderer/MapView.enums' {
2148
2753
  */
2149
2754
  MAP_CHANGED = "MAP_CHANGED"
2150
2755
  }
2756
+ /**
2757
+ * @enum
2758
+ */
2151
2759
  export enum E_BLUEDOT_EVENT {
2152
2760
  /**
2153
2761
  * Emitted when the BlueDot position changes
@@ -2238,6 +2846,10 @@ declare module '@mappedin/mappedin-js/renderer/internal/outdoor-context/Mappedin
2238
2846
  export type TTileManagerOptions = {
2239
2847
  tileRenderMode?: TILE_RENDER_MODES;
2240
2848
  provider: IOutdoorContextProvider;
2849
+ /**
2850
+ * How many times bigger the bounding box should be than the map's longest side
2851
+ */
2852
+ boundingBoxMultiplier?: number;
2241
2853
  };
2242
2854
  export class TileManager {
2243
2855
  #private;
@@ -2255,6 +2867,9 @@ declare module '@mappedin/mappedin-js/renderer/internal/outdoor-context/Mappedin
2255
2867
  renderVisibleTiles: () => void;
2256
2868
  _renderVisibleTiles(): void;
2257
2869
  cachedZoomLevel: number;
2870
+ visible: boolean;
2871
+ fadeOut(): Promise<any>;
2872
+ fadeIn(): Promise<any>;
2258
2873
  fetchTiles(): void;
2259
2874
  zoomLevelToAltitudeMap: number[][];
2260
2875
  plane: Object3D;
@@ -2477,84 +3092,6 @@ declare module '@mappedin/mappedin-js/renderer/bundle-asset-manager' {
2477
3092
  }
2478
3093
  }
2479
3094
 
2480
- declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.SmartTooltip' {
2481
- import './Mappedin.SmartTooltip.scss';
2482
- import { HTMLCollider, COLLISION_RANKING_TIERS } from '@mappedin/mappedin-js/renderer/internal';
2483
- import type { IHTMLCollider, TColliderStrategy } from '@mappedin/mappedin-js/renderer/internal';
2484
- import { Vector3 } from 'three';
2485
- /**
2486
- *
2487
- * A Tooltip is an html element that attempts to orient itself around an anchor in 3D space. It will always maintain the same size on the screen, but will attempt to change its orientation based on other colliders in the scene.
2488
- *
2489
- * Make your own and add it directly to the map with {{#crossLink "MapView/createTooltip:method"}}{{/crossLink}}, or use the constructor and add it when you want.
2490
- *
2491
- * You will need to specify at least `options.position` and one of `options.html` and `options.selector` OR `options.contentHtml`.
2492
- *
2493
- *
2494
- * @class Tooltip
2495
- *
2496
- * @constructor
2497
- * @param options {Object} Passes on options (e.g. html, text, position, map, padding, defaultAnchorType, enabledAnchorTypes, collisionRank) to MapView.Tooltip's options argument.
2498
- * @param [options.html] Pass in custom html for your marker, if using this method you must also pass in a selector for your content.
2499
- * @param [options.selector] Used in conjuction with the html property to select the div for repositioning
2500
- * @param [options.contentHtml] Use mappedin's default tooltip styling with custom inner html content
2501
- * @param [options.text] Instead of passing html pass in plain text to be displayed in the tooltip
2502
- * @param [options.position] should be something you got from {{#crossLink "MapView/getPositionPolygon:method"}}{{/crossLink}} or {{#crossLink "MapView/getPositionNode:method"}}{{/crossLink}}.
2503
- * @param [options.map] The map ID where the tooltip should be displayed
2504
- * @param [options.defaultAnchorType] The default orientation to place the tooltip.
2505
- * @param [options.padding] The distance in pixel to offset the tooltip from the anchor point.
2506
- * @param [options.enabledAnchorTypes] An object used to disable certain anchor positions from being used.
2507
- * @param [options.collisionRank] The rank of the object used when comparing colliders to determine which should be shown.
2508
- */
2509
- export type TSmartTooltipOptions = {
2510
- html?: string;
2511
- contentHtml?: string;
2512
- text?: string;
2513
- position: Vector3;
2514
- selector?: string;
2515
- map: string;
2516
- padding?: number;
2517
- collisionRank?: COLLISION_RANKING_TIERS;
2518
- defaultAnchorType?: string;
2519
- enabledAnchorTypes?: {
2520
- [type: string]: boolean;
2521
- };
2522
- };
2523
- type TTooltipStyle = {
2524
- top?: string;
2525
- left?: string;
2526
- };
2527
- export type TOOLTIP_ANCHOR = {
2528
- top?: boolean;
2529
- left?: boolean;
2530
- topLeft?: boolean;
2531
- right?: boolean;
2532
- topRight?: boolean;
2533
- bottom?: boolean;
2534
- bottomLeft?: boolean;
2535
- bottomRight?: boolean;
2536
- };
2537
- class SmartTooltip extends HTMLCollider implements IHTMLCollider {
2538
- #private;
2539
- className: string;
2540
- _el: Element | null;
2541
- style: TTooltipStyle;
2542
- constructor(options: TSmartTooltipOptions);
2543
- updateClassName: (className: any) => void;
2544
- get strategies(): TColliderStrategy[];
2545
- colliderDidMount(): void;
2546
- /**
2547
- * @internal
2548
- */
2549
- updateDimensionsImmediately(): void;
2550
- setAction(action: any): void;
2551
- colliderDidNotFindAHome(): void;
2552
- colliderDidGoOffscreen(): void;
2553
- colliderDidUpdateVisiblity(): void;
2554
- }
2555
- export default SmartTooltip;
2556
- }
2557
-
2558
3095
  declare module '@mappedin/mappedin-js/renderer/internal/pub-sub.typed' {
2559
3096
  export class PubSub<EVENT_PAYLOAD, EVENT extends keyof EVENT_PAYLOAD> {
2560
3097
  /**
@@ -2582,6 +3119,9 @@ declare module '@mappedin/mappedin-js/renderer/public/api/Journey' {
2582
3119
  import { JourneyController } from '@mappedin/mappedin-js/renderer/private/controllers/JourneyController';
2583
3120
  import { Path } from '@mappedin/mappedin-js/renderer/private/controllers/PathsController';
2584
3121
  import { ICore } from '@mappedin/mappedin-js/renderer/private/Core.interface';
3122
+ /**
3123
+ * API to control drawing a set of directions. See also {@link Paths}.
3124
+ */
2585
3125
  class Journey {
2586
3126
  #private;
2587
3127
  /**
@@ -2591,27 +3131,80 @@ declare module '@mappedin/mappedin-js/renderer/public/api/Journey' {
2591
3131
  /**
2592
3132
  * Draw a Journey based on directions. Example usage:
2593
3133
  *
2594
- * ```typescript
2595
- * const startLocation = venue.locations.find(location => location.name === "Cleo");
2596
- * const endLocation = venue.locations.find(location => location.name === "American Eagle");
3134
+ * ```ts
3135
+ * const startLocation = mapView.venue.locations.find(location => location.name === "Cleo");
3136
+ * const endLocation = mapView.venue.locations.find(location => location.name === "American Eagle");
2597
3137
  *
2598
3138
  * const directions = startLocation.directionsTo(endLocation);
2599
3139
  * mapView.Journey.draw(directions);
2600
3140
  * ```
2601
3141
  *
2602
- * Use options to set connection (such as elevators and escalators) HTML tooltip template, departure and destination marker templates, path style and polygon higlight color. If no options are set, sane defaults are used to draw markers, tooltips and polygon highlights.
3142
+ * Use options to set connection (such as elevators and escalators) HTML tooltip template,
3143
+ * departure and destination marker templates, path style and polygon higlight color. If
3144
+ * no options are set, sane defaults are used to draw markers, tooltips and polygon highlights.
3145
+ *
3146
+ * @param directions A single instance or an array of {@link MappedinDirections} used for the Journey.
3147
+ * @param options
2603
3148
  */
2604
3149
  draw(directions: MappedinDirections | MappedinDirections[], options?: TJourneyOptions): JourneyController;
2605
3150
  /**
2606
- * Set the step of a multipart Journey
3151
+ * Set the step of a multipart Journey. Requires {@link draw} to have been called with an array
3152
+ * of {@link MappedinDirections}. An active step receives different styling.
3153
+ *
3154
+ * ```ts
3155
+ * // A multi destination set of directions
3156
+ * const departure = mapView.venue.locations.find((l) => l.name === "Apple")!;
3157
+ * const destination1 = mapView.venue.locations.find((l) => l.name === "Cleo")!;
3158
+ * const destination2 = mapView.venue.locations.find((l) => l.name === "KFC")!;
3159
+ * const destinationSet = new MappedinDestinationSet([destination1, destination2]);
3160
+ * const directions = departure.directionsTo(destinationSet);
3161
+ *
3162
+ * // By default step 0 is active, meaning Apple to Cleo
3163
+ * mapView.Journey.draw(directions);
3164
+ *
3165
+ * // Activate the step of the Journey from Cleo to KFC
3166
+ * mapView.Journey.setStep(1);
3167
+ * ```
3168
+ *
3169
+ * @param step The step of the Journey to mark as active.
2607
3170
  */
2608
3171
  setStep(step: number): void;
2609
3172
  /**
2610
- * Set the step using a Path object
3173
+ * Set the step using a {@link Path} instance. Requires {@link draw} to have been called with an array
3174
+ * of {@link MappedinDirections}. An active step receives different styling. This is most commonly
3175
+ * used to activate a step when a path has been clicked.
3176
+ *
3177
+ * ```ts
3178
+ * // A multi destination set of directions
3179
+ * const departure = mapView.venue.locations.find((l) => l.name === "Apple")!;
3180
+ * const destination1 = mapView.venue.locations.find((l) => l.name === "Cleo")!;
3181
+ * const destination2 = mapView.venue.locations.find((l) => l.name === "KFC")!;
3182
+ * const destinationSet = new MappedinDestinationSet([destination1, destination2]);
3183
+ * const directions = departure.directionsTo(destinationSet);
3184
+ *
3185
+ * // Make sure that the paths are all interactive
3186
+ * mapView.Journey.draw(directions, {
3187
+ * pathOptions: { interactive: true },
3188
+ * inactivePathOptions: { interactive: true },
3189
+ * });
3190
+ *
3191
+ * // Listen for a path being clicked
3192
+ * mapView.on(E_SDK_EVENT.CLICK, ({ path }) => {
3193
+ * if (path != null) {
3194
+ * mapView.Journey.setStepByPath(path);
3195
+ * }
3196
+ * });
3197
+ * ```
3198
+ *
3199
+ * @param path A {@link Path} instance that corresponds to a step in the Journey.
2611
3200
  */
2612
3201
  setStepByPath(path: Path): void;
2613
3202
  /**
2614
- * Clear the current Journey
3203
+ * Clear the current Journey drawn by {@link draw}.
3204
+ *
3205
+ * ```ts
3206
+ * mapView.Journey.clear();
3207
+ * ```
2615
3208
  */
2616
3209
  clear(): void;
2617
3210
  }
@@ -2638,6 +3231,7 @@ declare module '@mappedin/mappedin-js/renderer' {
2638
3231
  export type { BlueDot } from '@mappedin/mappedin-js/renderer/public/api/BlueDot';
2639
3232
  export type { Markers } from '@mappedin/mappedin-js/renderer/public/api/Markers';
2640
3233
  export type { Paths } from '@mappedin/mappedin-js/renderer/public/api/Paths';
3234
+ export type { TOOLTIP_ANCHOR } from '@mappedin/mappedin-js/renderer/internal/Mappedin.SmartTooltip';
2641
3235
  export type TMappedinInitializeOutput = {
2642
3236
  mapView: MapView;
2643
3237
  venue: Mappedin;
@@ -2732,6 +3326,7 @@ declare module '@mappedin/mappedin-js/get-venue/Mappedin.types' {
2732
3326
  useDraftData?: boolean;
2733
3327
  platformString?: string;
2734
3328
  emitAnalyticsEvents?: boolean;
3329
+ secure?: boolean;
2735
3330
  };
2736
3331
  export type TGetVenueOptionsInternal = {
2737
3332
  baseUrl?: string;
@@ -2743,6 +3338,13 @@ declare module '@mappedin/mappedin-js/get-venue/Mappedin.types' {
2743
3338
  things?: any;
2744
3339
  headers?: any;
2745
3340
  };
3341
+ export type TVenueMetadata = {
3342
+ languages: {
3343
+ name: string;
3344
+ code: string;
3345
+ }[];
3346
+ hasSecureAssets: boolean;
3347
+ };
2746
3348
  export enum MAP_RENDER_MODE {
2747
3349
  /** Each polygon, its geometry and mesh are sent to the GPU every render frame.
2748
3350
  * This was the default rendering mode before 4.0.17
@@ -2757,7 +3359,6 @@ declare module '@mappedin/mappedin-js/get-venue/Mappedin.types' {
2757
3359
 
2758
3360
  declare module '@mappedin/mappedin-js/get-venue/Mappedin' {
2759
3361
  import { Navigator } from '@mappedin/mappedin-js/navigator';
2760
- import { MVFData } from '@mappedin/mappedin-js/get-venue/Mappedin.MVF.types';
2761
3362
  import type { TGetVenueOptions, TGetVenueOptionsInternal } from '@mappedin/mappedin-js/get-venue/Mappedin.types';
2762
3363
  import { MappedinCategory } from '@mappedin/mappedin-js/get-venue/MappedinCategory';
2763
3364
  import { MappedinEvent } from '@mappedin/mappedin-js/get-venue/MappedinEvent';
@@ -2773,6 +3374,7 @@ declare module '@mappedin/mappedin-js/get-venue/Mappedin' {
2773
3374
  import { MappedinVenue } from '@mappedin/mappedin-js/get-venue/MappedinVenue';
2774
3375
  import { MappedinVortex } from '@mappedin/mappedin-js/get-venue/MappedinVortex';
2775
3376
  import { IAnalytics } from '@mappedin/mappedin-js/get-venue/Mappedin.CustomerAnalytics';
3377
+ import { ParsedMVF } from '@mappedin/mvf';
2776
3378
  export const defaultOptions: TGetVenueOptionsInternal & TGetVenueOptions;
2777
3379
  export enum MappedinCollectionType {
2778
3380
  CATEGORY = "categories",
@@ -3008,7 +3610,7 @@ declare module '@mappedin/mappedin-js/get-venue/Mappedin' {
3008
3610
  * @hidden
3009
3611
  * @internal
3010
3612
  */
3011
- hydrateFromMVF(mvfData: MVFData): Promise<undefined>;
3613
+ hydrateFromMVF(mvfData: ParsedMVF): Promise<undefined>;
3012
3614
  /**
3013
3615
  *
3014
3616
  * @experimental Hydrate the Mappedin instance using a response from either {@link Mappedin.toString}, {@link getVenueBundle} or by downloading the bundle manually
@@ -3631,6 +4233,11 @@ declare module '@mappedin/mappedin-js/get-venue/MappedinVenue' {
3631
4233
  tzidOverride: string;
3632
4234
  utcOffset: string;
3633
4235
  website: string;
4236
+ secureContentStorage: boolean;
4237
+ languages: {
4238
+ name: string;
4239
+ code: string;
4240
+ }[];
3634
4241
  constructor(mappedin: Mappedin, data: any);
3635
4242
  get metadata(): any;
3636
4243
  set metadata(value: any);
@@ -4460,12 +5067,13 @@ declare module '@mappedin/mappedin-js/renderer/internal' {
4460
5067
  export { labelThemes } from '@mappedin/mappedin-js/renderer/MapView.types';
4461
5068
  export { GEOLOCATION_STATUS, COLLISION_RANKING_TIERS, E_BLUEDOT_STATE_REASON, E_BLUEDOT_STATE, E_BLUEDOT_MARKER_STATE, STATE, MARKER_ANCHOR, E_SDK_EVENT, E_BLUEDOT_EVENT, E_CAMERA_EVENT, E_CAMERA_DIRECTION, SAFE_AREA_INSET_TYPE, CAMERA_EASING_MODE, MAP_RENDER_MODE, ANIMATION_TWEENS, } from '@mappedin/mappedin-js/renderer/MapView.enums';
4462
5069
  export { default as RENDER } from '@mappedin/mappedin-js/renderer/internal/Mappedin.RenderTasks';
4463
- export { FrameUpdate, TaskScheduler } from '@mappedin/mappedin-js/get-venue/Mappedin.TaskScheduler';
5070
+ export { FrameUpdate, FrameTask, TaskScheduler } from '@mappedin/mappedin-js/get-venue/Mappedin.TaskScheduler';
4464
5071
  export { default as SceneManager } from '@mappedin/mappedin-js/renderer/MapView.SceneManager';
4465
5072
  export { PubSub } from '@mappedin/mappedin-js/renderer/internal/pub-sub.typed';
4466
5073
  export { default as MapObject } from '@mappedin/mappedin-js/renderer/internal/Mappedin.MapObject';
4467
5074
  export { default as CAMERA_LAYER } from '@mappedin/mappedin-js/renderer/internal/Mappedin.CameraLayers';
4468
5075
  export { default as AssetManager } from '@mappedin/mappedin-js/renderer/internal/Mappedin.AssetManager';
5076
+ export { BundleAssetManager } from '@mappedin/mappedin-js/renderer/bundle-asset-manager';
4469
5077
  /**
4470
5078
  * Internal Events and Payloads
4471
5079
  */
@@ -4475,8 +5083,8 @@ declare module '@mappedin/mappedin-js/renderer/internal' {
4475
5083
  RENDER = 2,
4476
5084
  RENDER_NOW = 3,
4477
5085
  UPDATE_FLIPPABLES = 4,
4478
- SET_MAP_START = 5,
4479
- SET_MAP = 6,
5086
+ SET_SCENE_START = 5,
5087
+ SET_SCENE = 6,
4480
5088
  CAMERA_MOVING = 7,
4481
5089
  SET_BLUE_DOT_SIZE_FROM_ZOOM = 8,
4482
5090
  PUBLISH_BLUE_DOT = 9,
@@ -4499,13 +5107,13 @@ declare module '@mappedin/mappedin-js/renderer/internal' {
4499
5107
  USER_HANDS_OFF = 26
4500
5108
  }
4501
5109
  export type INTERNAL_EVENT_PAYLOAD = {
4502
- [INTERNAL_EVENT.SET_MAP_START]: undefined;
5110
+ [INTERNAL_EVENT.SET_SCENE_START]: undefined;
4503
5111
  [INTERNAL_EVENT.ON_FIRST_MAP_LOADED]: undefined;
4504
5112
  [INTERNAL_EVENT.TEXTURE_LOADED]: Texture;
4505
5113
  [INTERNAL_EVENT.RENDER]: undefined;
4506
5114
  [INTERNAL_EVENT.RENDER_NOW]: undefined;
4507
5115
  [INTERNAL_EVENT.UPDATE_FLIPPABLES]: undefined | boolean;
4508
- [INTERNAL_EVENT.SET_MAP]: undefined;
5116
+ [INTERNAL_EVENT.SET_SCENE]: undefined;
4509
5117
  [INTERNAL_EVENT.CAMERA_MOVING]: any;
4510
5118
  [INTERNAL_EVENT.SET_BLUE_DOT_SIZE_FROM_ZOOM]: number;
4511
5119
  [INTERNAL_EVENT.PUBLISH_BLUE_DOT]: undefined;
@@ -4622,6 +5230,9 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.FloatingLabel'
4622
5230
  getCachedSymbol: (orientation: string, textAlign: TEXTALIGN, xCoordinate: number) => HTMLCanvasElement | OffscreenCanvas;
4623
5231
  draw: (context: CanvasRenderingContext2D) => void;
4624
5232
  }
5233
+ /**
5234
+ * Control how a floating label looks
5235
+ */
4625
5236
  export type TFloatingLabelAppearance = {
4626
5237
  /**
4627
5238
  * Margin around the label and marker. This will affect label density, with a mininum of 7px around
@@ -4967,7 +5578,7 @@ declare module '@mappedin/mappedin-js/navigator/Directive' {
4967
5578
  }
4968
5579
 
4969
5580
  declare module '@mappedin/mappedin-js/renderer/private/controllers/FlatLabelsController' {
4970
- import type { TAddFlatLabelOptions, TFlatLabelAllLocationsOptions, TFlatLabelAppearance, ICore } from '@mappedin/mappedin-js/renderer/internal';
5581
+ import { TAddFlatLabelOptions, TFlatLabelAllLocationsOptions, TFlatLabelAppearance, ICore } from '@mappedin/mappedin-js/renderer/internal';
4971
5582
  import { FlatLabel } from '@mappedin/mappedin-js/renderer/internal';
4972
5583
  import { MappedinPolygon } from '@mappedin/mappedin-js/get-venue';
4973
5584
  export type FlatLabelRenderObject = TAddFlatLabelOptions & {
@@ -5281,6 +5892,7 @@ declare module '@mappedin/mappedin-js/renderer/private/Core.interface' {
5281
5892
  cameraParameters: Vector2;
5282
5893
  resolution: Vector2;
5283
5894
  determineNewLabelSize: any;
5895
+ visibleMapsInCurrentScene: MappedinMap[];
5284
5896
  on<EVENT_NAME extends keyof INTERNAL_EVENT_PAYLOAD>(eventName: EVENT_NAME, fn: (payload: INTERNAL_EVENT_PAYLOAD[EVENT_NAME] extends {
5285
5897
  data: null;
5286
5898
  } ? INTERNAL_EVENT_PAYLOAD[EVENT_NAME]['data'] : INTERNAL_EVENT_PAYLOAD[EVENT_NAME]) => void): void;
@@ -5429,26 +6041,6 @@ declare module '@mappedin/mappedin-js/renderer/private/Core.interface' {
5429
6041
  }
5430
6042
  }
5431
6043
 
5432
- declare module '@mappedin/mappedin-js/get-venue/Mappedin.MVF.types' {
5433
- import { ManifestCollection, NodeCollection, ObstructionCollection, SpaceCollection, Connections, Maps, EntranceCollection, MapStacks, StyleCollection } from '@mappedin/mvf';
5434
- export type WithIDs<T> = Map<string, T>;
5435
- /**
5436
- * The entire data collection for an MVF, in a single JSON collection.
5437
- *
5438
- */
5439
- export type MVFData = {
5440
- obstruction: WithIDs<ObstructionCollection>;
5441
- space: WithIDs<SpaceCollection>;
5442
- node: WithIDs<NodeCollection>;
5443
- entrance: WithIDs<EntranceCollection>;
5444
- connection: Connections;
5445
- map: Maps;
5446
- mapstack: MapStacks;
5447
- manifest: ManifestCollection;
5448
- style: StyleCollection;
5449
- };
5450
- }
5451
-
5452
6044
  declare module '@mappedin/mappedin-js/get-venue/MappedinLocationRankings' {
5453
6045
  import type { Mappedin } from '@mappedin/mappedin-js/get-venue/Mappedin';
5454
6046
  import type { TLocation } from '@mappedin/mappedin-js/get-venue/Mappedin.API.types';
@@ -5602,12 +6194,12 @@ declare module '@mappedin/mappedin-js/get-venue/Mappedin.TaskScheduler' {
5602
6194
  * Arbitrary data that you can store along with this task.
5603
6195
  */
5604
6196
  constructor(options: {
5605
- userdata: Record<string, any>;
5606
- priority: number;
6197
+ userdata?: Record<string, any>;
6198
+ priority?: number;
5607
6199
  group?: FrameTaskGroup;
5608
- postponeOnAdd: number | boolean;
6200
+ postponeOnAdd?: number | boolean;
5609
6201
  name: string;
5610
- lastFrameTime: number;
6202
+ lastFrameTime?: number;
5611
6203
  callback: (...args: any[]) => any;
5612
6204
  });
5613
6205
  _postponed: number | boolean;
@@ -6041,8 +6633,8 @@ declare module '@mappedin/mappedin-js/get-venue/Mappedin.TaskScheduler' {
6041
6633
 
6042
6634
  declare module '@mappedin/mappedin-js/renderer/MapView.SceneManager' {
6043
6635
  import { MappedinMap } from '@mappedin/mappedin-js/get-venue';
6044
- import type { ICore, TCameraTransform, TCameraAnimationOptions } from '@mappedin/mappedin-js/renderer/internal';
6045
- import { MapViewScene } from '@mappedin/mappedin-js/renderer/internal';
6636
+ import type { ICore, TCameraAnimationOptions, TFocusOnCameraOptions, TCameraTargets } from '@mappedin/mappedin-js/renderer/internal';
6637
+ import { MapObject, MapViewScene } from '@mappedin/mappedin-js/renderer/internal';
6046
6638
  export type TSceneTransitionOptions = {
6047
6639
  /**
6048
6640
  * Map to set as active during the transition. This will decide where the camera will be positioned, as well as which
@@ -6050,11 +6642,6 @@ declare module '@mappedin/mappedin-js/renderer/MapView.SceneManager' {
6050
6642
  */
6051
6643
  activeMap?: MappedinMap;
6052
6644
  verticalDistanceBetweenMaps?: number;
6053
- /**
6054
- * Camera options to use when transitioning to the new scene
6055
- */
6056
- cameraTransform?: TCameraTransform;
6057
- cameraAnimationOptions?: TCameraAnimationOptions;
6058
6645
  /**
6059
6646
  * Whether to auto focus on the active map or leave the camera where it is.
6060
6647
  * For single building venues, this should look the same way it did with MapManager
@@ -6063,10 +6650,22 @@ declare module '@mappedin/mappedin-js/renderer/MapView.SceneManager' {
6063
6650
  * @default true
6064
6651
  */
6065
6652
  autoFocusOnActiveMap?: boolean;
6653
+ /**
6654
+ * Where to focus the camera during transition to Scene. Will focus to fit the map if not provided.
6655
+ * Currently, will discard any targets that are not on the active map.
6656
+ */
6657
+ focusOn?: {
6658
+ targets?: TCameraTargets;
6659
+ options?: TFocusOnCameraOptions & TCameraAnimationOptions;
6660
+ };
6066
6661
  };
6067
6662
  class SceneManager {
6068
6663
  #private;
6069
6664
  currentScene: MapViewScene;
6665
+ /**
6666
+ * MapObjects that have been loaded and positioned in the scene
6667
+ */
6668
+ processedMapObjects: Set<MapObject>;
6070
6669
  constructor(core: ICore, startingScene: MapViewScene);
6071
6670
  get currentMap(): MappedinMap;
6072
6671
  renderGrid(): void;
@@ -6115,6 +6714,7 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.MapObject' {
6115
6714
  _loaderPromise: null;
6116
6715
  _promiseResolve: null;
6117
6716
  hoverableMeshChildren: any[];
6717
+ visible: boolean;
6118
6718
  objectsDictionary: {};
6119
6719
  north: null;
6120
6720
  mapScale: null;
@@ -6122,6 +6722,7 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.MapObject' {
6122
6722
  labels: Set<any>;
6123
6723
  tooltips: Set<any>;
6124
6724
  markers: Set<any>;
6725
+ box: any;
6125
6726
  textObjects: any[];
6126
6727
  labelBatchCreator: null;
6127
6728
  imagesToFlip: any[];
@@ -6145,6 +6746,45 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.MapObject' {
6145
6746
  _objLoaded(object: any): any;
6146
6747
  _objLoadedMerged(object: any): Promise<any>;
6147
6748
  enableImageFlipping(polygonId: any, rotation: any): void;
6749
+ fadeIn({ duration, delay, easing, onStart, onUpdate, onComplete, }: {
6750
+ duration?: number | undefined;
6751
+ delay?: number | undefined;
6752
+ easing?: any;
6753
+ onStart?: (() => void) | undefined;
6754
+ onUpdate?: (() => void) | undefined;
6755
+ onComplete?: (() => void) | undefined;
6756
+ }): {
6757
+ start(core: any): Promise<any>;
6758
+ }[];
6759
+ fadeOut({ duration, delay, easing, onStart, onUpdate, onComplete, }: {
6760
+ duration?: number | undefined;
6761
+ delay?: number | undefined;
6762
+ easing?: any;
6763
+ onStart?: (() => void) | undefined;
6764
+ onUpdate?: (() => void) | undefined;
6765
+ onComplete?: (() => void) | undefined;
6766
+ }): {
6767
+ start(core: any): Promise<any>;
6768
+ }[];
6769
+ fade({ direction, duration, delay, easing, onStart, onUpdate, onComplete, }: {
6770
+ direction?: string | undefined;
6771
+ duration?: number | undefined;
6772
+ delay?: number | undefined;
6773
+ easing?: any;
6774
+ onStart?: (() => void) | undefined;
6775
+ onUpdate?: (() => void) | undefined;
6776
+ onComplete?: (() => void) | undefined;
6777
+ }): {
6778
+ start(core: any): Promise<any>;
6779
+ }[];
6780
+ /**
6781
+ * Sets the opacity of all children (for now) of the map object
6782
+ */
6783
+ setIndoorGeometryOpacity(opacity: any): void;
6784
+ /**
6785
+ * Resets the transparent and opacity values of all children (for now) of the map object
6786
+ */
6787
+ resetIndoorGeometryOpacity(): void;
6148
6788
  elements: any;
6149
6789
  boundingBox: {
6150
6790
  min: any;
@@ -6185,7 +6825,6 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.MapObject' {
6185
6825
  getMapScale(): null;
6186
6826
  getNorth(): null;
6187
6827
  disableAllImageFlipping(): void;
6188
- get visible(): boolean;
6189
6828
  /**
6190
6829
  * Return true if this map has been loaded to the point where it can be
6191
6830
  * manipulated as a complete object. In synchronous mode, this requires all
@@ -7076,32 +7715,48 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.HTMLCollider' {
7076
7715
 
7077
7716
  declare module '@mappedin/mappedin-js/renderer/MapView.Scene' {
7078
7717
  import { MappedinMap } from '@mappedin/mappedin-js/get-venue';
7079
- import type { ICore, TSceneTransitionOptions } from '@mappedin/mappedin-js/renderer/internal';
7080
- import { MapObject } from '@mappedin/mappedin-js/renderer/internal';
7081
- export function getPanBoundsForObject(mapObject: MapObject, currentPanBounds: any): {
7082
- min: any;
7083
- max: any;
7084
- margin: any;
7085
- radius: any;
7086
- center: any;
7087
- };
7718
+ import type { ICore, SceneManager, TSceneTransitionOptions } from '@mappedin/mappedin-js/renderer/internal';
7719
+ import { MapObject, CAMERA_EASING_MODE } from '@mappedin/mappedin-js/renderer/internal';
7720
+ export const AUTO_FOCUS_DURATION = 500;
7721
+ export const AUTO_FOCUS_EASING = CAMERA_EASING_MODE.EASE_OUT;
7722
+ export const STARTING_TILT = 0.6;
7723
+ export const STARTING_ROTATION: undefined;
7088
7724
  class MapViewScene {
7089
- #private;
7090
- maps: MappedinMap[];
7091
- object: any;
7092
- currentMap: MappedinMap;
7093
- mapObjects: Map<MappedinMap['id'], MapObject>;
7094
- constructor(maps: MappedinMap[], core: ICore);
7095
- /**
7096
- * Determine each maps position and rotation relative to the refernce map
7097
- */
7098
- determineMapPositionAndRotation(map: MappedinMap): {
7099
- position: any[];
7100
- scale: number[];
7101
- rotation: number[];
7102
- };
7103
- /** Render scene */
7104
- render(map: MappedinMap, transitionOptions?: TSceneTransitionOptions, isStartingScene?: boolean): Promise<void>;
7725
+ #private;
7726
+ maps: MappedinMap[];
7727
+ mapObjectsArray: MapObject[];
7728
+ transitionOptions: TSceneTransitionOptions | undefined;
7729
+ object: any;
7730
+ verticalPaths: any;
7731
+ currentMap: MappedinMap;
7732
+ mapObjects: Map<MappedinMap['id'], MapObject>;
7733
+ constructor(maps: MappedinMap[], core: ICore);
7734
+ get mapObjectsByMapGroup(): {
7735
+ [x: string]: MapObject[];
7736
+ };
7737
+ /**
7738
+ * Determine each maps position and rotation relative to the refernce map
7739
+ */
7740
+ determineMapPositionAndRotation(map: MappedinMap): {
7741
+ position: any[];
7742
+ scale: number[];
7743
+ rotation: number[];
7744
+ };
7745
+ /**
7746
+ * Convenience function to initialize scene (for stacked maps)
7747
+ */
7748
+ prepare(sceneManager: SceneManager, transitionOptions?: TSceneTransitionOptions): Promise<void>;
7749
+ /**
7750
+ * Override this method if works need to be done when the window is resized
7751
+ */
7752
+ resize(): void;
7753
+ focusOnCurrentMap(transitionOptions?: TSceneTransitionOptions, isStartingScene?: boolean): Promise<unknown>;
7754
+ preRender(transitionOptions?: TSceneTransitionOptions): Promise<Promise<MapObject>[]>;
7755
+ /**
7756
+ * Override this method when unmounting a scene
7757
+ */
7758
+ unmount(): void;
7759
+ postRender(): void;
7105
7760
  }
7106
7761
  export default MapViewScene;
7107
7762
  }
@@ -7175,7 +7830,7 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.Element' {
7175
7830
  static imagesLoadingInProgress: Map<string, Promise<[any, any]>>;
7176
7831
  _addImage(polygon: MappedinPolygon, mapClass: MappedinMap): void;
7177
7832
  static _normalizeColor(color: any): number;
7178
- static _getMaterial(color: string, opacity: number): any;
7833
+ static _getMaterial(color: string, opacity: number, map: MappedinMap['id']): any;
7179
7834
  static _clip(vertices: any, offset: any): any;
7180
7835
  }
7181
7836
  export default Element;
@@ -7215,7 +7870,7 @@ declare module '@mappedin/mappedin-js/renderer/private/controllers/PolygonIntera
7215
7870
  }
7216
7871
 
7217
7872
  declare module '@mappedin/mappedin-js/renderer/private/controllers/TooltipsController' {
7218
- import type { ICore, TCreateTooltipCommonOptions, TCreateTooltipOptions } from '@mappedin/mappedin-js/renderer/internal';
7873
+ import { ICore, TCreateTooltipCommonOptions, TCreateTooltipOptions } from '@mappedin/mappedin-js/renderer/internal';
7219
7874
  import { MappedinNode, MappedinCoordinate } from '@mappedin/mappedin-js/get-venue';
7220
7875
  import { SmartTooltip } from '@mappedin/mappedin-js/renderer/internal';
7221
7876
  class TooltipsController {
@@ -7508,8 +8163,8 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.BinaryAssetMana
7508
8163
  declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.SmartCollisionEngine' {
7509
8164
  import './Mappedin.SmartCollisionEngine.scss';
7510
8165
  import { ICollider, TRange, TColliderPosition } from '@mappedin/mappedin-js/renderer/internal/Mappedin.SmartCollider';
7511
- import { MappedinMap } from '@mappedin/mappedin-js/renderer';
7512
- import { ICore } from '@mappedin/mappedin-js/renderer/private/Core.interface';
8166
+ import { MappedinMap } from '@mappedin/mappedin-js/get-venue';
8167
+ import type { ICore } from '@mappedin/mappedin-js/renderer/internal';
7513
8168
  import { Rectangle, QuadTree } from '@mappedin/mappedin-js/renderer/internal/quad-tree';
7514
8169
  export const COLLIDER_STRATEGY_LOW_PRIORITY = "LOW_PRIORITY";
7515
8170
  class SmartCollisionEngine {
@@ -8369,7 +9024,7 @@ let CameraControls = function (camera, canvas, scene, core) {
8369
9024
  *
8370
9025
  * @return {Mappedin.Tween} The tween being used, if you want to do anything to control it manually. Do not overide it's events.
8371
9026
  */
8372
- this.animateCamera = function (target, duration, curve, callback, options) {
9027
+ this.animateCamera = function (target, duration, curve, callback, cancelledCallback, options) {
8373
9028
  const _options = { mode: CAMERA_CONTROL_OPTIONS.cancel, ...options };
8374
9029
  let tweenStart = {};
8375
9030
  let tweenEnd = {};
@@ -8421,7 +9076,7 @@ let CameraControls = function (camera, canvas, scene, core) {
8421
9076
  }
8422
9077
  const zooming = tweenStart.zoom !== tweenEnd.zoom;
8423
9078
  const rotating = tweenStart.rotation !== tweenEnd.rotation;
8424
- const tilting = tweenStart.tilting !== tweenEnd.tilting;
9079
+ const tilting = tweenStart.tilt !== tweenEnd.tilt;
8425
9080
  var tween = new TWEEN.Tween(tweenStart)
8426
9081
  .to(tweenEnd, process.env.TESTING ? 0 : duration)
8427
9082
  .onUpdate(function (between) {
@@ -8473,6 +9128,9 @@ let CameraControls = function (camera, canvas, scene, core) {
8473
9128
  }
8474
9129
  else {
8475
9130
  completeTween(lastTween);
9131
+ if (typeof cancelledCallback === 'function') {
9132
+ cancelledCallback();
9133
+ }
8476
9134
  lastTween = null;
8477
9135
  }
8478
9136
  }
@@ -9199,7 +9857,7 @@ let CameraControls = function (camera, canvas, scene, core) {
9199
9857
  };
9200
9858
  export default CameraControls;
9201
9859
 
9202
- import { Color, DepthTexture, Mesh, Vector2, NearestFilter, OrthographicCamera, PlaneBufferGeometry, RGBAFormat, Scene, ShaderMaterial, UnsignedIntType, WebGLRenderTarget, WebGL1Renderer, WebGLRenderer, DepthStencilFormat, sRGBEncoding, } from 'three';
9860
+ import { Color, DepthTexture, Mesh, Vector2, NearestFilter, OrthographicCamera, PlaneBufferGeometry, RGBAFormat, Scene, ShaderMaterial, UnsignedIntType, WebGLRenderTarget, WebGL1Renderer, WebGLRenderer, sRGBEncoding, } from 'three';
9203
9861
  import { CAMERA_LAYER, RENDER } from '@mappedin/mappedin-js/renderer/internal';
9204
9862
  import CompositeVertexShader from '@mappedin/mappedin-js/renderer/internal/shaders/Mappedin.Composite.Vertex.glsl';
9205
9863
  import CompositeFragmentShader from '@mappedin/mappedin-js/renderer/internal/shaders/Mappedin.Composite.Fragment.glsl';
@@ -9232,6 +9890,8 @@ export default class Renderer {
9232
9890
  * The color that will be displayed behind the scene
9233
9891
  * @param [options.backgroundAlpha=1.0] {number}
9234
9892
  * The opacity of the background color
9893
+ * @param [options.xRayPath=true] {boolean}
9894
+ * If true, journey path will be visible through other objects
9235
9895
  * @param [options.onWebGLContextCreationError=null] {function}
9236
9896
  * A callback that will be triggered if WebGL context creation fails
9237
9897
  * @param [options.onWebGLContextLost=null] {function}
@@ -9244,9 +9904,6 @@ export default class Renderer {
9244
9904
  constructor(renderOptions) {
9245
9905
  renderOptions.multiBufferRendering = renderOptions.multiBufferRendering || false;
9246
9906
  this.contextLost = false;
9247
- this.implementation = renderOptions.multiBufferRendering
9248
- ? new MultiBufferRenderer(renderOptions)
9249
- : new SingleBufferRenderer(renderOptions);
9250
9907
  this.implementation = this.getRenderer(renderOptions);
9251
9908
  this.onWebGLContextCreationError = renderOptions.onWebGLContextCreationError;
9252
9909
  this.onWebGLContextLost = renderOptions.onWebGLContextLost;
@@ -9567,7 +10224,6 @@ class MultiBufferRenderer {
9567
10224
  try {
9568
10225
  const options = {
9569
10226
  alpha: renderOptions.alpha || false,
9570
- antialias: false,
9571
10227
  stencil: true,
9572
10228
  outputEncoding: sRGBEncoding,
9573
10229
  powerPreference: 'high-performance',
@@ -9580,9 +10236,14 @@ class MultiBufferRenderer {
9580
10236
  renderOptions.onWebGLRendererError(e);
9581
10237
  }
9582
10238
  }
10239
+ this.journeyOpacity = renderOptions.xRayPath ? 0.3 : 0.0;
9583
10240
  this.backgroundColor = new Color();
9584
10241
  this.backgroundAlpha = 1.0;
9585
10242
  this.mapboxOutdoorContext = null;
10243
+ // Antialiasing for WebGLRenderTargets is done through the samples option
10244
+ // Note: this only works for WebGL 2
10245
+ // TODO: For some reason this is breaking path opacity but since antialiasing only affects DPI 1 monitors, we'll just turn it off for multi-buffer
10246
+ const samples = 0; // renderOptions.antialias ? 4 : 0;
9586
10247
  // The render target (color and depth textures) that will be used to
9587
10248
  // store the static scene, to composite it with the animated scene.
9588
10249
  this.staticSceneRenderTarget = new WebGLRenderTarget(this.renderer.width, this.renderer.height);
@@ -9592,9 +10253,9 @@ class MultiBufferRenderer {
9592
10253
  this.staticSceneRenderTarget.texture.generateMipmaps = false;
9593
10254
  this.staticSceneRenderTarget.stencilBuffer = true;
9594
10255
  this.staticSceneRenderTarget.depthBuffer = true;
9595
- this.staticSceneRenderTarget.depthTexture = new DepthTexture();
10256
+ this.staticSceneRenderTarget.depthTexture = new DepthTexture(this.renderer.width, this.renderer.height);
9596
10257
  this.staticSceneRenderTarget.depthTexture.type = UnsignedIntType;
9597
- this.staticSceneRenderTarget.depthTexture.format = DepthStencilFormat;
10258
+ this.staticSceneRenderTarget.samples = samples;
9598
10259
  // The render target that will be used to store the dynamic scene,
9599
10260
  // re-rendered once per frame while animated elements exist in the
9600
10261
  // 3D scene (e.g., paths.)
@@ -9606,9 +10267,9 @@ class MultiBufferRenderer {
9606
10267
  this.animatedSceneRenderTarget.texture.generateMipmaps = false;
9607
10268
  this.animatedSceneRenderTarget.stencilBuffer = true;
9608
10269
  this.animatedSceneRenderTarget.depthBuffer = true;
9609
- this.animatedSceneRenderTarget.depthTexture = new DepthTexture();
10270
+ this.animatedSceneRenderTarget.depthTexture = new DepthTexture(this.renderer.width, this.renderer.height);
9610
10271
  this.animatedSceneRenderTarget.depthTexture.type = UnsignedIntType;
9611
- this.animatedSceneRenderTarget.depthTexture.format = DepthStencilFormat;
10272
+ this.animatedSceneRenderTarget.samples = samples;
9612
10273
  // The render target that will be used to store the scene whose elements
9613
10274
  // are always drawn on top of everything else. Rendering is done once per
9614
10275
  // frame while such elements exist in the 3D scene, just like the animated scene target.
@@ -9625,10 +10286,14 @@ class MultiBufferRenderer {
9625
10286
  this.alwaysOnTopSceneRenderTarget.texture.generateMipmaps = false;
9626
10287
  this.alwaysOnTopSceneRenderTarget.stencilBuffer = true;
9627
10288
  this.alwaysOnTopSceneRenderTarget.depthBuffer = true;
9628
- this.alwaysOnTopSceneRenderTarget.depthTexture = new DepthTexture();
10289
+ this.alwaysOnTopSceneRenderTarget.depthTexture = new DepthTexture(this.renderer.width, this.renderer.height);
9629
10290
  this.alwaysOnTopSceneRenderTarget.depthTexture.type = UnsignedIntType;
9630
- this.alwaysOnTopSceneRenderTarget.depthTexture.format = DepthStencilFormat;
10291
+ this.alwaysOnTopSceneRenderTarget.samples = samples;
9631
10292
  this.compositeUniforms = {
10293
+ animatedColorOpacity: {
10294
+ type: 'f',
10295
+ value: this.journeyOpacity,
10296
+ },
9632
10297
  staticSceneColorTexture: {
9633
10298
  type: 't',
9634
10299
  value: this.staticSceneRenderTarget.texture,
@@ -9943,6 +10608,18 @@ declare module '@mappedin/mappedin-js/renderer/internal/utils' {
9943
10608
  export function isObject(item: any): any;
9944
10609
  export function cyrb53(str: any, seed?: number): number;
9945
10610
  export function addMarginMultiplierToBoundingBox(bbox: any, multiplier: any): any;
10611
+ export function tweenPromise({ from, to, duration, easing, delay, onUpdate, onStart, onComplete, }: {
10612
+ from: any;
10613
+ to: any;
10614
+ duration?: number | undefined;
10615
+ easing?: any;
10616
+ delay?: number | undefined;
10617
+ onUpdate?: ((_: any) => void) | undefined;
10618
+ onStart?: (() => void) | undefined;
10619
+ onComplete?: (() => void) | undefined;
10620
+ }): {
10621
+ start(core: any): Promise<any>;
10622
+ };
9946
10623
  export function getPrimaryLocationForPolygon(polygon: any, venue: any): any;
9947
10624
  export function determineStartingMap(venue: any, options: any): any;
9948
10625
  }
@@ -10470,6 +11147,10 @@ declare module '@mappedin/mappedin-js/renderer/private/Core' {
10470
11147
  currentScale: number;
10471
11148
  rendererDomElement: HTMLCanvasElement;
10472
11149
  resolutionScale: number;
11150
+ /**
11151
+ * Get all maps that are "visible" in the scene.
11152
+ */
11153
+ get visibleMapsInCurrentScene(): any[];
10473
11154
  constructor(container: HTMLDivElement, venue: IMappedin, options: (TMapViewOptions & {
10474
11155
  onDataLoaded?: ((data: IMappedin) => void) | undefined;
10475
11156
  onFirstMapLoaded?: ((data: IMappedin) => void) | undefined;
@@ -10648,73 +11329,6 @@ declare module '@mappedin/mappedin-js/navigator/interfaces/ILocation' {
10648
11329
 
10649
11330
 
10650
11331
 
10651
- precision mediump float;
10652
-
10653
- uniform sampler2D textureLabel;
10654
-
10655
- varying vec2 vUV;
10656
- varying vec3 vColor;
10657
-
10658
- void main() {
10659
- gl_FragColor = texture2D(textureLabel, vUV);
10660
- gl_FragColor.rgb = vColor;
10661
- }
10662
-
10663
- attribute vec2 position;
10664
- attribute vec3 origin;
10665
- attribute vec2 size;
10666
- attribute float rotation;
10667
- attribute vec4 uv;
10668
- attribute vec3 color;
10669
-
10670
- uniform mat4 projectionMatrix;
10671
- uniform mat4 viewMatrix;
10672
- uniform mat4 modelMatrix;
10673
-
10674
- varying vec2 vUV;
10675
- varying vec3 vColor;
10676
-
10677
- void main() {
10678
- vec4 mapDirectionVector = vec4(0, 1, 0, 0) * viewMatrix * modelMatrix;
10679
- float mapDirection = atan(mapDirectionVector.y, mapDirectionVector.x);
10680
-
10681
- float cosRotation = cos(rotation);
10682
- float sinRotation = sin(rotation);
10683
-
10684
- mat4 rotationMatrix = mat4(
10685
- vec4(cosRotation, -sinRotation, 0.0, 0.0),
10686
- vec4(sinRotation, cosRotation, 0.0, 0.0),
10687
- vec4(0.0, 0.0, 1.0, 0.0),
10688
- vec4(0.0, 0.0, 0.0, 1.0)
10689
- );
10690
-
10691
- mat4 translate = mat4(
10692
- vec4(1, 0, 0, 0),
10693
- vec4(0, 1, 0, 0),
10694
- vec4(0, 0, 1, 0),
10695
- vec4(origin, 1)
10696
- );
10697
-
10698
- gl_Position = projectionMatrix *
10699
- viewMatrix *
10700
- modelMatrix *
10701
- translate *
10702
- rotationMatrix *
10703
- (vec4(position * size - vec2(0, size.y / 2.0), 0, 1));
10704
-
10705
-
10706
- vec2 uvStart = uv.xy;
10707
- vec2 uvSize = uv.zw;
10708
-
10709
- if (sin(mapDirection + rotation) > 0.0) {
10710
- vUV = position * uvSize + vec2(uvStart.x, uvStart.y - uvSize.y);
10711
- } else {
10712
- vUV = (vec2(1, 1) - position) * uvSize + vec2(uvStart.x, uvStart.y - uvSize.y);
10713
- }
10714
-
10715
- vColor = color;
10716
- }
10717
-
10718
11332
  declare module '@mappedin/mappedin-js/renderer/internal/quad-tree' {
10719
11333
  export function contains(rect1: Rectangle, rect2: Rectangle): boolean;
10720
11334
  export function intersects(rect1: Rectangle, rect2: Rectangle): boolean;
@@ -10863,51 +11477,3 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.MultiFloorView'
10863
11477
  }
10864
11478
  }
10865
11479
 
10866
- varying vec2 vUv;
10867
-
10868
- void main() {
10869
- vUv = uv;
10870
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
10871
- }
10872
-
10873
- varying vec2 vUv;
10874
- uniform sampler2D staticSceneColorTexture;
10875
- uniform sampler2D staticSceneDepthTexture;
10876
- uniform sampler2D animatedSceneColorTexture;
10877
- uniform sampler2D animatedSceneDepthTexture;
10878
- uniform sampler2D alwaysOnTopSceneColorTexture;
10879
-
10880
- vec4 alphaBlend(vec4 background, vec4 foreground) {
10881
- vec3 resultColor = (
10882
- foreground.rgb * foreground.a +
10883
- background.rgb * background.a * (1.0 - foreground.a)
10884
- );
10885
- float resultAlpha = foreground.a + background.a * (1.0 - foreground.a);
10886
- return vec4(resultColor / resultAlpha, resultAlpha);
10887
- }
10888
-
10889
- vec4 alphaBlendPremultipliedAlpha(vec4 background, vec4 foreground) {
10890
- return foreground + (background * (1.0 - foreground.a));
10891
- }
10892
-
10893
- void main() {
10894
- float staticDepth = texture2D(staticSceneDepthTexture, vUv).r;
10895
- float animatedDepth = texture2D(animatedSceneDepthTexture, vUv).r;
10896
-
10897
- vec4 staticColor = texture2D(staticSceneColorTexture, vUv).rgba;
10898
- vec4 animatedColor = texture2D(animatedSceneColorTexture, vUv).rgba;
10899
-
10900
- if (staticDepth < animatedDepth) {
10901
- // 19/06/10 Terence Dickson
10902
- // Spoiler alert! This is to help prepare for CE-1352, where alpha
10903
- // may be partial instead of zero. Not implementing that as part of
10904
- // this PR, however.
10905
- animatedColor.a *= 0.0;
10906
- }
10907
-
10908
- vec4 lowerColor = alphaBlend(staticColor, animatedColor);
10909
- vec4 alwaysOnTopColor = texture2D(alwaysOnTopSceneColorTexture, vUv).rgba;
10910
-
10911
- gl_FragColor = alphaBlendPremultipliedAlpha(lowerColor, alwaysOnTopColor);
10912
- }
10913
-