@mappedin/mappedin-js 6.0.1-alpha.7 → 6.0.1-alpha.8

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.
@@ -491,7 +491,7 @@ declare module '@mappedin/mappedin-js/maker/src/events' {
491
491
  }
492
492
 
493
493
  declare module '@mappedin/mappedin-js/packages/get-venue' {
494
- import type { TGetVenueOptions, TGetVenueOptionsInternal, TVenueMetadata } from '@mappedin/mappedin-js/packages/get-venue/Mappedin.types';
494
+ import type { TAllGetVenueOptions, TGetVenueOptions, TGetVenueOptionsInternal, TVenueMetadata } from '@mappedin/mappedin-js/packages/get-venue/Mappedin.types';
495
495
  import { Mappedin } from '@mappedin/mappedin-js/packages/get-venue/Mappedin';
496
496
  import { defaultThings } from '@mappedin/mappedin-js/packages/get-venue/default-things';
497
497
  import { GET_VENUE_EVENT } from '@mappedin/mappedin-js/packages/get-venue/internal';
@@ -538,7 +538,10 @@ declare module '@mappedin/mappedin-js/packages/get-venue' {
538
538
  import { MAP_RENDER_MODE } from '@mappedin/mappedin-js/packages/get-venue/Mappedin.types';
539
539
  import { ParsedMVF } from '@mappedin/mvf';
540
540
  export { MAP_RENDER_MODE, GET_VENUE_EVENT };
541
- export function parseOptions(options: TGetVenueOptions): TGetVenueOptionsInternal & TGetVenueOptions;
541
+ /**
542
+ * @internal
543
+ */
544
+ export function parseOptions<T extends TAllGetVenueOptions>(options: T): TGetVenueOptionsInternal<T>;
542
545
  /**
543
546
  * @internal
544
547
  */
@@ -640,7 +643,7 @@ declare module '@mappedin/mappedin-js/packages/get-venue' {
640
643
  * Download a bundle and return a Mappedin instance
641
644
  * @internal
642
645
  */
643
- export function downloadBundle(userOptions: any, { url, updated_at }: {
646
+ export function downloadBundle(userOptions: TGetVenueBundleOptions, { url, updated_at }: {
644
647
  url: any;
645
648
  updated_at: any;
646
649
  }): Promise<Mappedin>;
@@ -691,7 +694,7 @@ declare module '@mappedin/mappedin-js/packages/get-venue' {
691
694
  }
692
695
 
693
696
  declare module '@mappedin/mappedin-js/packages/get-venue/Mappedin.MVF' {
694
- import { Connections, Map as MVFMap, NodeCollection, ObstructionCollection, ParsedMVF, RawMVF, SpaceCollection } from '@mappedin/mvf';
697
+ import { Connections, Map as MVFMap, NodeCollection, ObstructionCollection, ParsedMVF, RawMVF, SpaceCollection, StyleCollection } from '@mappedin/mvf';
695
698
  import { Position } from 'geojson';
696
699
  import { TCategory, TLocation, TMap, TMappedinAPI, TNode, TPolygon, TVortex } from '@mappedin/mappedin-js/packages/get-venue';
697
700
  import { MVFv1ConnectionCollection, MVFv1LevelCollection, MVFv1NodeCollection, ParsedMVFv1, RawMVFv1, WithIDs, MVFStyle } from '@mappedin/mappedin-js/packages/get-venue/Mappedin.MVF.types';
@@ -766,7 +769,7 @@ declare module '@mappedin/mappedin-js/packages/get-venue/Mappedin.MVF' {
766
769
  maxLat: number;
767
770
  maxLong: number;
768
771
  };
769
- export function convertPolygons(map: string, mvfObstructions: ObstructionCollection, mvfSpaces: SpaceCollection, deskEntrances: Map<string, TPolygon['entrances']>, styles: WithIDs<MVFStyle>, converter: CoordinateConverter): TPolygon[];
772
+ export function convertPolygons(map: string, mvfObstructions: ObstructionCollection, mvfSpaces: SpaceCollection, deskEntrances: Map<string, TPolygon['entrances']>, styles: WithIDs<MVFStyle>, layerStyles: StyleCollection, converter: CoordinateConverter): TPolygon[];
770
773
  export function convertVortexes(mvfConnections: Connections): TVortex[];
771
774
  export function convertVortexes_MVFv1(mvfConnections: MVFv1ConnectionCollection): TVortex[];
772
775
  export function overrideMVF(mvf: ParsedMVF, override?: Partial<Pick<ParsedMVF, 'styles.json'>>): ParsedMVF;
@@ -2289,6 +2292,14 @@ declare module '@mappedin/mappedin-js/maker/src/map-view-objects/camera-transfor
2289
2292
  }
2290
2293
 
2291
2294
  declare module '@mappedin/mappedin-js/packages/get-venue/Mappedin.types' {
2295
+ import type { TGetVenueMVFOptions, TGetVenueMakerOptions } from '@mappedin/mappedin-js/packages/get-venue';
2296
+ import type { DefaultThings } from '@mappedin/mappedin-js/packages/get-venue/default-things';
2297
+ export type MergedThings = {
2298
+ [key in keyof DefaultThings]: string[];
2299
+ } & {
2300
+ [k: string]: string[];
2301
+ };
2302
+ export type ThingsOption = Partial<MergedThings>;
2292
2303
  export type TGetVenueOptions = {
2293
2304
  accessToken?: string;
2294
2305
  clientId?: string;
@@ -2302,22 +2313,44 @@ declare module '@mappedin/mappedin-js/packages/get-venue/Mappedin.types' {
2302
2313
  [key in string]: string;
2303
2314
  };
2304
2315
  venue: string;
2305
- things?: any;
2316
+ /**
2317
+ * An object specifying additional properties to fetch for each data item.
2318
+ * Each key represents a data item (e.g., 'locations', 'nodes'), and the value is an array of strings indicating extra properties to be included.
2319
+ * @example
2320
+ * For example:
2321
+ * ```
2322
+ * getVenue({
2323
+ * venue: 'some-venue',
2324
+ * things: { vortexes: [ 'material' ]
2325
+ * }})
2326
+ * ```
2327
+ */
2328
+ things?: ThingsOption;
2306
2329
  useDraftData?: boolean;
2307
2330
  platformString?: string;
2308
2331
  emitAnalyticsEvents?: boolean;
2309
2332
  secure?: boolean;
2310
2333
  preloadMapGeometry?: boolean;
2311
2334
  };
2312
- export type TGetVenueOptionsInternal = {
2335
+ export type TProcessedMVFOptions = TGetVenueMakerOptions & {
2336
+ emitAnalyticsEvents: boolean;
2337
+ clientId: string;
2338
+ clientSecret: string;
2339
+ venue: string;
2340
+ };
2341
+ export type TAllGetVenueOptions = TGetVenueOptions | TGetVenueMVFOptions | (TProcessedMVFOptions & {
2342
+ perspective?: string;
2343
+ });
2344
+ export type TGetVenueOptionsInternal<T extends TAllGetVenueOptions> = Omit<T & {
2313
2345
  baseUrl?: string;
2314
2346
  supplementaryUrl?: string;
2315
2347
  noAuth?: boolean;
2316
2348
  includeHidden?: boolean;
2317
2349
  apiGateway?: string;
2318
2350
  authorization?: string;
2319
- things?: any;
2320
2351
  headers?: any;
2352
+ }, 'things'> & {
2353
+ things?: MergedThings;
2321
2354
  };
2322
2355
  export type TVenueMetadata = {
2323
2356
  languages: {
@@ -2340,14 +2373,14 @@ declare module '@mappedin/mappedin-js/packages/get-venue/Mappedin.types' {
2340
2373
 
2341
2374
  declare module '@mappedin/mappedin-js/packages/get-venue/Mappedin' {
2342
2375
  import { Navigator } from '@mappedin/mappedin-js/packages/navigator';
2343
- import type { TGetVenueOptions, TGetVenueOptionsInternal } from '@mappedin/mappedin-js/packages/get-venue/Mappedin.types';
2376
+ import type { TAllGetVenueOptions, TGetVenueOptions, TGetVenueOptionsInternal } from '@mappedin/mappedin-js/packages/get-venue/Mappedin.types';
2344
2377
  import type { MappedinNode, MappedinPolygon, MappedinLocation, MappedinCategory, MappedinVortex, MappedinVenue, MappedinTheme, MappedinRankings, MappedinLocationRankings, MappedinEvent, MappedinLocationState, MappedinMap, MappedinMapGroup, GET_VENUE_PAYLOAD } from '@mappedin/mappedin-js/packages/get-venue/internal';
2345
2378
  import { TAccessors, GET_VENUE_EVENT } from '@mappedin/mappedin-js/packages/get-venue/internal';
2346
2379
  import { IAnalytics } from '@mappedin/mappedin-js/packages/get-venue/Mappedin.CustomerAnalytics';
2347
2380
  import { ParsedMVF } from '@mappedin/mvf';
2348
2381
  import { ParsedMVFv1 } from '@mappedin/mappedin-js/packages/get-venue/Mappedin.MVF.types';
2349
2382
  import { PubSub } from '@mappedin/mappedin-js/packages/get-venue/pub-sub.typed';
2350
- export const defaultOptions: TGetVenueOptionsInternal & TGetVenueOptions;
2383
+ export const defaultOptions: TGetVenueOptionsInternal<TGetVenueOptions>;
2351
2384
  export class Mappedin extends PubSub<GET_VENUE_PAYLOAD, GET_VENUE_EVENT> {
2352
2385
  #private;
2353
2386
  perspective: any;
@@ -2579,7 +2612,7 @@ declare module '@mappedin/mappedin-js/packages/get-venue/Mappedin' {
2579
2612
  /**
2580
2613
  * @deprecated Use {@link hydrateVenue} instead
2581
2614
  */
2582
- constructor(options: TGetVenueOptionsInternal & TGetVenueOptions);
2615
+ constructor(options: TGetVenueOptionsInternal<TAllGetVenueOptions>);
2583
2616
  analytics: IAnalytics;
2584
2617
  /**
2585
2618
  * @hidden
@@ -2609,6 +2642,7 @@ declare module '@mappedin/mappedin-js/packages/get-venue/default-things' {
2609
2642
  themes: string[];
2610
2643
  rankings: string[];
2611
2644
  };
2645
+ export type DefaultThings = typeof defaultThings;
2612
2646
  }
2613
2647
 
2614
2648
  declare module '@mappedin/mappedin-js/packages/get-venue/internal' {
@@ -3737,7 +3771,7 @@ declare module '@mappedin/mappedin-js/packages/get-venue/Mappedin.MVF.types' {
3737
3771
  }
3738
3772
 
3739
3773
  declare module '@mappedin/mappedin-js/packages/get-venue/Mappedin.MVF.utils' {
3740
- import { Feature, LineString, Polygon } from '@turf/turf';
3774
+ import type { Feature, LineString, Polygon } from '@turf/turf';
3741
3775
  import { EntranceCollection, ObstructionCollection, EntranceProperties, ObstructionProperties, StyleCollection, PolygonStyle, LineStringStyle } from '@mappedin/mvf';
3742
3776
  import { MVFStyle, WithIDs } from '@mappedin/mappedin-js/packages/get-venue/Mappedin.MVF.types';
3743
3777
  export const Z_FIGHTING_ADJUSTMENT_HORIZONTAL_FACTOR = 0.2;
@@ -3751,7 +3785,7 @@ declare module '@mappedin/mappedin-js/packages/get-venue/Mappedin.MVF.utils' {
3751
3785
  */
3752
3786
  export const STATIC_MVF_FILES: readonly ["connection.json", "manifest.geojson", "map.geojson", "node.geojson", "styles.json", "mapstack.geojson"];
3753
3787
  export type TStaticMVFFiles = (typeof STATIC_MVF_FILES)[number];
3754
- export function processObstructions(obstructionCollection: ObstructionCollection, entrances: EntranceCollection, styles?: WithIDs<MVFStyle>): ObstructionCollection;
3788
+ export function processObstructions(obstructionCollection: ObstructionCollection, entrances: EntranceCollection): ObstructionCollection;
3755
3789
  export function isPolygonStyle(style: PolygonStyle | LineStringStyle | undefined): style is PolygonStyle & LineStringStyle;
3756
3790
  export function getStylesMap(styles: StyleCollection): WithIDs<MVFStyle>;
3757
3791
  }
@@ -5372,7 +5406,7 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/MapView.types' {
5372
5406
  import type { Path } from '@mappedin/mappedin-js/packages/legacy-renderer/private/controllers/PathsController';
5373
5407
  import { TOOLTIP_ANCHOR } from '@mappedin/mappedin-js/packages/legacy-renderer/internal/Mappedin.SmartTooltip';
5374
5408
  import { GEOLOCATION_STATUS, COLLISION_RANKING_TIERS, STATE, MARKER_ANCHOR, E_SDK_EVENT, E_BLUEDOT_EVENT, E_CAMERA_EVENT, MAP_RENDER_MODE, CAMERA_EASING_MODE, E_MAP_CHANGED_REASON } from '@mappedin/mappedin-js/packages/legacy-renderer/MapView.enums';
5375
- import { TOutdoorViewControllerOptions } from '@mappedin/mappedin-js/packages/legacy-renderer/private/controllers/OutdoorViewController';
5409
+ import { TOutdoorViewOptions, TOutdoorViewOptionsWithHeaders, TOutdoorViewOptionsWithAuthURL } from '@mappedin/mappedin-js/packages/legacy-renderer/private/controllers/OutdoorViewController';
5376
5410
  export type { TEnableBlueDotOptions, TFloatingLabelAppearance };
5377
5411
  /** @internal */
5378
5412
  export type Without<T, U> = {
@@ -5880,7 +5914,7 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/MapView.types' {
5880
5914
  * Requires `multiBufferRendering` to be enabled.
5881
5915
  * @experimental
5882
5916
  */
5883
- outdoorView?: TOutdoorViewControllerOptions & {
5917
+ outdoorView?: TOutdoorViewOptions & {
5884
5918
  enabled?: boolean;
5885
5919
  };
5886
5920
  /**
@@ -6078,7 +6112,7 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/MapView.types' {
6078
6112
  * @experimental
6079
6113
  * Enable outdoor view. Requires multi-buffer rendering to be enabled
6080
6114
  */
6081
- outdoorView?: TOutdoorViewControllerOptions & {
6115
+ outdoorView?: TOutdoorViewOptions & {
6082
6116
  enabled?: boolean;
6083
6117
  };
6084
6118
  /**
@@ -6583,6 +6617,7 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/MapView.types' {
6583
6617
  */
6584
6618
  [E_CAMERA_EVENT.TILT_CHANGED]: number;
6585
6619
  };
6620
+ export type { TOutdoorViewOptions, TOutdoorViewOptionsWithHeaders, TOutdoorViewOptionsWithAuthURL };
6586
6621
  export type { default as BlueDotController } from '@mappedin/mappedin-js/packages/legacy-renderer/private/controllers/BlueDotController';
6587
6622
  export type { default as Journey } from '@mappedin/mappedin-js/packages/legacy-renderer/public/api/Journey';
6588
6623
  }
@@ -8305,6 +8340,17 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/Mappedin
8305
8340
  assetManager: AssetManager;
8306
8341
  imageVisible: boolean;
8307
8342
  labelVisible: boolean;
8343
+ polygonHeight: number;
8344
+ geometry: ExtrudeGeometry;
8345
+ mesh: Mesh;
8346
+ material: MeshLambertMaterial | MeshLambertMaterial[];
8347
+ labelMesh?: Mesh;
8348
+ imageMesh?: Mesh;
8349
+ /**
8350
+ * For the time being we indicate inflated walls so they don't add to ray casting. Since these are walls it's a good optimization
8351
+ */
8352
+ isInflated: boolean;
8353
+ sortScore: number | null;
8308
8354
  boundingBox: {
8309
8355
  min: {
8310
8356
  x: number;
@@ -8317,13 +8363,6 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/Mappedin
8317
8363
  z: number;
8318
8364
  };
8319
8365
  };
8320
- polygonHeight: number;
8321
- geometry: ExtrudeGeometry;
8322
- mesh: Mesh;
8323
- material: MeshLambertMaterial | MeshLambertMaterial[];
8324
- labelMesh?: Mesh;
8325
- imageMesh?: Mesh;
8326
- sortScore: number | null;
8327
8366
  static materials: {
8328
8367
  [key in string]: MeshLambertMaterial | MeshLambertMaterial[];
8329
8368
  };
@@ -8339,7 +8378,8 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/Mappedin
8339
8378
  x: number;
8340
8379
  y: number;
8341
8380
  };
8342
- static _makeFromCoords(className: any, coords: any, mapClass: any): any;
8381
+ static _makeFromCoords(className: any, coords: any, mapClass: any, element: any): any;
8382
+ static _inflate(coords: any, width: any): any;
8343
8383
  static _setPolygonDefaults(poly: any): any;
8344
8384
  constructor(poly: MappedinPolygon, mapClass: MappedinMap, container: Group, assetManager: any, mapLoadingStrategy?: MAP_RENDER_MODE);
8345
8385
  getBoundingBox(): {
@@ -9797,45 +9837,97 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/private/controlle
9797
9837
  import './OutdoorViewController.scss';
9798
9838
  import type { ICore } from '@mappedin/mappedin-js/packages/legacy-renderer/internal';
9799
9839
  import { XOR } from '@mappedin/mappedin-js/packages/legacy-renderer/MapView.types';
9840
+ /**
9841
+ * Represents the possible positions for map attribution.
9842
+ */
9800
9843
  export type TAttributionPosition = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
9801
- export type TOutdoorViewControllerOptionsWithHeaders = {
9802
- url?: string;
9803
- attributionPosition?: TAttributionPosition;
9804
- customAttribution?: string | string[];
9805
- headers: {
9806
- [key: string]: string | null;
9807
- };
9844
+ /**
9845
+ * Defines the options for an Outdoor View when initialized with headers for authentication.
9846
+ */
9847
+ export type TOutdoorViewOptionsWithHeaders = {
9848
+ /**
9849
+ * The URL to the map style file.
9850
+ * @see https://github.com/maplibre/maplibre-style-spec/
9851
+ */
9852
+ url?: string;
9853
+ /**
9854
+ * The position on the map where the attribution should be displayed.
9855
+ * @default 'bottom-right'
9856
+ */
9857
+ attributionPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
9858
+ /**
9859
+ * Custom text or an array of texts to be used for the map attribution.
9860
+ */
9861
+ customAttribution?: string | string[];
9862
+ /**
9863
+ * An object containing HTTP headers for authentication purposes.
9864
+ * */
9865
+ headers: {
9866
+ [key: string]: string | null;
9867
+ };
9808
9868
  };
9809
- export type TOutdoorViewControllerOptionsWithAuthURL = {
9810
- url?: string;
9811
- authURL?: string;
9812
- customAttribution?: string | string[];
9813
- attributionPosition?: TAttributionPosition;
9869
+ /**
9870
+ * Defines the options for an Outdoor View when initialized with a URL for authentication.
9871
+ */
9872
+ export type TOutdoorViewOptionsWithAuthURL = {
9873
+ /**
9874
+ * The URL to the map style file.
9875
+ * @see https://github.com/maplibre/maplibre-style-spec/
9876
+ */
9877
+ url?: string;
9878
+ /**
9879
+ * The URL to obtain an authentication token.
9880
+ */
9881
+ authURL?: string;
9882
+ /**
9883
+ * Custom text or an array of texts to be used for the map attribution.
9884
+ */
9885
+ customAttribution?: string | string[];
9886
+ /**
9887
+ * The position on the map where the attribution should be displayed.
9888
+ * @default 'bottom-right'
9889
+ */
9890
+ attributionPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
9814
9891
  };
9815
- export type TOutdoorViewControllerOptions = XOR<TOutdoorViewControllerOptionsWithHeaders, TOutdoorViewControllerOptionsWithAuthURL>;
9892
+ /**
9893
+ * Defines the options for initializing an Outdoor View.
9894
+ * This is a union type that requires exclusive or logic,
9895
+ * ensuring that an instance can either have headers or
9896
+ * an authentication URL, but not both.
9897
+ *
9898
+ * Note: It isn't permitted to use `.headers` and `.authURL` options simultaneously.
9899
+ *
9900
+ * @property {string} [url] - The URL to the map style file.
9901
+ * @property {TAttributionPosition} [attributionPosition='bottom-right'] - The position on the map where the attribution should be displayed.
9902
+ * @property {string | string[]} [customAttribution] - Custom text or an array of texts to be used for the map attribution.
9903
+ * @property {Object.<string, string | null>} [headers] - An object containing HTTP headers for authentication purposes. It isn't permitted to use `.headers` and `.authURL` options simultaneously.
9904
+ * @property {string} [authURL] - The URL to obtain an authentication token. It isn't permitted to use `.headers` and `.authURL` options simultaneously.
9905
+ * @interface
9906
+ */
9907
+ export type TOutdoorViewOptions = XOR<TOutdoorViewOptionsWithHeaders, TOutdoorViewOptionsWithAuthURL>;
9816
9908
  class OutdoorViewController {
9817
- _attribution: any;
9818
- core: ICore;
9819
- map: any;
9820
- enabled: boolean;
9821
- hidden: boolean;
9822
- url: string;
9823
- authURL: string;
9824
- headers?: TOutdoorViewControllerOptions['headers'];
9825
- customAttribution?: string | string[];
9826
- attributionPosition?: TAttributionPosition;
9827
- loaded: boolean;
9828
- constructor(core: ICore, options?: TOutdoorViewControllerOptions);
9829
- module: any;
9830
- load(): Promise<void>;
9831
- get attributions(): any;
9832
- hide(): void;
9833
- show(): void;
9834
- resize(): void;
9835
- getRequestHeaders: () => Promise<TOutdoorViewControllerOptions['headers']>;
9836
- render(): void;
9837
- setStyle(style: any): void;
9838
- setAttributionPosition(position: TAttributionPosition): void;
9909
+ _attribution: any;
9910
+ core: ICore;
9911
+ map: any;
9912
+ enabled: boolean;
9913
+ hidden: boolean;
9914
+ url: string;
9915
+ authURL: string;
9916
+ headers?: TOutdoorViewOptions['headers'];
9917
+ customAttribution?: string | string[];
9918
+ attributionPosition?: TAttributionPosition;
9919
+ loaded: boolean;
9920
+ constructor(core: ICore, options?: TOutdoorViewOptions);
9921
+ module: any;
9922
+ load(): Promise<void>;
9923
+ get attributions(): any;
9924
+ hide(): void;
9925
+ show(): void;
9926
+ resize(): void;
9927
+ getRequestHeaders: () => Promise<TOutdoorViewOptions['headers']>;
9928
+ render(): void;
9929
+ setStyle(style: any): void;
9930
+ setAttributionPosition(position: TAttributionPosition): void;
9839
9931
  }
9840
9932
  export default OutdoorViewController;
9841
9933
  }
@@ -10092,158 +10184,9 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/Mappedin
10092
10184
  }
10093
10185
 
10094
10186
  declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/utils' {
10095
- import { Box3, Vector3, Object3D, Material } from 'three';
10096
- import { Mappedin, MapObject, MappedinMap, TMapViewOptions } from '@mappedin/mappedin-js/packages/legacy-renderer/internal';
10097
- import { Camera } from '@mappedin/mappedin-js/packages/legacy-renderer/public/api/Camera';
10098
- /**
10099
- * Utils function listing
10100
- *
10101
- * - scrubMaterial
10102
- * - getObjectID
10103
- * - getObject
10104
- * - getBoundingBox
10105
- * - getBiggestBoundingBox
10106
- * - upackBoundingBox
10107
- * - getMapScale
10108
- * - throttle -> taken from lodash.js
10109
- * - getProjectionScaleFactor
10110
- * - getZoom
10111
- */
10112
- export function isGatewayKey(key: string): boolean;
10113
- export function getCombinedBoundingBox(objects: Object3D[]): Box3;
10114
- export function getMapsBoundingBox(maps: MapObject[], mapPadding: number): Box3;
10115
- export function scrubMaterial(material: Material): void;
10116
- /**
10117
- * Takes a Mappedin Object or id and returns the ID, so our functions can take bottomRight
10118
- * @template T extends string | {id: string}
10119
- * @param {T} object - input can be object containing id or the id itself
10120
- * @return {string}
10121
- */
10122
- export function getObjectId(object: any): string;
10123
- /**
10124
- * Takes a Mappedin object or ID and the array to look in and retuns the Object, so our functions can take both
10125
- */
10126
- export function getObject<K extends {
10127
- id: string;
10128
- }, T extends K | string>(obj: T, array: K[] | undefined): K | undefined;
10129
- export function getBoundingBox(object: Object3D): Box3;
10130
- /**
10131
- * Function pushes the items of the second array onto the first array (inplace).
10132
- * @template T
10133
- * @param {Array.<T>} arr1 - base array
10134
- * @param {Array.<T>} arr2 - array which items will be pushed to arr1
10135
- */
10136
- export function appendItems<T>(arr1: T[], arr2: T[]): void;
10137
- export function getBiggestBoundingBox(objects: Object3D[]): {
10138
- min: any;
10139
- max: any;
10140
- };
10141
- export function unpackBoundingBox(boundingBox: Box3): Vector3[];
10142
- export function getMapScale(map: MappedinMap): number;
10143
- export function getNorth(map: MappedinMap): number;
10144
- export function throttle<T>(func: () => void, wait: number, options?: any): () => void;
10145
- export function debounce<T>(func: () => void, wait: number, immediate?: boolean): () => void;
10146
- export function flatten(list: any[]): any[];
10147
- export function uniq(arr: any[]): any[];
10148
- export function toStyleString(styles: Record<string, string>): string;
10149
- /**
10150
- /* getProjectionScaleFactor()
10151
- /* finds the scale ratio between screen coordinates and 3D coordinates (in X-Z plane)
10152
- /*
10153
- * R
10154
- * /|
10155
- * C : Camera / |
10156
- * PQ : Projection Plane / |
10157
- * OR : Origin / |
10158
- * F : FOV / |
10159
- * Q / |
10160
- * /| |
10161
- * / | |
10162
- * / | |
10163
- * / | |
10164
- * / | |
10165
- * / F/2 | |
10166
- * C ------------P------------ O
10167
- *
10168
- *
10169
- * ProjectionScaleFactor = ( OR / PQ )
10170
- * PQ = canvasHeight / 2
10171
- * CQ = zoom
10172
- *
10173
- * OR / C0 = tan(F/2)
10174
- * so OR = CO * tan(F/2)
10175
- */
10176
- export function getProjectionScaleFactor(FOV: number, canvasHeight: number, zoom: number): number;
10177
- /** getZoom
10178
- *
10179
- * C - Camera, OP -- picture plane (canvas), S - origin,
10180
- * QR - front side of maps Bounding Box, F: FOV
10181
- *
10182
- * Z-axis
10183
- * R_____|______
10184
- * /| | |
10185
- * / | | |
10186
- * P/ | | | maps BB
10187
- * /| | | |
10188
- * / | | | |
10189
- * / | | | |
10190
- * / F |E |T |S |
10191
- * C /--------|-----|-----|-----|------ orthogonal to Y axis, midpoint of focus maps
10192
- * \ | | | |
10193
- * \ | | | |
10194
- * \ | | | |
10195
- * \ | | | |
10196
- * \| | | |
10197
- * O\ | | |
10198
- * \ | | |
10199
- * \|_____|_____|
10200
- * Q
10201
- *
10202
- *
10203
- * We want to get CS, which is the camera zoom
10204
- *
10205
- */
10206
- export function getZoom(focusBox: Box3, focusBoxHeight: number, FOV: number): number;
10207
- interface CalculateTwoDProjectionsParams {
10208
- maps: MapObject[];
10209
- width: number;
10210
- height: number;
10211
- camera: Camera;
10212
- }
10213
- export function calculateTwoDProjections({ maps, width, height, camera }: CalculateTwoDProjectionsParams): {
10214
- min: {
10215
- x: number;
10216
- y: number;
10217
- };
10218
- max: {
10219
- x: number;
10220
- y: number;
10221
- };
10222
- }[];
10223
- export function splitLine(startNode: Vector3, endNode: Vector3, segments: number): Vector3[];
10224
- export function isObject(item: any): boolean;
10225
- export const determineStartingMap: (venue: Mappedin, options: TMapViewOptions) => MappedinMap;
10226
- export function cyrb53(str: string, seed?: number): number;
10227
- export function addMarginMultiplierToBoundingBox(bbox: Box3, multiplier: number): Box3;
10228
- export function tweenPromise({ from, to, duration, easing, delay, onUpdate, onStart, onComplete, }: {
10229
- from: any;
10230
- to: any;
10231
- duration?: number | undefined;
10232
- easing?: any;
10233
- delay?: number | undefined;
10234
- onUpdate?: ((_: any) => void) | undefined;
10235
- onStart?: (() => void) | undefined;
10236
- onComplete?: (() => void) | undefined;
10237
- }): {
10238
- start(core: any): Promise<void>;
10239
- };
10240
- export const linearEase: (t: number) => number;
10241
- export const quadEaseIn: (t: number) => number;
10242
- export const quadEaseOut: (t: number) => number;
10243
- export function interpolate(value: number, inputMin: number, inputMax: number, outputMin: number, outputMax: number, easeFunc?: (t: number) => number): number;
10244
- export function interpolateMulti(value: number, inputRange: number[], outputRange: number[], easeFunc?: (t: number) => number): number;
10245
- export function checkWritableBeforeWrite(obj: any, key: string, value: any): void;
10246
- export {};
10187
+ export * from '@mappedin/mappedin-js/packages/legacy-renderer/internal/utils/utils';
10188
+ export { shouldDisableOffscreenCanvas } from '@mappedin/mappedin-js/packages/legacy-renderer/internal/utils/browser';
10189
+ export { throttle, debounce } from '@mappedin/mappedin-js/packages/legacy-renderer/internal/utils/async';
10247
10190
  }
10248
10191
 
10249
10192
  declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/Mappedin.MapManager' {
@@ -12317,12 +12260,12 @@ declare module '@mappedin/mappedin-js/packages/get-venue/MappedinMapGroup' {
12317
12260
  }
12318
12261
 
12319
12262
  declare module '@mappedin/mappedin-js/packages/get-venue/utils' {
12320
- import type { TGetVenueOptions, TGetVenueOptionsInternal } from '@mappedin/mappedin-js/packages/get-venue/Mappedin.types';
12263
+ import type { MergedThings, TGetVenueOptions, TGetVenueOptionsInternal, ThingsOption } from '@mappedin/mappedin-js/packages/get-venue/Mappedin.types';
12321
12264
  import type { MappedinMap } from '@mappedin/mappedin-js/packages/get-venue/internal';
12322
12265
  import { Mappedin, MappedinNavigatable, MappedinNode, MappedinPolygon, MappedinLocation, MappedinCoordinate } from '@mappedin/mappedin-js/packages/get-venue/internal';
12323
12266
  export function isGatewayKey(key: string): boolean;
12324
12267
  export function stringifyQuery(query: any, gateway?: boolean): string;
12325
- export function buildUrl(options: TGetVenueOptionsInternal & TGetVenueOptions, pathname: string, query: any, supplementary?: boolean): string;
12268
+ export function buildUrl(options: TGetVenueOptionsInternal<TGetVenueOptions>, pathname: string, query: any, supplementary?: boolean): string;
12326
12269
  /**
12327
12270
  * Make a network request to the Mappedin API to fetch an array of objects.
12328
12271
  * @param options options from getVenue- baseUrl and supplementaryUrl are used
@@ -12331,7 +12274,7 @@ declare module '@mappedin/mappedin-js/packages/get-venue/utils' {
12331
12274
  * @param supplementary whether to use the supplementaryUrl when sending the request
12332
12275
  * @returns the result json
12333
12276
  */
12334
- export function getArray(options: TGetVenueOptionsInternal & TGetVenueOptions, pathname: string, query: any, supplementary?: boolean): Promise<any>;
12277
+ export function getArray(options: TGetVenueOptionsInternal<TGetVenueOptions>, pathname: string, query: any, supplementary?: boolean): Promise<any>;
12335
12278
  /**
12336
12279
  * Make a network request to the Mappedin API to fetch an object.
12337
12280
  * @param options options from getVenue- baseUrl and supplementaryUrl are used
@@ -12341,21 +12284,21 @@ declare module '@mappedin/mappedin-js/packages/get-venue/utils' {
12341
12284
  * @param isExpectingArray whether the endpoint returns an array
12342
12285
  * @returns the result json
12343
12286
  */
12344
- export function getObject(options: TGetVenueOptionsInternal & TGetVenueOptions, pathname: string, query: any, supplementary?: boolean, isExpectingArray?: boolean): Promise<any>;
12287
+ export function getObject(options: TGetVenueOptionsInternal<TGetVenueOptions>, pathname: string, query: any, supplementary?: boolean, isExpectingArray?: boolean): Promise<any>;
12345
12288
  /**
12346
12289
  * Prepares the request and URL fields to pass into generateAPIRequest
12347
12290
  * @param options options from getVenue- baseUrl and supplementaryUrl are used
12348
12291
  * @param url string describing the url corresponding to the client's request
12349
12292
  * @param supplementary whether to use the supplementaryUrl when sending the request
12350
12293
  */
12351
- export function constructParamsForRequest(options: TGetVenueOptionsInternal & TGetVenueOptions, url: string, supplementary?: boolean): {
12294
+ export function constructParamsForRequest(options: TGetVenueOptionsInternal<TGetVenueOptions>, url: string, supplementary?: boolean): {
12352
12295
  req: {
12353
12296
  method: string;
12354
12297
  headers: any;
12355
12298
  };
12356
12299
  url: string;
12357
12300
  };
12358
- export function generateAPIRequest(options: TGetVenueOptionsInternal & TGetVenueOptions, url: string, supplementary?: boolean): Promise<any>;
12301
+ export function generateAPIRequest(options: TGetVenueOptionsInternal<TGetVenueOptions>, url: string, supplementary?: boolean): Promise<any>;
12359
12302
  export function addToSet(array: any, value: any): void;
12360
12303
  export function getDistanceBetweenLatLon([lat1, lon1]: [number, number], [lat2, lon2]: [number, number]): any;
12361
12304
  export function getMapScale(map: MappedinMap): any;
@@ -12389,6 +12332,7 @@ declare module '@mappedin/mappedin-js/packages/get-venue/utils' {
12389
12332
  * @return {MappedinLocation}
12390
12333
  */
12391
12334
  export const getPrimaryLocationForPolygon: (polygon: MappedinPolygon | string | undefined, venue: Mappedin) => MappedinLocation | null;
12335
+ export function mergeThings(thingsOption: ThingsOption | undefined): MergedThings;
12392
12336
  }
12393
12337
 
12394
12338
  declare module '@mappedin/mappedin-js/packages/get-venue/Mappedin.cache' {
@@ -12874,7 +12818,7 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/quad-tre
12874
12818
  }
12875
12819
 
12876
12820
  declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/shave-text' {
12877
- export type TDrawFn = (ctx: CanvasRenderingContext2D, x: number, y: number) => void;
12821
+ export type TDrawFn = (ctx: CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D, x: number, y: number) => void;
12878
12822
  type TShave = (str: string, size: number, maxWidth: number, maxLines?: number, lineHeight?: number, options?: {
12879
12823
  strokeText: boolean;
12880
12824
  }) => {
@@ -13093,242 +13037,201 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/Mappedin
13093
13037
  }
13094
13038
  }
13095
13039
 
13096
- declare module '@mappedin/mappedin-js/packages/legacy-renderer/public/api/Camera' {
13097
- import { E_CAMERA_DIRECTION } from '@mappedin/mappedin-js/packages/legacy-renderer/MapView.enums';
13098
- import CameraController, { TCameraAnimationOptions, TCameraInteractionsSetOptions, TCameraTargets, TCameraTransform, TFocusOnCameraOptions } from '@mappedin/mappedin-js/packages/legacy-renderer/private/controllers/CameraController';
13040
+ declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/utils/utils' {
13041
+ import { Box3, Vector3, Object3D, Material } from 'three';
13042
+ import { Mappedin, MapObject, MappedinMap, TMapViewOptions } from '@mappedin/mappedin-js/packages/legacy-renderer/internal';
13043
+ import { Camera } from '@mappedin/mappedin-js/packages/legacy-renderer/public/api/Camera';
13099
13044
  /**
13100
- * API to control and respond to the state of the camera within the scene.
13045
+ * Utils function listing
13046
+ *
13047
+ * - scrubMaterial
13048
+ * - getObjectID
13049
+ * - getObject
13050
+ * - getBoundingBox
13051
+ * - getBiggestBoundingBox
13052
+ * - upackBoundingBox
13053
+ * - getMapScale
13054
+ * - throttle -> taken from lodash.js
13055
+ * - getProjectionScaleFactor
13056
+ * - getZoom
13101
13057
  */
13102
- export class Camera {
13103
- #private;
13104
- /**
13105
- * @hidden
13106
- */
13107
- constructor(controller: CameraController);
13108
- /**
13109
- * Subscribe a function to be called when an {@link E_CAMERA_EVENT} is fired.
13110
- *
13111
- * ```ts
13112
- * const cameraChangedHandler = ({ tilt, position, zoom, rotation }) => {
13113
- * // Do something with the new values
13114
- * };
13115
- * mapView.Camera.on(E_CAMERA_EVENT.CHANGED, cameraChangedHandler);
13116
- * ```
13117
- *
13118
- * @param eventName An {@link E_CAMERA_EVENT} that is fired when the camera changes.
13119
- * @param fn A callback that gets called when the corresponding event is fired. The
13120
- * callback will get passed an argument with a type that's one of {@link CAMERA_EVENT_PAYLOAD}.
13121
- */
13122
- on: CameraController['on'];
13123
- /**
13124
- * Unsubscribe a function that was previously subscribed with {@link on}.
13125
- *
13126
- * ```ts
13127
- * mapView.Camera.on(E_CAMERA_EVENT.CHANGED, cameraChangedHandler);
13128
- *
13129
- * ...
13130
- *
13131
- * // Something changed and I no longer want this event to fire
13132
- * mapView.Camera.off(E_CAMERA_EVENT.CHANGED, cameraChangedHandler);
13133
- * ```
13134
- *
13135
- * @param eventName An {@link E_CAMERA_EVENT} that is fired when the camera changes.
13136
- * @param fn A function that was previously passed to {@link on}. The function must
13137
- * have the same reference as the function that was subscribed.
13138
- */
13139
- off: CameraController['off'];
13140
- /**
13141
- * The current camera animation, if any. Resolves when the animation finishes.
13142
- */
13143
- get currentAnimation(): Promise<undefined> | undefined;
13144
- /**
13145
- * Current Camera zoom (in meters)
13146
- */
13147
- get zoom(): number;
13148
- /**
13149
- * Current Camera rotation (in radians) from north
13150
- */
13151
- get rotation(): number;
13152
- /**
13153
- * Current camera tilt angle (in radians), relative to a top-down view.
13154
- *
13155
- * ex: 0 means the camera is facing top-down, π/2 means the camera is
13156
- * facing directly from the side.
13157
- */
13158
- get tilt(): number;
13159
- /**
13160
- * Get the minimum distance (in meters) the camera is allowed to get to the ground.
13161
- */
13162
- get minZoom(): number;
13163
- /**
13164
- * Set the minimum distance (in meters) the camera is allowed to get to the ground.
13165
- */
13166
- set minZoom(meters: number);
13167
- /**
13168
- * Get the maximum distance (in meters) the camera is allowed to get from the ground.
13169
- */
13170
- get maxZoom(): number;
13171
- /**
13172
- * Set the maximum distance (in meters) the camera is allowed to get from the ground.
13173
- */
13174
- set maxZoom(meters: number);
13175
- /**
13176
- * Get the current maximum tilt angle (in radians) the camera is allowed to use.
13177
- */
13178
- get maxTilt(): number;
13179
- /**
13180
- * Sets the maximum tilt angle (in radians) the camera is allowed to use.
13181
- *
13182
- * Tilt angle must be between 0 and π/2 radians. It will be clamped within
13183
- * this range if it exceeds it on either end.
13184
- *
13185
- * As tilt angle approaches π/2 radians, this will impact overall touch controls
13186
- * and should be used sparingly.
13187
- */
13188
- set maxTilt(radians: number);
13189
- /**
13190
- * Get the current camera position, which is at the center of the map.
13191
- * @returns the position as a coordinate
13192
- */
13193
- get position(): import("../../index.rn").MappedinCoordinate;
13194
- /**
13195
- * Enable or disable the ability for the user to interact with the camera (e.g. pan, zoom, tilt, etc).
13196
- * This does not affect programmatic camera controls, such as {@link set} and {@link focusOn}.
13197
- *
13198
- * ```ts
13199
- * // The user can no longer interact to move the camera
13200
- * mapView.Camera.interactions.disable();
13201
- *
13202
- * // The user can now interact to move the camera again
13203
- * mapView.Camera.interactions.enable();
13204
- * ```
13205
- */
13206
- interactions: {
13207
- /**
13208
- * Enable or disable specific user interactions.
13209
- *
13210
- * ```ts
13211
- * mapView.Camera.interactions.set({ zoom: false });
13212
- * ```
13213
- *
13214
- * @param options An object defining the interactions to switch on or off.
13215
- *
13216
- */
13217
- set: (options: TCameraInteractionsSetOptions) => void;
13218
- /**
13219
- * Enable all user interactions.
13220
- */
13221
- enable: () => void;
13222
- /**
13223
- * Disable all user interactions.
13224
- */
13225
- disable: () => void;
13226
- };
13227
- /**
13228
- * Define an area of the screen that is safe for the camera. Anything outside the safe area is
13229
- * assumed to be covered in some way (e.g. by UI) meaning the camera will not place
13230
- * any map elements there when calling {@link focusOn}.
13231
- *
13232
- * ```ts
13233
- * // The top 100px of the canvas are covered by a UI element
13234
- * mapView.Camera.setSafeAreaInsets({ top: 100, left: 0, bottom: 0, right: 0});
13235
- * mapView.Camera.focusOn({ nodes });
13236
- * ```
13237
- *
13238
- * @param insets An object defining a number of pixels from the top, left, bottom, and right of
13239
- * the screen. Only the area within the padding defined by these pixels is considered safe.
13240
- */
13241
- setSafeAreaInsets(insets: {
13242
- top: number;
13243
- left: number;
13244
- bottom: number;
13245
- right: number;
13246
- }): void;
13247
- /**
13248
- * Retrieve the values previously set by {@link setSafeAreaInsets}.
13249
- *
13250
- * @returns An object defining a number of pixels from the top, left, bottom, and right of
13251
- * the screen.
13252
- */
13253
- getSafeAreaInsets(): import("../../MapView.types").TPadding;
13254
- /**
13255
- * Animate the camera to focus on a collection of targets. To control where the targets should
13256
- * be placed on screen, either specify `safeAreaInsets` on the {@link TFocusOnCameraOptions}
13257
- * or call {@link setSafeAreaInsets}.
13258
- *
13259
- * ```ts
13260
- * const location = mapView.venue.locations.find((l) => l.name === "My Location")!;
13261
- *
13262
- * mapView.Camera.focusOn({
13263
- * polygons: location.polygons,
13264
- * nodes: location.nodes,
13265
- * });
13266
- * ```
13267
- *
13268
- * @param targets A collection of things that the camera will place into view at the end of the
13269
- * animation.
13270
- * @param options
13271
- * @returns a Promise that resolves when the animation finishes, or rejects when it is cancelled.
13272
- */
13273
- focusOn(targets: TCameraTargets, options?: TFocusOnCameraOptions & TCameraAnimationOptions): Promise<any>;
13274
- /**
13275
- * Instantaneously set the camera's transform to be in a new configuration. See also {@link animate}.
13276
- *
13277
- * ```ts
13278
- * const coord = mapView.venue.maps[0].createCoordinate(33.66107, 31.83911);
13279
- *
13280
- * // Place the camera top-down at a specified coordinate
13281
- * mapView.Camera.set({
13282
- * tilt: 0,
13283
- * position: coord,
13284
- * });
13285
- * ```
13286
- *
13287
- * @param transform The new transform of the camera.
13288
- */
13289
- set(transform: TCameraTransform): void;
13290
- /**
13291
- * Convert a Mercator Zoom Level to altitude, which can be used in the Camera APIs
13292
- */
13293
- convertZoomLevelToAltitude(zoomLevel: number): any;
13294
- /**
13295
- * Convert the altitude returned by getZoom into Mercator Zoom level
13296
- */
13297
- convertAltitudeToZoomLevel(altitude: number): any;
13298
- /**
13299
- * Smoothly transition the camera's transform to be in a new configuration. See also {@link set}.
13300
- *
13301
- * ```ts
13302
- * const coord = mapView.venue.maps[0].createCoordinate(33.66107, 31.83911);
13303
- *
13304
- * // Animate the camera to be top-down at a specified coordinate
13305
- * mapView.Camera.animate({
13306
- * tilt: 0,
13307
- * position: coord,
13308
- * });
13309
- * ```
13058
+ export function isGatewayKey(key: string): boolean;
13059
+ export function getCombinedBoundingBox(objects: Object3D[]): Box3;
13060
+ export function getMapsBoundingBox(maps: MapObject[], mapPadding: number): Box3;
13061
+ export function scrubMaterial(material: Material): void;
13062
+ /**
13063
+ * Takes a Mappedin Object or id and returns the ID, so our functions can take bottomRight
13064
+ * @template T extends string | {id: string}
13065
+ * @param {T} object - input can be object containing id or the id itself
13066
+ * @return {string}
13067
+ */
13068
+ export function getObjectId(object: any): string;
13069
+ /**
13070
+ * Takes a Mappedin object or ID and the array to look in and retuns the Object, so our functions can take both
13071
+ */
13072
+ export function getObject<K extends {
13073
+ id: string;
13074
+ }, T extends K | string>(obj: T, array: K[] | undefined): K | undefined;
13075
+ export function getBoundingBox(object: Object3D): Box3;
13076
+ /**
13077
+ * Function pushes the items of the second array onto the first array (inplace).
13078
+ * @template T
13079
+ * @param {Array.<T>} arr1 - base array
13080
+ * @param {Array.<T>} arr2 - array which items will be pushed to arr1
13081
+ */
13082
+ export function appendItems<T>(arr1: T[], arr2: T[]): void;
13083
+ export function getBiggestBoundingBox(objects: Object3D[]): {
13084
+ min: any;
13085
+ max: any;
13086
+ };
13087
+ export function unpackBoundingBox(boundingBox: Box3): Vector3[];
13088
+ export function getMapScale(map: MappedinMap): number;
13089
+ export function getNorth(map: MappedinMap): number;
13090
+ export function flatten(list: any[]): any[];
13091
+ export function uniq(arr: any[]): any[];
13092
+ export function toStyleString(styles: Record<string, string>): string;
13093
+ /**
13094
+ /* getProjectionScaleFactor()
13095
+ /* finds the scale ratio between screen coordinates and 3D coordinates (in X-Z plane)
13096
+ /*
13097
+ * R
13098
+ * /|
13099
+ * C : Camera / |
13100
+ * PQ : Projection Plane / |
13101
+ * OR : Origin / |
13102
+ * F : FOV / |
13103
+ * Q / |
13104
+ * /| |
13105
+ * / | |
13106
+ * / | |
13107
+ * / | |
13108
+ * / | |
13109
+ * / F/2 | |
13110
+ * C ------------P------------ O
13310
13111
  *
13311
- * @param transform The new transform of the camera.
13312
- * @param options
13313
- * @returns a Promise that resolves when the animation finishes, or rejects when it is cancelled.
13314
- */
13315
- animate(transform: TCameraTransform, options?: TCameraAnimationOptions): Promise<undefined>;
13316
- /**
13317
- * Moves the Camera view in a relative direction by a given distance in meters.
13318
13112
  *
13319
- * ```ts
13320
- * // Move the camera 50 meters up relative to the camera frame
13321
- * mapView.Camera.translate(E_CAMERA_DIRECTION.UP, 50);
13322
- * ```
13113
+ * ProjectionScaleFactor = ( OR / PQ )
13114
+ * PQ = canvasHeight / 2
13115
+ * CQ = zoom
13323
13116
  *
13324
- * @returns a Promise that resolves when the translation animation finishes, or rejects when it is cancelled.
13325
- */
13326
- translate(direction: E_CAMERA_DIRECTION, distance: number, options?: TCameraAnimationOptions): Promise<unknown>;
13327
- /**
13328
- * Cancel the currently active Camera animation.
13117
+ * OR / C0 = tan(F/2)
13118
+ * so OR = CO * tan(F/2)
13329
13119
  */
13330
- cancelAnimation(): void;
13120
+ export function getProjectionScaleFactor(FOV: number, canvasHeight: number, zoom: number): number;
13121
+ /** getZoom
13122
+ *
13123
+ * C - Camera, OP -- picture plane (canvas), S - origin,
13124
+ * QR - front side of maps Bounding Box, F: FOV
13125
+ *
13126
+ * Z-axis
13127
+ * R_____|______
13128
+ * /| | |
13129
+ * / | | |
13130
+ * P/ | | | maps BB
13131
+ * /| | | |
13132
+ * / | | | |
13133
+ * / | | | |
13134
+ * / F |E |T |S |
13135
+ * C /--------|-----|-----|-----|------ orthogonal to Y axis, midpoint of focus maps
13136
+ * \ | | | |
13137
+ * \ | | | |
13138
+ * \ | | | |
13139
+ * \ | | | |
13140
+ * \| | | |
13141
+ * O\ | | |
13142
+ * \ | | |
13143
+ * \|_____|_____|
13144
+ * Q
13145
+ *
13146
+ *
13147
+ * We want to get CS, which is the camera zoom
13148
+ *
13149
+ */
13150
+ export function getZoom(focusBox: Box3, focusBoxHeight: number, FOV: number): number;
13151
+ interface CalculateTwoDProjectionsParams {
13152
+ maps: MapObject[];
13153
+ width: number;
13154
+ height: number;
13155
+ camera: Camera;
13331
13156
  }
13157
+ export function calculateTwoDProjections({ maps, width, height, camera }: CalculateTwoDProjectionsParams): {
13158
+ min: {
13159
+ x: number;
13160
+ y: number;
13161
+ };
13162
+ max: {
13163
+ x: number;
13164
+ y: number;
13165
+ };
13166
+ }[];
13167
+ export function splitLine(startNode: Vector3, endNode: Vector3, segments: number): Vector3[];
13168
+ export function isObject(item: any): boolean;
13169
+ export const determineStartingMap: (venue: Mappedin, options: TMapViewOptions) => MappedinMap;
13170
+ export function cyrb53(str: string, seed?: number): number;
13171
+ export function addMarginMultiplierToBoundingBox(bbox: Box3, multiplier: number): Box3;
13172
+ export function tweenPromise({ from, to, duration, easing, delay, onUpdate, onStart, onComplete, }: {
13173
+ from: any;
13174
+ to: any;
13175
+ duration?: number | undefined;
13176
+ easing?: any;
13177
+ delay?: number | undefined;
13178
+ onUpdate?: ((_: any) => void) | undefined;
13179
+ onStart?: (() => void) | undefined;
13180
+ onComplete?: (() => void) | undefined;
13181
+ }): {
13182
+ start(core: any): Promise<void>;
13183
+ };
13184
+ export const linearEase: (t: number) => number;
13185
+ export const quadEaseIn: (t: number) => number;
13186
+ export const quadEaseOut: (t: number) => number;
13187
+ export function interpolate(value: number, inputMin: number, inputMax: number, outputMin: number, outputMax: number, easeFunc?: (t: number) => number): number;
13188
+ export function interpolateMulti(value: number, inputRange: number[], outputRange: number[], easeFunc?: (t: number) => number): number;
13189
+ export function checkWritableBeforeWrite(obj: any, key: string, value: any): void;
13190
+ export {};
13191
+ }
13192
+
13193
+ declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/utils/browser' {
13194
+ type DeviceType = {
13195
+ isIpad: boolean;
13196
+ isMobile: boolean;
13197
+ isSafari12: boolean;
13198
+ isFirefox: boolean;
13199
+ isWindows: boolean;
13200
+ };
13201
+ /**
13202
+ * Get device OS info
13203
+ * export for testing purpose
13204
+ * @returns DeviceType
13205
+ */
13206
+ export const _deviceTypeControl: {
13207
+ getDeviceType(): DeviceType;
13208
+ _reset(): void;
13209
+ };
13210
+ export const getDeviceType: () => DeviceType;
13211
+ /**
13212
+ * Creates a closure encapsulating the logic of getting device GPU info.
13213
+ * inspired by https://github.com/pmndrs/detect-gpu
13214
+ * export for testing
13215
+ */
13216
+ export const _gpuInfoControl: {
13217
+ getInfo: () => string | undefined;
13218
+ shouldDisableOffscreenCanvas: () => boolean;
13219
+ _setCanvas(c: HTMLCanvasElement): void;
13220
+ };
13221
+ export const getGPUInfo: () => string | undefined;
13222
+ /**
13223
+ * Check if device is certain intel integrated GPU.
13224
+ * This is for implementing workaround - https://issues.chromium.org/issues/40251953
13225
+ * The reason we want to disable OffscreenCanvas at all is due to `willReadFrequently` flag only works in FF.
13226
+ * In order to ensure the integrated intel GPU render text correctly
13227
+ */
13228
+ export const shouldDisableOffscreenCanvas: () => boolean;
13229
+ export {};
13230
+ }
13231
+
13232
+ declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/utils/async' {
13233
+ export function throttle<T>(func: () => void, wait: number, options?: any): () => void;
13234
+ export function debounce<T>(func: () => void, wait: number, immediate?: boolean): () => void;
13332
13235
  }
13333
13236
 
13334
13237
  declare module '@mappedin/mappedin-js/packages/legacy-renderer/internal/Mappedin.MultiFloorView' {
@@ -13924,6 +13827,244 @@ declare module '@mappedin/mappedin-js/packages/legacy-renderer/public/api/BlueDo
13924
13827
  }
13925
13828
  }
13926
13829
 
13830
+ declare module '@mappedin/mappedin-js/packages/legacy-renderer/public/api/Camera' {
13831
+ import { E_CAMERA_DIRECTION } from '@mappedin/mappedin-js/packages/legacy-renderer/MapView.enums';
13832
+ import CameraController, { TCameraAnimationOptions, TCameraInteractionsSetOptions, TCameraTargets, TCameraTransform, TFocusOnCameraOptions } from '@mappedin/mappedin-js/packages/legacy-renderer/private/controllers/CameraController';
13833
+ /**
13834
+ * API to control and respond to the state of the camera within the scene.
13835
+ */
13836
+ export class Camera {
13837
+ #private;
13838
+ /**
13839
+ * @hidden
13840
+ */
13841
+ constructor(controller: CameraController);
13842
+ /**
13843
+ * Subscribe a function to be called when an {@link E_CAMERA_EVENT} is fired.
13844
+ *
13845
+ * ```ts
13846
+ * const cameraChangedHandler = ({ tilt, position, zoom, rotation }) => {
13847
+ * // Do something with the new values
13848
+ * };
13849
+ * mapView.Camera.on(E_CAMERA_EVENT.CHANGED, cameraChangedHandler);
13850
+ * ```
13851
+ *
13852
+ * @param eventName An {@link E_CAMERA_EVENT} that is fired when the camera changes.
13853
+ * @param fn A callback that gets called when the corresponding event is fired. The
13854
+ * callback will get passed an argument with a type that's one of {@link CAMERA_EVENT_PAYLOAD}.
13855
+ */
13856
+ on: CameraController['on'];
13857
+ /**
13858
+ * Unsubscribe a function that was previously subscribed with {@link on}.
13859
+ *
13860
+ * ```ts
13861
+ * mapView.Camera.on(E_CAMERA_EVENT.CHANGED, cameraChangedHandler);
13862
+ *
13863
+ * ...
13864
+ *
13865
+ * // Something changed and I no longer want this event to fire
13866
+ * mapView.Camera.off(E_CAMERA_EVENT.CHANGED, cameraChangedHandler);
13867
+ * ```
13868
+ *
13869
+ * @param eventName An {@link E_CAMERA_EVENT} that is fired when the camera changes.
13870
+ * @param fn A function that was previously passed to {@link on}. The function must
13871
+ * have the same reference as the function that was subscribed.
13872
+ */
13873
+ off: CameraController['off'];
13874
+ /**
13875
+ * The current camera animation, if any. Resolves when the animation finishes.
13876
+ */
13877
+ get currentAnimation(): Promise<undefined> | undefined;
13878
+ /**
13879
+ * Current Camera zoom (in meters)
13880
+ */
13881
+ get zoom(): number;
13882
+ /**
13883
+ * Current Camera rotation (in radians) from north
13884
+ */
13885
+ get rotation(): number;
13886
+ /**
13887
+ * Current camera tilt angle (in radians), relative to a top-down view.
13888
+ *
13889
+ * ex: 0 means the camera is facing top-down, π/2 means the camera is
13890
+ * facing directly from the side.
13891
+ */
13892
+ get tilt(): number;
13893
+ /**
13894
+ * Get the minimum distance (in meters) the camera is allowed to get to the ground.
13895
+ */
13896
+ get minZoom(): number;
13897
+ /**
13898
+ * Set the minimum distance (in meters) the camera is allowed to get to the ground.
13899
+ */
13900
+ set minZoom(meters: number);
13901
+ /**
13902
+ * Get the maximum distance (in meters) the camera is allowed to get from the ground.
13903
+ */
13904
+ get maxZoom(): number;
13905
+ /**
13906
+ * Set the maximum distance (in meters) the camera is allowed to get from the ground.
13907
+ */
13908
+ set maxZoom(meters: number);
13909
+ /**
13910
+ * Get the current maximum tilt angle (in radians) the camera is allowed to use.
13911
+ */
13912
+ get maxTilt(): number;
13913
+ /**
13914
+ * Sets the maximum tilt angle (in radians) the camera is allowed to use.
13915
+ *
13916
+ * Tilt angle must be between 0 and π/2 radians. It will be clamped within
13917
+ * this range if it exceeds it on either end.
13918
+ *
13919
+ * As tilt angle approaches π/2 radians, this will impact overall touch controls
13920
+ * and should be used sparingly.
13921
+ */
13922
+ set maxTilt(radians: number);
13923
+ /**
13924
+ * Get the current camera position, which is at the center of the map.
13925
+ * @returns the position as a coordinate
13926
+ */
13927
+ get position(): import("../../index.rn").MappedinCoordinate;
13928
+ /**
13929
+ * Enable or disable the ability for the user to interact with the camera (e.g. pan, zoom, tilt, etc).
13930
+ * This does not affect programmatic camera controls, such as {@link set} and {@link focusOn}.
13931
+ *
13932
+ * ```ts
13933
+ * // The user can no longer interact to move the camera
13934
+ * mapView.Camera.interactions.disable();
13935
+ *
13936
+ * // The user can now interact to move the camera again
13937
+ * mapView.Camera.interactions.enable();
13938
+ * ```
13939
+ */
13940
+ interactions: {
13941
+ /**
13942
+ * Enable or disable specific user interactions.
13943
+ *
13944
+ * ```ts
13945
+ * mapView.Camera.interactions.set({ zoom: false });
13946
+ * ```
13947
+ *
13948
+ * @param options An object defining the interactions to switch on or off.
13949
+ *
13950
+ */
13951
+ set: (options: TCameraInteractionsSetOptions) => void;
13952
+ /**
13953
+ * Enable all user interactions.
13954
+ */
13955
+ enable: () => void;
13956
+ /**
13957
+ * Disable all user interactions.
13958
+ */
13959
+ disable: () => void;
13960
+ };
13961
+ /**
13962
+ * Define an area of the screen that is safe for the camera. Anything outside the safe area is
13963
+ * assumed to be covered in some way (e.g. by UI) meaning the camera will not place
13964
+ * any map elements there when calling {@link focusOn}.
13965
+ *
13966
+ * ```ts
13967
+ * // The top 100px of the canvas are covered by a UI element
13968
+ * mapView.Camera.setSafeAreaInsets({ top: 100, left: 0, bottom: 0, right: 0});
13969
+ * mapView.Camera.focusOn({ nodes });
13970
+ * ```
13971
+ *
13972
+ * @param insets An object defining a number of pixels from the top, left, bottom, and right of
13973
+ * the screen. Only the area within the padding defined by these pixels is considered safe.
13974
+ */
13975
+ setSafeAreaInsets(insets: {
13976
+ top: number;
13977
+ left: number;
13978
+ bottom: number;
13979
+ right: number;
13980
+ }): void;
13981
+ /**
13982
+ * Retrieve the values previously set by {@link setSafeAreaInsets}.
13983
+ *
13984
+ * @returns An object defining a number of pixels from the top, left, bottom, and right of
13985
+ * the screen.
13986
+ */
13987
+ getSafeAreaInsets(): import("../../MapView.types").TPadding;
13988
+ /**
13989
+ * Animate the camera to focus on a collection of targets. To control where the targets should
13990
+ * be placed on screen, either specify `safeAreaInsets` on the {@link TFocusOnCameraOptions}
13991
+ * or call {@link setSafeAreaInsets}.
13992
+ *
13993
+ * ```ts
13994
+ * const location = mapView.venue.locations.find((l) => l.name === "My Location")!;
13995
+ *
13996
+ * mapView.Camera.focusOn({
13997
+ * polygons: location.polygons,
13998
+ * nodes: location.nodes,
13999
+ * });
14000
+ * ```
14001
+ *
14002
+ * @param targets A collection of things that the camera will place into view at the end of the
14003
+ * animation.
14004
+ * @param options
14005
+ * @returns a Promise that resolves when the animation finishes, or rejects when it is cancelled.
14006
+ */
14007
+ focusOn(targets: TCameraTargets, options?: TFocusOnCameraOptions & TCameraAnimationOptions): Promise<any>;
14008
+ /**
14009
+ * Instantaneously set the camera's transform to be in a new configuration. See also {@link animate}.
14010
+ *
14011
+ * ```ts
14012
+ * const coord = mapView.venue.maps[0].createCoordinate(33.66107, 31.83911);
14013
+ *
14014
+ * // Place the camera top-down at a specified coordinate
14015
+ * mapView.Camera.set({
14016
+ * tilt: 0,
14017
+ * position: coord,
14018
+ * });
14019
+ * ```
14020
+ *
14021
+ * @param transform The new transform of the camera.
14022
+ */
14023
+ set(transform: TCameraTransform): void;
14024
+ /**
14025
+ * Convert a Mercator Zoom Level to altitude, which can be used in the Camera APIs
14026
+ */
14027
+ convertZoomLevelToAltitude(zoomLevel: number): any;
14028
+ /**
14029
+ * Convert the altitude returned by getZoom into Mercator Zoom level
14030
+ */
14031
+ convertAltitudeToZoomLevel(altitude: number): any;
14032
+ /**
14033
+ * Smoothly transition the camera's transform to be in a new configuration. See also {@link set}.
14034
+ *
14035
+ * ```ts
14036
+ * const coord = mapView.venue.maps[0].createCoordinate(33.66107, 31.83911);
14037
+ *
14038
+ * // Animate the camera to be top-down at a specified coordinate
14039
+ * mapView.Camera.animate({
14040
+ * tilt: 0,
14041
+ * position: coord,
14042
+ * });
14043
+ * ```
14044
+ *
14045
+ * @param transform The new transform of the camera.
14046
+ * @param options
14047
+ * @returns a Promise that resolves when the animation finishes, or rejects when it is cancelled.
14048
+ */
14049
+ animate(transform: TCameraTransform, options?: TCameraAnimationOptions): Promise<undefined>;
14050
+ /**
14051
+ * Moves the Camera view in a relative direction by a given distance in meters.
14052
+ *
14053
+ * ```ts
14054
+ * // Move the camera 50 meters up relative to the camera frame
14055
+ * mapView.Camera.translate(E_CAMERA_DIRECTION.UP, 50);
14056
+ * ```
14057
+ *
14058
+ * @returns a Promise that resolves when the translation animation finishes, or rejects when it is cancelled.
14059
+ */
14060
+ translate(direction: E_CAMERA_DIRECTION, distance: number, options?: TCameraAnimationOptions): Promise<unknown>;
14061
+ /**
14062
+ * Cancel the currently active Camera animation.
14063
+ */
14064
+ cancelAnimation(): void;
14065
+ }
14066
+ }
14067
+
13927
14068
  declare module '@mappedin/mappedin-js/packages/legacy-renderer/public/api/Exporter' {
13928
14069
  import { ExportController } from '@mappedin/mappedin-js/packages/legacy-renderer/internal';
13929
14070
  /**