@mappedin/mappedin-js 5.1.5 → 5.2.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.
@@ -67,6 +67,7 @@ declare module '@mappedin/mappedin-js' {
67
67
  }
68
68
 
69
69
  declare module '@mappedin/mappedin-js/renderer/MapView' {
70
+ import { Texture } from 'three';
70
71
  import './internal/Mappedin.css';
71
72
  import { Mappedin, MappedinCoordinate, MappedinLocation, MappedinMap, MappedinNode, MappedinPolygon } from '@mappedin/mappedin-js/get-venue';
72
73
  import { E_SDK_EVENT_PAYLOAD, TCreateMarkerOptions, TLabelAllLocationFlatLabelOptions, TLabelAllLocationFloatingLabelOptions, TMapViewOptions, TPathOptions, TCreateTooltipCommonOptions, TCreateTooltipOptions } from '@mappedin/mappedin-js/renderer/MapView.types';
@@ -81,15 +82,29 @@ declare module '@mappedin/mappedin-js/renderer/MapView' {
81
82
  import { IFlatLabels } from '@mappedin/mappedin-js/renderer/MapView.FlatLabels';
82
83
  import { IFloatingLabels } from '@mappedin/mappedin-js/renderer/MapView.FloatingLabels';
83
84
  export enum INTERNAL_EVENT {
84
- CAMERA_MOVING = 0,
85
- SET_BLUE_DOT_SIZE_FROM_ZOOM = 1,
86
- PUBLISH_BLUE_DOT = 2,
87
- SET_STATE_SILENT = 3,
88
- BLUE_DOT_UPDATE_POSITION = 4,
89
- BLUE_DOT_SET_FOLLOWING = 5,
90
- CLEAR_MOUSE = 6
85
+ ON_FIRST_MAP_LOADED = 0,
86
+ TEXTURE_LOADED = 1,
87
+ RENDER = 2,
88
+ RENDER_NOW = 3,
89
+ UPDATE_FLIPPABLES = 4,
90
+ SET_MAP_START = 5,
91
+ SET_MAP = 6,
92
+ CAMERA_MOVING = 7,
93
+ SET_BLUE_DOT_SIZE_FROM_ZOOM = 8,
94
+ PUBLISH_BLUE_DOT = 9,
95
+ SET_STATE_SILENT = 10,
96
+ BLUE_DOT_UPDATE_POSITION = 11,
97
+ BLUE_DOT_SET_FOLLOWING = 12,
98
+ CLEAR_MOUSE = 13
91
99
  }
92
100
  export type INTERNAL_EVENT_PAYLOAD = {
101
+ [INTERNAL_EVENT.SET_MAP_START]: undefined;
102
+ [INTERNAL_EVENT.ON_FIRST_MAP_LOADED]: undefined;
103
+ [INTERNAL_EVENT.TEXTURE_LOADED]: Texture;
104
+ [INTERNAL_EVENT.RENDER]: undefined;
105
+ [INTERNAL_EVENT.RENDER_NOW]: undefined;
106
+ [INTERNAL_EVENT.UPDATE_FLIPPABLES]: undefined | boolean;
107
+ [INTERNAL_EVENT.SET_MAP]: undefined;
93
108
  [INTERNAL_EVENT.CAMERA_MOVING]: any;
94
109
  [INTERNAL_EVENT.SET_BLUE_DOT_SIZE_FROM_ZOOM]: number;
95
110
  [INTERNAL_EVENT.PUBLISH_BLUE_DOT]: undefined;
@@ -1202,6 +1217,12 @@ declare module '@mappedin/mappedin-js/renderer/MapView.types' {
1202
1217
  * Will be empty if no interactive polygons were clicked.
1203
1218
  */
1204
1219
  polygons: MappedinPolygon[];
1220
+ /**
1221
+ * A list of {@link MappedinMap}s corresponding to every map that a user's
1222
+ * click passed through. These are in order of first to last intersected.
1223
+ * Will be empty if no maps were clicked.
1224
+ */
1225
+ maps: MappedinMap[];
1205
1226
  /**
1206
1227
  * Indicates whether the user clicked close to the Blue Dot object on the
1207
1228
  * map, if present. If Blue Dot is disabled, this will always be false.
@@ -3696,6 +3717,8 @@ declare module '@mappedin/mappedin-js/renderer/Core.interface' {
3696
3717
  import { INTERNAL_EVENT_PAYLOAD } from '@mappedin/mappedin-js/renderer/MapView';
3697
3718
  import { TPadding } from '@mappedin/mappedin-js/renderer';
3698
3719
  import Tween, { Easing } from '@tweenjs/tween.js';
3720
+ import { TaskScheduler } from '@mappedin/mappedin-js/get-venue/Mappedin.TaskScheduler';
3721
+ import SceneManager from '@mappedin/mappedin-js/renderer/MapView.SceneManager';
3699
3722
  export type TFocusOptionsLegacy = {
3700
3723
  /**
3701
3724
  * An array of Nodes to focus in on
@@ -3746,10 +3769,14 @@ declare module '@mappedin/mappedin-js/renderer/Core.interface' {
3746
3769
  * @internal
3747
3770
  */
3748
3771
  currentScale: number;
3772
+ referenceMap: MappedinMap;
3773
+ taskScheduler: TaskScheduler;
3774
+ sceneManager: SceneManager;
3749
3775
  loadOptions?: TMapViewOptions['loadOptions'];
3750
3776
  imageFlippingEnabled: boolean;
3751
3777
  imageFlippingCache: any;
3752
3778
  cachedPadding: any;
3779
+ getCameraFrameForPoints: any;
3753
3780
  polygonMeshesById: any;
3754
3781
  textLabelsByPolygonId: any;
3755
3782
  renderer: any;
@@ -3847,7 +3874,7 @@ declare module '@mappedin/mappedin-js/renderer/Core.interface' {
3847
3874
  onMapClicked(position: {
3848
3875
  latitude: number;
3849
3876
  longitude: number;
3850
- }, polygons: string[], nearBlueDot: boolean): void;
3877
+ }, polygons: string[], maps: MappedinMap[], nearBlueDot: boolean): void;
3851
3878
  /**
3852
3879
  * This is called when an interactive Polygon is clicked on.
3853
3880
  * You will almost certainly want to replace this with your own function in your client app.
@@ -3931,8 +3958,7 @@ declare module '@mappedin/mappedin-js/renderer/internal/blue-dot-manager' {
3931
3958
  * @param [options.minRadius] The ring around the blue dot will only be drawn if `options.radius` is greater than or equal to this value, in metres. Must be >= 0.
3932
3959
  * @param [options.radiusUpdateInterval] The width of radius update steps, in metres. For example, if interval is 3 and assume `minRadius` is 8, then the radius will be updated on 8, 11, 14, 17, etc. Must be >= 0.
3933
3960
  */
3934
- constructor({ mapManager, mapView, threeDMarkerLayer, core, minRadius, maxRadius, radiusUpdateInterval, radiusTweenOptions }?: {
3935
- mapManager: any;
3961
+ constructor({ mapView, threeDMarkerLayer, core, minRadius, maxRadius, radiusUpdateInterval, radiusTweenOptions }?: {
3936
3962
  mapView: any;
3937
3963
  threeDMarkerLayer: any;
3938
3964
  core: any;
@@ -3944,7 +3970,6 @@ declare module '@mappedin/mappedin-js/renderer/internal/blue-dot-manager' {
3944
3970
  easing: any;
3945
3971
  } | undefined;
3946
3972
  });
3947
- mapManager: any;
3948
3973
  mapView: any;
3949
3974
  threeDMarkerLayer: any;
3950
3975
  core: any;
@@ -4620,6 +4645,7 @@ declare module '@mappedin/mappedin-js/renderer/layers/EventSystem' {
4620
4645
  calculateMouseCoordinates: (event: any) => void;
4621
4646
  getMouseRayIntersects: (objects: Object3D | Object3D[]) => any;
4622
4647
  detectPolygonsUnderMouse: () => any[];
4648
+ detectMapsUnderMouse: () => any;
4623
4649
  getMouseMapPosition: () => {
4624
4650
  x: number;
4625
4651
  y: number;
@@ -4640,6 +4666,7 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.Journey' {
4640
4666
  import { MappedinDirections } from '@mappedin/mappedin-js/get-venue';
4641
4667
  import { TJourneyOptions } from '@mappedin/mappedin-js/renderer/MapView.types';
4642
4668
  import { MapView } from '@mappedin/mappedin-js/renderer';
4669
+ import { ICore } from '@mappedin/mappedin-js/renderer/Core.interface';
4643
4670
  export type TMappedinDirections = {
4644
4671
  distance: number;
4645
4672
  path: INode[];
@@ -4659,7 +4686,7 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.Journey' {
4659
4686
  accessible: boolean;
4660
4687
  get isMultiFloor(): boolean;
4661
4688
  get mapIdsInvolvedInJourney(): string[];
4662
- constructor(directions: MappedinDirections | MappedinDirections[], options: TJourneyOptions | undefined, mapView: MapView, mapManager: any);
4689
+ constructor(directions: MappedinDirections | MappedinDirections[], options: TJourneyOptions | undefined, mapView: MapView, core: ICore);
4663
4690
  setStep: (step: any) => void;
4664
4691
  static instance: Journey | null;
4665
4692
  static create(directions: MappedinDirections | MappedinDirections[], options: any, mapView: MapView, mapManager: any): Journey;
@@ -5066,6 +5093,570 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.RenderTasks' {
5066
5093
  }
5067
5094
  }
5068
5095
 
5096
+ declare module '@mappedin/mappedin-js/get-venue/Mappedin.TaskScheduler' {
5097
+ /**
5098
+ * A function that can be submitted to the Task Scheduler to run each frame for
5099
+ * some provided number of frames. A single update can be repeatedly submitted;
5100
+ * if the number of frames left on the update is less than `frameCount`, it will
5101
+ * be reset to `frameCount`.
5102
+ *
5103
+ * @class FrameUpdate
5104
+ * @private
5105
+ */
5106
+ export class FrameUpdate {
5107
+ /**
5108
+ * Create a new frame update that can be submitted to a scheduler.
5109
+ * @constructor
5110
+ * @param [options] {Object} Options for the update
5111
+ * @param [options.callback] {function}
5112
+ * The actual function to run every time this update is scheduled for
5113
+ * a frame.
5114
+ * @param [options.frameCount=1] {number}
5115
+ * How many frames this update should run for when it's submitted to
5116
+ * a scheduler
5117
+ * @param [options.ordering=0] {number}
5118
+ * An ordering value that's used to determine the order in which
5119
+ * frame updates will be run within a frame; larger numbers will
5120
+ * be run first
5121
+ * @param [options.supersededBy=[]] {[FrameUpdate]}
5122
+ * If this update is scheduled to run in a frame, but another update in
5123
+ * the provided list is also scheduled to run on that frame, then
5124
+ * this update will not be run.
5125
+ * @param [options.name=undefined] {string}
5126
+ * If provided, an arbitrary name for logging purposes.
5127
+ * @param [options.userdata] {Any}
5128
+ * Arbitrary data that you can store along with this update.
5129
+ */
5130
+ constructor(options: {
5131
+ callback: Function;
5132
+ frameCount?: number;
5133
+ ordering?: number;
5134
+ supersededBy?: Set<never>;
5135
+ name: string;
5136
+ userdata?: Record<string, any>;
5137
+ });
5138
+ _callback: Function;
5139
+ _frameCount: number;
5140
+ _ordering: number;
5141
+ _supersededBy: Set<never>;
5142
+ name: string;
5143
+ _remainingFrameCount: number;
5144
+ _lastFrameTime: number;
5145
+ userdata?: Record<string, any>;
5146
+ /**
5147
+ * Return the amount of time that this frame update took to execute during
5148
+ * its most recent execution, in milliseconds. If called during this frame
5149
+ * update, the value returned will be for the previous invocation. If called
5150
+ * before this frame update has been executed at least once, the returned
5151
+ * value is unspecified.
5152
+ *
5153
+ * @method lastFrameTime
5154
+ * @return {number} the previous frame time, in milliseconds
5155
+ */
5156
+ getLastFrameTime(): number;
5157
+ }
5158
+ /**
5159
+ * A task that can be submitted to the Task Scheduler to be run every time
5160
+ * there is a frame update with spare time in the frame.
5161
+ *
5162
+ * @class FrameTask
5163
+ * @private
5164
+ */
5165
+ export class FrameTask {
5166
+ /**
5167
+ * Create a new frame task that can be submitted to a scheduler.
5168
+ * @constructor
5169
+ * @param [options] {Object} Options for the task
5170
+ * @param [options.callback] {function}
5171
+ * The actual function to run when this task is scheduled.
5172
+ * @param [options.group=null] {FrameTaskGroup}
5173
+ * If provided, a group to which this task will be added when scheduled
5174
+ * @param [options.priority=0] {number}
5175
+ * Tasks with higher priority will be taken from the queue before tasks
5176
+ * with a lower priority.
5177
+ * @param [options.postponeOnAdd=false] {number}
5178
+ * If true, this task will not be run until `resumeTask` is called on the
5179
+ * scheduler.
5180
+ * @param [options.name=undefined] {string}
5181
+ * If provided, an arbitrary name for logging purposes.
5182
+ * @param [options.userdata] {Any}
5183
+ * Arbitrary data that you can store along with this task.
5184
+ */
5185
+ constructor(options: {
5186
+ userdata: Record<string, any>;
5187
+ priority: number;
5188
+ group?: FrameTaskGroup;
5189
+ postponeOnAdd: number | boolean;
5190
+ name: string;
5191
+ lastFrameTime: number;
5192
+ callback: Function;
5193
+ });
5194
+ _postponed: number | boolean;
5195
+ userdata: Record<string, any>;
5196
+ _priority: number;
5197
+ _group: FrameTaskGroup | null;
5198
+ name: string;
5199
+ _lastFrameTime: number;
5200
+ _callback: Function;
5201
+ _complete: boolean;
5202
+ _scheduled: boolean;
5203
+ _cancelled: boolean;
5204
+ /**
5205
+ * Return true if this task has been run at least once.
5206
+ *
5207
+ * @method isComplete
5208
+ * @return {boolean}
5209
+ */
5210
+ isComplete(): boolean;
5211
+ /**
5212
+ * Return the amount of time that this frame task took to execute,
5213
+ * in milliseconds. If this task has not yet completed, the returned value
5214
+ * is unspecified.
5215
+ *
5216
+ * @method lastFrameTime
5217
+ * @return {number} the frame time, in milliseconds
5218
+ */
5219
+ getLastFrameTime(): number;
5220
+ }
5221
+ /**
5222
+ * A group of tasks that must all be completed before the group is considered
5223
+ * complete. The tasks will be automatically garbage collected so that references
5224
+ * to the task don't linger.
5225
+ *
5226
+ * @class FrameTaskGroup
5227
+ * @private
5228
+ */
5229
+ export class FrameTaskGroup {
5230
+ /**
5231
+ * Create a new frame task group.
5232
+ *
5233
+ * @constructor
5234
+ * @param [options] {Object} Options for the task group
5235
+ * @param [options.onComplete] {function}
5236
+ * A callback that will be triggered once every task in this group
5237
+ * has been completed. This callback may schedule a task, and the
5238
+ * scheduler will run that task in the same frame, if there is still
5239
+ * frame time for it.
5240
+ * @param [options.priority=0] {number}
5241
+ * The priority of all the tasks in this group.
5242
+ * @param [options.postponeOnAdd=false] {number}
5243
+ * If true, tasks from this task group will not be run until `resumeTask`
5244
+ * is called on the scheduler with this group.
5245
+ * @param [options.name=undefined] {string}
5246
+ * If provided, an arbitrary name for logging purposes.
5247
+ * @param [options.userdata] {Any}
5248
+ * Arbitrary data that you can store along with this task group.
5249
+ */
5250
+ constructor(options: {
5251
+ onComplete?: Function;
5252
+ priority?: number;
5253
+ userdata: Record<string, any>;
5254
+ postponeOnAdd: number | boolean;
5255
+ name: string;
5256
+ });
5257
+ _postponed: number | boolean;
5258
+ _onComplete: Function;
5259
+ _priority: number;
5260
+ userdata: Record<string, any>;
5261
+ name: string;
5262
+ _tasks: Set<any>;
5263
+ _scheduledTasks: Set<any>;
5264
+ _scheduled: boolean;
5265
+ _cancelled: boolean;
5266
+ /**
5267
+ * Return true if every task in this group has been run at least once.
5268
+ * @method isComplete
5269
+ * @return {boolean}
5270
+ */
5271
+ isComplete(): boolean;
5272
+ /**
5273
+ * Return a list of tasks in this group. This will be a copy of the
5274
+ * underlying task group, so it's safe to mutate the group while
5275
+ * iterating over this array.
5276
+ *
5277
+ * @method tasks
5278
+ * @return {[FrameTask]} list of tasks in this group
5279
+ */
5280
+ getTasks(): any[];
5281
+ /**
5282
+ * Empty this task group. This will trivially satisfy `isComplete`.
5283
+ *
5284
+ * @method clear
5285
+ */
5286
+ clear(): void;
5287
+ /**
5288
+ * Return one arbitrary incomplete task from this group, or undefined if
5289
+ * there are none.
5290
+ *
5291
+ * @method _popTask
5292
+ * @return {FrameTask} arbitrary scheduled task
5293
+ * @private
5294
+ */
5295
+ _popTask(): any;
5296
+ }
5297
+ /**
5298
+ * A timer for the task scheduler that uses real wall-time to determine if there's
5299
+ * enough remaining time in a frame to execute another task.
5300
+ *
5301
+ * @class RealTimeTimer
5302
+ * @private
5303
+ */
5304
+ export class RealTimeTimer {
5305
+ _maxMillisecondsPerFrame: number;
5306
+ _time: number;
5307
+ /**
5308
+ * @constructor
5309
+ * @param [options] {Object} Options for the timer
5310
+ * @param [options.maxMillisecondsPerFrame]
5311
+ * If the time since the beginning of the frame has been less than
5312
+ * or equal to this value, then another task may be executed
5313
+ */
5314
+ constructor(options?: {
5315
+ maxMillisecondsPerFrame?: number;
5316
+ });
5317
+ /**
5318
+ * Begin timing a frame.
5319
+ *
5320
+ * @method beginFrame
5321
+ */
5322
+ beginFrame(): void;
5323
+ /**
5324
+ * If true, there is enough time remaining to execute another task.
5325
+ *
5326
+ * @method hasTimeRemaining
5327
+ * @return {boolean}
5328
+ */
5329
+ hasTimeRemaining(): boolean;
5330
+ }
5331
+ /**
5332
+ * A timer that ticks every time `hasTimeRemaining` is called.
5333
+ *
5334
+ * @class FixedTimer
5335
+ * @private
5336
+ */
5337
+ export class FixedTimer {
5338
+ _ticks: number;
5339
+ maxTasksPerFrame: number;
5340
+ /**
5341
+ * @constructor
5342
+ * @param [options] {Object} Options for the timer
5343
+ * @param [options.maxTasksPerFrame=5]
5344
+ * The number of tasks that will be exceuted in a single update call.
5345
+ * Can be modified as the `maxTasksPerFrame` property on this boject.
5346
+ */
5347
+ constructor(options?: {
5348
+ maxTasksPerFrame?: number;
5349
+ });
5350
+ /**
5351
+ * Begin timing a frame.
5352
+ *
5353
+ * @method beginFrame
5354
+ */
5355
+ beginFrame(): void;
5356
+ /**
5357
+ * If true, there is enough time remaining to execute another task.
5358
+ *
5359
+ * @method hasTimeRemaining
5360
+ * @return {boolean}
5361
+ */
5362
+ hasTimeRemaining(): boolean;
5363
+ }
5364
+ /**
5365
+ * A class that handles scheduling tasks to be performed within the time
5366
+ * constraints of frame updates, triggered using `requestAnimationFrame`.
5367
+ *
5368
+ * Tasks can either be scheduled once per frame (called "frame updates"), or
5369
+ * to execute as many times per frame as there is room for after processing
5370
+ * all frame updates (called "frame tasks").
5371
+ *
5372
+ * Posted tasks will always run during the same frame, assuming there's time to
5373
+ * process them. However, an update or task that posts an update will not run
5374
+ * that update until the next frame.
5375
+ *
5376
+ * @class TaskScheduler
5377
+ * @private
5378
+ */
5379
+ export class TaskScheduler {
5380
+ /**
5381
+ * Construct a new `TaskScheduler` with no tasks scheduled.
5382
+ *
5383
+ * @constructor
5384
+ * @param [options] {Object} Options for the scheduler
5385
+ * @param [options.timer=new RealTimeTimer()]
5386
+ * Timer that determines whether there is sufficient time left in a frame
5387
+ * to continue executing tasks
5388
+ * @param [options.performance=false]
5389
+ * If true, this task scheduler will annotate tasks and frame updates with
5390
+ * performance information.
5391
+ */
5392
+ constructor(options?: {
5393
+ timer?: RealTimeTimer;
5394
+ performance?: boolean;
5395
+ });
5396
+ _raf?: (callback: FrameRequestCallback) => number;
5397
+ _timer: RealTimeTimer;
5398
+ _performance: boolean;
5399
+ _scheduledUpdatesByOrdering: Multimap;
5400
+ _scheduledTasksByPriority: Multimap;
5401
+ _postponedTasks: Set<any>;
5402
+ _requestAnimationFrameHandle: number | null;
5403
+ _updatesToRunThisFrame: any[];
5404
+ _lastFrameTime: number;
5405
+ _updatesRunLastFrame: Set<any>;
5406
+ /**
5407
+ * Empty the task scheduler's queue. All tasks in it will be cancelled.
5408
+ *
5409
+ * @method clear
5410
+ */
5411
+ clear(): void;
5412
+ /**
5413
+ * Destroy this task scheduler and remove all tasks from it.
5414
+ *
5415
+ * @method destroy
5416
+ */
5417
+ destroy(): void;
5418
+ /**
5419
+ * Schedule this task scheduler to execute updates and tasks on the next
5420
+ * available animation frame.
5421
+ *
5422
+ * @method requestAnimationFrame
5423
+ */
5424
+ requestAnimationFrame(): void;
5425
+ /**
5426
+ * Run all scheduled updates, and re-schedule another animation frame if any
5427
+ * scheduled updates still exist. If any scheduled update specifies
5428
+ * `shouldRunTasksAfterCompletion`, this will also run queued tasks until the
5429
+ * frame time runs out.
5430
+ *
5431
+ * @method update
5432
+ * @param timestamp {number} the current animation time, as returned from
5433
+ * `performance.now()`; will be automatically filled in by
5434
+ * `requestAnimationFrame` when it triggers this as a callback
5435
+ */
5436
+ update(timestamp: number): void;
5437
+ /**
5438
+ * Execute all tasks that are currently pending, without regard for the
5439
+ * available frame time.
5440
+ *
5441
+ * @method flushTasks
5442
+ */
5443
+ flushTasks(): void;
5444
+ /**
5445
+ * Return the amount of time elapsed during the last completed frame update,
5446
+ * in milliseconds. This value is unspecified if the task scheduler's
5447
+ * `update` method has not yet run or if the scheduler has been cleared.
5448
+ * If called during a frame update, this will
5449
+ * return the time elapsed during the previous frame update.
5450
+ *
5451
+ * @method lastFrameTime
5452
+ * @return {number} time elapsed during last frame update, in milliseconds
5453
+ */
5454
+ getLastFrameTime(): number;
5455
+ /**
5456
+ * Return a set containing every update that was run during the previous
5457
+ * frame update. This will be empty if the task scheduler's `update` method
5458
+ * has not yet been run or if the scheduler has been cleared.
5459
+ */
5460
+ getUpdatesRunLastFrame(): Set<any>;
5461
+ _executeOneTask(timestamp: number): void;
5462
+ /**
5463
+ * Schedule an update to be run for the next `update.frameCount` frames. If
5464
+ * the update already exists in the scheduler, the update's frame count will
5465
+ * be refreshed to `update.frameCount`. This will also schedule an animation
5466
+ * frame to begin processing the update.
5467
+ *
5468
+ * @method scheduleUpdate
5469
+ * @param task {FrameUpdate} the update to schedule
5470
+ */
5471
+ scheduleUpdate(update: FrameUpdate): void;
5472
+ /**
5473
+ * Schedule a task to be run during a frame update. This will also schedule
5474
+ * an animation frame to begin processing the task queue.
5475
+ *
5476
+ * @method scheduleTask
5477
+ * @param task {FrameTask} the task to schedule
5478
+ */
5479
+ scheduleTask(task: FrameTask): void;
5480
+ /**
5481
+ * If the given update is in the queue, remove it.
5482
+ *
5483
+ * @method cancelUpdate
5484
+ * @param task {FrameUpdate} the update to cancel
5485
+ */
5486
+ cancelUpdate(update: FrameUpdate): void;
5487
+ /**
5488
+ * If the given task or group is in the queue, remove it. Cancelling a
5489
+ * completed task is a no-op.
5490
+ *
5491
+ * Canceling an individual task will also remove it from its task group, if
5492
+ * it isn't already complete.
5493
+ *
5494
+ * @method cancelTask
5495
+ * @param task {FrameTask or FrameTaskGroup} the task to cancel
5496
+ */
5497
+ cancelTask(task: FrameTask | FrameTaskGroup): void;
5498
+ /**
5499
+ * Set the provided task or group not to run, until it's resumed using `resumeTask`.
5500
+ *
5501
+ * Tasks that are in a group can't be postponed individually; instead, call
5502
+ * `postponeTask` with the entire group.
5503
+ *
5504
+ * @method postponeTask
5505
+ * @param task {FrameTask or FrameTaskGroup} the task to postpone
5506
+ */
5507
+ postponeTask(task: FrameTask | FrameTaskGroup): void;
5508
+ /**
5509
+ * Allow a postponed task or task group to resume processing. This will also
5510
+ * request an animation frame to allow the resumed task to be processed.
5511
+ *
5512
+ * Tasks that are in a group can't be resumed individually; instead, call
5513
+ * `resumeTask` with the entire group.
5514
+ *
5515
+ * @method resumeTask
5516
+ * @param task {FrameTask or FrameTaskGroup} the task to resume
5517
+ */
5518
+ resumeTask(task: FrameTask | FrameTaskGroup): void;
5519
+ /**
5520
+ * Change the priority of the given scheduled task or task group.
5521
+ *
5522
+ * @method setTaskPriority
5523
+ * @param task {FrameTask or FrameTaskGroup} the task whose priority will be changed
5524
+ * @param priority {number} the priority to assign the task
5525
+ */
5526
+ setTaskPriority(task: FrameTask | FrameTaskGroup, priority: number): void;
5527
+ }
5528
+ /**
5529
+ * A map that maps a numeric key to a set of values.
5530
+ *
5531
+ * For use in the scheduler, we also maintain a sorted list of keys.
5532
+ *
5533
+ * @class Multimap
5534
+ * @private
5535
+ */
5536
+ class Multimap {
5537
+ /**
5538
+ * @method constructor
5539
+ */
5540
+ constructor();
5541
+ _map: Map<any, any>;
5542
+ _size: number;
5543
+ _sortedKeys: any[];
5544
+ /**
5545
+ * Return true if the set for the given key contains the provided value.
5546
+ *
5547
+ * @method has
5548
+ * @param key {number} the key whose set to check
5549
+ * @param value {Any} the value to check
5550
+ */
5551
+ has(key: number, value: any): any;
5552
+ /**
5553
+ * Return the list of elements at the given key. Make sure not to modify
5554
+ * it, as it will mess up the total element count.
5555
+ *
5556
+ * @method get
5557
+ * @param key {number}
5558
+ * @param value {Set(Any)}
5559
+ */
5560
+ get(key: number): any;
5561
+ /**
5562
+ * @method insert
5563
+ * @param key {number} the key to which another value will be added
5564
+ * @param value {Any} the value to add to the key's set
5565
+ */
5566
+ insert(key: number, value: any): void;
5567
+ /**
5568
+ * @method delete
5569
+ * @param key {number} the key at which the value is stored
5570
+ * @param value {Any} the value to delete
5571
+ */
5572
+ delete(key: number, value: any): void;
5573
+ /**
5574
+ * Remove and return an arbitrary value from the set at the given key.
5575
+ *
5576
+ * @method pop
5577
+ * @param key {number} the key from which to remove a value
5578
+ * @return {Any} arbitrary value from the given key's set, or undefined if
5579
+ * the set at the given key is empty.
5580
+ */
5581
+ pop(key: number): any;
5582
+ /**
5583
+ * Remove and return an arbitrary value from the set corresponding to
5584
+ * the key with the highest numeric value, using the javascript `<`
5585
+ * operator.
5586
+ *
5587
+ * @method popFromMaxKey
5588
+ * @return {Any} arbitrary value from the highest key's set, or undefined
5589
+ * if the map is empty
5590
+ */
5591
+ popFromMaxKey(): any;
5592
+ /**
5593
+ * Return an iterator over every value in this multimap, at every key.
5594
+ * Mutating the multimap during iteration will result in undefined
5595
+ * behaviour.
5596
+ *
5597
+ * @method values
5598
+ * @return {Iterator} iterator over the values in the map
5599
+ */
5600
+ values(): {
5601
+ [Symbol.iterator]: () => any;
5602
+ next: () => any;
5603
+ };
5604
+ /**
5605
+ * A list of keys in this set, sorted by numeric value. Not cloned,
5606
+ * for efficiency's sake, so please don't mutate it.
5607
+ *
5608
+ * @method keys
5609
+ * @return {[number]} sorted list of numeric keys in the map
5610
+ */
5611
+ keys(): any[];
5612
+ /**
5613
+ * The number of elements in this multimap, equal to the sum of the sizes
5614
+ * of each key's set of values.
5615
+ *
5616
+ * @property size {number} number of elements in this multimap
5617
+ */
5618
+ get size(): number;
5619
+ }
5620
+ export {};
5621
+ }
5622
+
5623
+ declare module '@mappedin/mappedin-js/renderer/MapView.SceneManager' {
5624
+ import { MappedinMap } from '@mappedin/mappedin-js/get-venue';
5625
+ import { TCameraTransform, TCameraAnimationOptions } from '@mappedin/mappedin-js/renderer/Camera';
5626
+ import { ICore } from '@mappedin/mappedin-js/renderer/Core.interface';
5627
+ import MapViewScene from '@mappedin/mappedin-js/renderer/MapView.Scene';
5628
+ export type TSceneTransitionOptions = {
5629
+ /**
5630
+ * Map to set as active during the transition. This will decide where the camera will be positioned, as well as which
5631
+ * colliders are enabled.
5632
+ */
5633
+ activeMap?: MappedinMap;
5634
+ verticalDistanceBetweenMaps?: number;
5635
+ /**
5636
+ * Camera options to use when transitioning to the new scene
5637
+ */
5638
+ cameraTransform?: TCameraTransform;
5639
+ cameraAnimationOptions?: TCameraAnimationOptions;
5640
+ /**
5641
+ * Whether to auto focus on the active map or leave the camera where it is.
5642
+ * For single building venues, this should look the same way it did with MapManager
5643
+ * For multi-building venues, this means the camera will not pan over to where the active map
5644
+ * is relative to the world, which may look like broken behavior.
5645
+ * @default true
5646
+ */
5647
+ autoFocusOnActiveMap?: boolean;
5648
+ };
5649
+ class SceneManager {
5650
+ #private;
5651
+ currentScene: MapViewScene;
5652
+ constructor(core: ICore, startingScene: MapViewScene);
5653
+ get currentMap(): MappedinMap;
5654
+ renderGrid(): void;
5655
+ transitionTo(scene: MapViewScene, transitionOptions?: TSceneTransitionOptions): Promise<void>;
5656
+ }
5657
+ export default SceneManager;
5658
+ }
5659
+
5069
5660
  declare module '@mappedin/mappedin-js/renderer/internal/shave-text' {
5070
5661
  export type TDrawFn = (ctx: CanvasRenderingContext2D, x: number, y: number) => void;
5071
5662
  type TShave = (str: string, size: number, maxWidth: number, maxLines?: number, lineHeight?: number, options?: {
@@ -5108,6 +5699,7 @@ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.SmartCollisionE
5108
5699
  core: ICore;
5109
5700
  screen: Rectangle;
5110
5701
  constructor(mapView: any, core: ICore);
5702
+ beginUpdate(): void;
5111
5703
  init: (container: HTMLDivElement, projectFn: ({ position, mapId }: {
5112
5704
  position: any;
5113
5705
  mapId: MappedinMap['id'];
@@ -5335,3 +5927,217 @@ declare module '@mappedin/mappedin-js/renderer/index.rn' {
5335
5927
  export type { TSafeAreaInsets, TCameraTargets, TFocusOnCameraOptions, TCameraTransform, TCameraAnimationOptions } from '@mappedin/mappedin-js/renderer/Camera';
5336
5928
  }
5337
5929
 
5930
+ declare module '@mappedin/mappedin-js/renderer/MapView.Scene' {
5931
+ import { MappedinMap } from '@mappedin/mappedin-js/get-venue';
5932
+ import { ICore } from '@mappedin/mappedin-js/renderer/Core.interface';
5933
+ import MapObject from '@mappedin/mappedin-js/renderer/internal/Mappedin.MapObject';
5934
+ import { TSceneTransitionOptions } from '@mappedin/mappedin-js/renderer/MapView.SceneManager';
5935
+ class MapViewScene {
5936
+ #private;
5937
+ maps: MappedinMap[];
5938
+ object: any;
5939
+ currentMap: MappedinMap;
5940
+ mapObjects: Map<MappedinMap['id'], MapObject>;
5941
+ constructor(maps: MappedinMap[], core: ICore);
5942
+ /**
5943
+ * Determine each maps position and rotation relative to the refernce map
5944
+ */
5945
+ determineMapPositionAndRotation(map: MappedinMap): {
5946
+ position: any[];
5947
+ scale: number[];
5948
+ rotation: number[];
5949
+ };
5950
+ /** Render scene */
5951
+ render(map: MappedinMap, transitionOptions?: TSceneTransitionOptions, isStartingScene?: boolean): Promise<void>;
5952
+ }
5953
+ export default MapViewScene;
5954
+ }
5955
+
5956
+ declare module '@mappedin/mappedin-js/renderer/internal/Mappedin.MapObject' {
5957
+ export namespace TASK_PRIORITY {
5958
+ const VISIBLE_MAP_HIGH: number;
5959
+ const VISIBLE_MAP_LOW: number;
5960
+ const VISIBLE_MAP_MARKER: number;
5961
+ const ASYNC_MAP_HIGH: number;
5962
+ const ASYNC_MAP_LOW: number;
5963
+ const ASYNC_MAP_MARKER: number;
5964
+ const MAP_LOADED: number;
5965
+ }
5966
+ export const SCENE_FROM_LIVE_JSON: false;
5967
+ /**
5968
+ * A handle to a 3D marker added to a map.
5969
+ *
5970
+ * @class ThreeJSMarkerHandle
5971
+ */
5972
+ export class ThreeJSMarkerHandle {
5973
+ constructor({ mapId, object }: {
5974
+ mapId: any;
5975
+ object: any;
5976
+ });
5977
+ _mapId: any;
5978
+ _object: any;
5979
+ /**
5980
+ * Return the ThreeJS object associated with this marker, so that it
5981
+ * can be moved around, scaled, etc.
5982
+ *
5983
+ * @property {Object3D} object
5984
+ */
5985
+ get object(): any;
5986
+ _destroy(): void;
5987
+ }
5988
+ export default MapObject;
5989
+ class MapObject extends PubSub {
5990
+ constructor(mapClass: any, polygonMeshesById: any, showCount: any, core: any, loadOptions?: {});
5991
+ _flippableImagedById: {};
5992
+ _started: boolean;
5993
+ _loaderPromise: null;
5994
+ _promiseResolve: null;
5995
+ hoverableMeshChildren: any[];
5996
+ objectsDictionary: {};
5997
+ north: null;
5998
+ mapScale: null;
5999
+ object: any;
6000
+ labels: Set<any>;
6001
+ tooltips: Set<any>;
6002
+ markers: Set<any>;
6003
+ textObjects: any[];
6004
+ labelBatchCreator: null;
6005
+ imagesToFlip: any[];
6006
+ seenByCamera: boolean;
6007
+ threeJSMarkers: Map<any, any>;
6008
+ core: any;
6009
+ mapClass: any;
6010
+ polygonMeshesById: any;
6011
+ _showCount: any;
6012
+ loadMethod: string;
6013
+ loadAsync: any;
6014
+ _taskScheduler: any;
6015
+ id: any;
6016
+ mapRenderingStrategy: any;
6017
+ _highPriorityTasks: FrameTaskGroup;
6018
+ _lowPriorityTasks: FrameTaskGroup;
6019
+ _markerTasks: FrameTaskGroup;
6020
+ _mapLoadedTasks: FrameTaskGroup;
6021
+ _visibilityLatch: boolean | null;
6022
+ _objLoadedComplete: boolean;
6023
+ _objLoaded(object: any): any;
6024
+ _objLoadedMerged(object: any): Promise<any>;
6025
+ enableImageFlipping(polygonId: any, rotation: any): void;
6026
+ elements: any;
6027
+ boundingBox: {
6028
+ min: any;
6029
+ max: any;
6030
+ } | undefined;
6031
+ loadPolygonNow(polygonId: any): void;
6032
+ _addElementToScene(element: any): void;
6033
+ /** *
6034
+ Load the map, if it's not already loaded. Returns the old promise if it's already done, so you can safely call it whenever needed.
6035
+
6036
+ If needed, this could be modified to
6037
+
6038
+ Returns a Promise that will be Done when the OBJ, MTL and textures have been downloaded, and the objectsDictionary has been generated.
6039
+
6040
+ **/
6041
+ load(): null;
6042
+ loadMethodUsed: string | undefined;
6043
+ _dispose(objectToDispose: any): void;
6044
+ add(childObjectToAdd: any): void;
6045
+ getPositionLatLon(lat: any, lon: any): any;
6046
+ getMapScale(): null;
6047
+ getNorth(): null;
6048
+ disableAllImageFlipping(): void;
6049
+ get visible(): boolean;
6050
+ /**
6051
+ * Return true if this map has been loaded to the point where it can be
6052
+ * manipulated as a complete object. In synchronous mode, this requires all
6053
+ * loading tasks to be completed, but in async mode, only high-priority
6054
+ * tasks (adding polygons to the world) have to be completed.
6055
+ */
6056
+ isReady(): boolean;
6057
+ /**
6058
+ * Return true if this map has been loaded to the point where the only tasks
6059
+ * remaining are marker tasks.
6060
+ */
6061
+ isFullyLoaded(): boolean;
6062
+ /**
6063
+ * A function that should be called when the map is made visible, in order
6064
+ * to kick off its tasks.
6065
+ */
6066
+ onVisible(): void;
6067
+ /**
6068
+ * A function that should be called when the map is made invisible, in order
6069
+ * to postpone its tasks.
6070
+ */
6071
+ onInvisible(): void;
6072
+ /**
6073
+ * Queue a task on this map that will be executed when the high and low
6074
+ * priority tasks have been processed.
6075
+ */
6076
+ addPendingMarkerTask(marker: any, callback: any): void;
6077
+ /**
6078
+ * Queue a task on this map that must be completed before the map will be
6079
+ * considered `isReady` in synchronous loading mode.
6080
+ */
6081
+ addPendingLowPriorityTask(name: any, callback: any): void;
6082
+ /**
6083
+ * Queue a task on this map that will be queued when the map is loaded, or
6084
+ * immediately if the map has already been loaded.
6085
+ */
6086
+ addPendingMapLoadedTask(name: any, callback: any): void;
6087
+ /**
6088
+ * Queue a task on this map that must be completed before the map will be
6089
+ * considered `isReady`, and will be evaluated before any low-priority
6090
+ * tasks.
6091
+ */
6092
+ _addPendingHighPriorityTask(name: any, callback: any): void;
6093
+ /**
6094
+ * Add a ThreeJS marker to this map object. This should be called through
6095
+ * the `MapView3D`.
6096
+ *
6097
+ * @method addThreeJSMarker
6098
+ * @param {Object} options
6099
+ * @param {Object3D} [options.object] the marker object to add to the scene
6100
+ * @param {Vector3} [options.position=null] if provided, sets the object's position on the map
6101
+ * @param {Euler} [options.rotation=null] if provided, sets the object's rotation relative to the map
6102
+ * @param {Vector3} [options.scale=null] if provided, sets the object's scale relative to the map
6103
+ * @return {ThreeJSMarkerHandle} a unique identifier for the marker
6104
+ */
6105
+ addThreeJSMarker(options: {
6106
+ object?: any;
6107
+ position?: any;
6108
+ rotation?: any;
6109
+ scale?: any;
6110
+ }): ThreeJSMarkerHandle;
6111
+ /**
6112
+ * Remove the given `ThreeJSMarker` from this map.
6113
+ *
6114
+ * @method removeThreeJSMarker
6115
+ * @param {ThreeJSMarkerHandle} markerHandle the marker to remove
6116
+ * @return {boolean} true if the marker existed on the map and was removed;
6117
+ * false if the marker does not exist on the map
6118
+ */
6119
+ removeThreeJSMarker(markerHandle: ThreeJSMarkerHandle): boolean;
6120
+ /**
6121
+ * Remove all `ThreeJSMarker` from this map.
6122
+ *
6123
+ * @method removeThreeJSMarker
6124
+ */
6125
+ _removeThreeJSMarkers(): void;
6126
+ removeLabels(): void;
6127
+ /**
6128
+ * Called when a task group that may be required for map loading completes,
6129
+ * to see if all the relevant task groups have been completed.
6130
+ */
6131
+ _checkIfLoaded(): void;
6132
+ mapLoaded: any;
6133
+ /**
6134
+ * Called when the root ThreeJS object has been created, and child elements
6135
+ * may be added.
6136
+ */
6137
+ _onRootObjectCreated(): void;
6138
+ _popinChildObjects(): void;
6139
+ }
6140
+ import { PubSub } from "@mappedin/mappedin-js/renderer/internal/pub-sub";
6141
+ import { FrameTaskGroup } from "@mappedin/mappedin-js/get-venue/Mappedin.TaskScheduler";
6142
+ }
6143
+