architwin 1.0.53 → 1.0.60

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.
Files changed (46) hide show
  1. package/README.md +2334 -526
  2. package/lib/architwin.d.ts +44 -15
  3. package/lib/architwin.js +1 -1
  4. package/lib/color.d.ts +10 -0
  5. package/lib/color.js +117 -0
  6. package/lib/convert.d.ts +11 -0
  7. package/lib/convert.js +29 -0
  8. package/lib/loaders/planeGeometry.d.ts +31 -1
  9. package/lib/loaders/planeGeometry.js +454 -23
  10. package/lib/tag.d.ts +1 -0
  11. package/lib/tag.js +62 -23
  12. package/lib/types.d.ts +56 -0
  13. package/lib/types.js +11 -0
  14. package/package.json +4 -3
  15. package/post_deploy.sh +50 -0
  16. package/static/13-01_danger_electricity.png +0 -0
  17. package/static/colors/BLUE.png +0 -0
  18. package/static/colors/BLUE_GREEN.png +0 -0
  19. package/static/colors/DARK_BLUE.png +0 -0
  20. package/static/colors/DARK_RED.png +0 -0
  21. package/static/colors/GREEN.png +0 -0
  22. package/static/colors/GREY.png +0 -0
  23. package/static/colors/HOT_GREEN.png +0 -0
  24. package/static/colors/LIGHT_BLUE.png +0 -0
  25. package/static/colors/LIGHT_GREY.png +0 -0
  26. package/static/colors/LIGHT_ORANGE.png +0 -0
  27. package/static/colors/LIGHT_PINK.png +0 -0
  28. package/static/colors/LIGHT_YELLOW.png +0 -0
  29. package/static/colors/MAGENTA.png +0 -0
  30. package/static/colors/MAROON.png +0 -0
  31. package/static/colors/NAVY_BLUE.png +0 -0
  32. package/static/colors/ORANGE.png +0 -0
  33. package/static/colors/ORANGE_YELLOW.png +0 -0
  34. package/static/colors/PALE_RED.png +0 -0
  35. package/static/colors/PURPLE.png +0 -0
  36. package/static/colors/RED.png +0 -0
  37. package/static/colors/RED_ORANGE.png +0 -0
  38. package/static/colors/ROYAL_PURPLE.png +0 -0
  39. package/static/colors/TEAL.png +0 -0
  40. package/static/colors/YELLOW.png +0 -0
  41. package/static/colors/YELLOW_GREEN.png +0 -0
  42. package/static/mutedicon.png +0 -0
  43. package/static/nexticon.png +0 -0
  44. package/static/pauseicon.png +0 -0
  45. package/static/previousicon.png +0 -0
  46. package/static/unmutedicon.png +0 -0
package/README.md CHANGED
@@ -13,17 +13,14 @@ ArchiTwin Library
13
13
  - [Import the library](#import-the-library)
14
14
  - [Setup your proxy](#setup-your-proxy)
15
15
  - [Connect to a Space](#connect-to-a-space)
16
- - [Connection Parameters](#connection-parameters)
17
- - [Config Options](#config-options)
18
- - [Minimap Config](#minimap-config)
19
- - [Space Navigation and Camera Control](#space-navigation-and-camera-control)
20
- - [Moving Around](#moving-around)
21
- - [Rotate, Pan and Tilt Camera](#rotate-pan-and-tilt-camera)
16
+ - [Executing methods on specific App Phases](#executing-methods-on-specific-app-phases)
22
17
  - [Space Overview](#space-overview)
18
+ - [Subscribing to Space Events](#subscribing-to-space-events)
19
+ - [Subscribing a method to an event](#subscribing-a-method-to-an-event)
20
+ - [Subscribing multiple methods to an event](#subscribing-multiple-methods-to-an-event)
21
+ - [Unsubscribing a method from an event](#unsubscribing-a-method-from-an-event)
22
+ - [Creating Custom Events](#creating-custom-events)
23
23
  - [Points of Interest](#points-of-interest)
24
- - [Loading and Interacting with 3D/2D Objects](#loading-and-interacting-with-3d2d-objects)
25
- - [What is an Object?](#what-is-an-object)
26
- - [Loading Objects](#loading-objects)
27
24
  - [Accessing List of Rendered Objects and Object Structure](#accessing-list-of-rendered-objects-and-object-structure)
28
25
  - [Transforming Objects](#transforming-objects)
29
26
  - [Transforming Object by clicking it](#transforming-object-by-clicking-it)
@@ -38,20 +35,90 @@ ArchiTwin Library
38
35
  - [Setting Animation Control in the Space](#setting-animation-control-in-the-space)
39
36
  - [Copying object To Your Space](#copying-object-to-your-space)
40
37
  - [Adding Object, Getting Object, Updating Object, Deleting Object in the Database](#adding-object-getting-object-updating-object-deleting-object-in-the-database)
38
+ - [Navigate to Object](#navigate-to-object)
41
39
  - [Deleting Object To Your Space](#deleting-object-to-your-space)
42
40
  - [Replacing Object To Your Space](#replacing-object-to-your-space)
43
41
  - [Creating Text Markup Screen in the space](#creating-text-markup-screen-in-the-space)
44
42
  - [Setting Content to Text Markup Screen](#setting-content-to-text-markup-screen)
43
+ - [Typescript Interface Reference](#typescript-interface-reference)
44
+ - [Tag Interfaces](#tag-interfaces)
45
+ - [Object Interfaces](#object-interfaces)
46
+ - [Meeting Interfaces](#meeting-interfaces)
47
+ - [Meeting Guide](#meeting-guide)
48
+ - [Create Meeting](#create-meeting)
49
+ - [Start Meeting](#start-meeting)
50
+ - [Stop Meeting](#stop-meeting)
51
+ - [Meeting Utility Methods](#meeting-utility-methods)
52
+ - [Update Meeting Details](#update-meeting-details)
53
+ - [Meeting Info](#meeting-info)
54
+ - [Meeting Config Options](#meeting-config-options)
55
+ - [Meeting Custom Colors](#meeting-custom-colors)
56
+ - [Meeting Custom Avatar](#meeting-custom-avatar)
57
+ - [Meeting Device Control](#meeting-device-control)
58
+ - [Meeting Bar Position](#meeting-bar-position)
59
+ - [Meeting Status](#meeting-status)
45
60
  - [Function Reference](#function-reference)
46
- - [Tags](#tags)
61
+ - [Space](#space)
62
+ - [connectSpace()](#connectspace)
63
+ - [disconnectSpace()](#disconnectspace)
64
+ - [Tags](#tags)
65
+ - [getTags()](#gettags)
66
+ - [gotoTag()](#gototag)
47
67
  - [Sweeps](#sweeps)
68
+ - [getSweeps()](#getsweeps)
69
+ - [moveToSweep()](#movetosweep)
70
+ - [getNearbySweeps()](#getnearbysweeps)
71
+ - [getCurrentSweep()](#getcurrentsweep)
48
72
  - [Video](#video)
73
+ - [playVideo()](#playvideo)
74
+ - [pauseVideo()](#pausevideo)
75
+ - [setVideoPlayback()](#setvideoplayback)
49
76
  - [Navigation](#navigation)
77
+ - [moveInDirection()](#moveindirection)
50
78
  - [Camera](#camera)
79
+ - [getCurrentCameraPose()](#getcurrentcamerapose)
80
+ - [getCameraPosition()](#getcameraposition)
81
+ - [cameraPan()](#camerapan)
82
+ - [cameraRotate()](#camerarotate)
83
+ - [getViewMode()](#getviewmode)
84
+ - [setViewMode()](#setviewmode)
85
+ - [cameraLookAt()](#cameralookat)
86
+ - [captureSpaceScreenshot()](#capturespacescreenshot)
51
87
  - [Objects](#objects)
88
+ - [getNearbyObjects()](#getnearbyobjects)
89
+ - [addObjectToSpace()](#addobjecttospace)
90
+ - [addMediaScreen()](#addmediascreen)
91
+ - [setTransformMode()](#settransformmode)
92
+ - [revertTransform()](#reverttransform)
93
+ - [removeTransformControls()](#removetransformcontrols)
94
+ - [setAnimationState()](#setanimationstate)
95
+ - [showObjectDimensions()](#showobjectdimensions)
96
+ - [copyObject()](#copyobject)
97
+ - [addObject()](#addobject)
98
+ - [getObject()](#getobject)
99
+ - [updateObject()](#updateobject)
100
+ - [deleteObject()](#deleteobject)
101
+ - [goTo3dx()](#goto3dx)
102
+ - [deleteObjectFromSpace()](#deleteobjectfromspace)
103
+ - [replaceObject()](#replaceobject)
104
+ - [addTextMarkupScreen()](#addtextmarkupscreen)
105
+ - [setTextMarkupScreenContent()](#settextmarkupscreencontent)
106
+ - [Meeting](#meeting)
107
+ - [createMeeting()](#createmeeting)
108
+ - [startMeeting()](#startmeeting)
109
+ - [stopMeeting()](#stopmeeting)
110
+ - [getMeeting()](#getmeeting)
111
+ - [getMeetingParticipants()](#getmeetingparticipants)
112
+ - [getSpaceMeetings()](#getspacemeetings)
113
+ - [generateMeetingURL()](#generatemeetingurl)
114
+ - [isMeetingExists()](#ismeetingexists)
115
+ - [isMeetingActive()](#ismeetingactive)
116
+ - [updateMeetingTitle()](#updatemeetingtitle)
117
+ - [updateMeetingStart()](#updatemeetingstart)
118
+ - [updateMeetingStatus()](#updatemeetingstatus)
119
+ - [updateMeetingSpace()](#updatemeetingspace)
52
120
 
53
121
  ## Installation
54
- ---------------------
55
122
  ### Install Using NPM
56
123
  To install the latest ArchiTwin package:
57
124
  ````bash
@@ -59,7 +126,6 @@ npm i architwin
59
126
  ````
60
127
 
61
128
  ## Getting Started
62
- ------------------------
63
129
 
64
130
  #### Prerequisites
65
131
 
@@ -181,6 +247,7 @@ export default defineConfig(({ command, mode }) => {
181
247
 
182
248
  #### Connect to a Space
183
249
 
250
+ In order to connect to space you may use [connectSpace()](#connectspace) method.
184
251
  ````typescript
185
252
  <script lang="ts">
186
253
 
@@ -224,6 +291,44 @@ You should be able to move around the Space using keyboard and mouse.
224
291
 
225
292
  Or programmatically using methods defined in this library.
226
293
 
294
+ ## Executing methods on specific App Phases
295
+
296
+ Your application may need to execute certain methods during the initialization of your 3D space. For example, you may want to use`addObjectToSpace()` method to render a model to your 3D space the moment the 3D space becomes interactive. While you can always just invoke the function after the `connectSpace()` method there may be times where this will cause an error as the `connectSpace()` method which is an async method, may have not finished initializing the necessary internal variables that allow other methods to work properly. When you invoke the `connectSpace()` method, the library does some internal validation and then goes to several phases to render your 3D space and make it interactive. These phases are the following:
297
+
298
+ **ARCHTWIN APP PHASES**
299
+
300
+ - **LOADING:** Initial fetch request to matterport. This is where the bundle downloads the 3D space from matterport and starts rendering it
301
+ - **STARTING:** Matterport begins the transition to the start location
302
+ - **PLAYING** The 3D space is now ready for user interaction
303
+
304
+ You can also view the technical diagram of how this work below:
305
+
306
+ <img src="https://drive.google.com/uc?id=1I_NuuI_PWkRzB0DueCmBCBH-1V_upiOB" width="400" height="300" />
307
+
308
+ To invoke a function from your application during one of the phases. Simple pass the function name as a parameter in the `connectSpace()` method. Make sure to not add a parenthesis to your function name when you pass it as a parameter to avoid invoking the function prematurely.
309
+
310
+ *Example:*
311
+
312
+ ```typescript
313
+ //Your application side function
314
+ async function runThisOnPlayState(){
315
+ const tags = await axios.get('my-custom-endpoint')
316
+
317
+ //Keep in mind that you should map the data from your endpoint into an object structure that the library supports
318
+
319
+ await atwin.showTags(tags)
320
+ }
321
+
322
+ await atwin.connectSpace(spaceUrl, auth, config,{onPlay:runThisOnPlayState})
323
+ ```
324
+
325
+ In this example, the method named `runThisOnPlayState` is passed as a value to the `onPlay` key of an object. This will invoke the function during the PLAYING phase of the library. To invoke your function in a different phase, simply pass it to a different key in the object. You can pass your functions to onLoad,onStart, and onPlay. Async and synchronous functions are valid. Refer to the table below for more information
326
+
327
+ | parameter | type | required | default | values |
328
+ | :----: | :----: | :---: | :---: | :---: |
329
+ | onLoad | Function | no | none | async or non-async function|
330
+ | onStart | Function | no | none | async or non-async function|
331
+ | onPlay | Function | no | none | async or non-async function|
227
332
  <!-- #### Setup for other frameworks
228
333
 
229
334
  Vue is the framework we use in the code snippets provided above. If your team intends to use other frameworks like Svelte or React.
@@ -343,7 +448,7 @@ console.log('Hello console')
343
448
 
344
449
  Please take note that you **must** setup the appropriate proxy configuration as stated in [this section](#setup-your-proxy) otherwise it will not work. -->
345
450
 
346
- ## Connection Parameters
451
+ <!-- ## Connection Parameters
347
452
  connectSpace has three important parameters:
348
453
 
349
454
  | parameter | type | required | default | values |
@@ -370,9 +475,263 @@ await atwin.connectSpace(url, auth, config)
370
475
  - apiKey: (string) sets the required apiKey that is inserted into the authorization headers of each API request
371
476
  - user: (IUser | Object) an object that contains the `email` and `password` of the user.
372
477
 
373
- **config** - a config object to set some default space behavior. You can learn more about the config object and its keys by going to the [config options](#config-options) section
478
+ **config** - a config object to set some default space behavior. You can learn more about the config object and its keys by going to the [config options](#config-options) section -->
479
+
480
+ ## Space Overview
481
+
482
+ **Space** - Space is an immersive and realistic Digital Twin model of a physical space, with virtual custom objects like animated 3D objects, Video Screens, Slideshow Screens and Tags, co-existing and enhancing the real objects.
483
+
484
+ A user should be able to navigate around using PC or devices (keyboard and mouse), measure real object dimensions and interact with the virtual objects as if you are actually visiting the physical space.
485
+
486
+ **Sweeps** - Space have static sweep markers (white circles on floor) which serves as primary navigation points. Users can go to sweeps (or click), stand and look around.
487
+
488
+ **Tags** - Space also have tags which are virtual markers attached to Objects or Locations in space. Tags can be clicked which will render and display relevant contents like
489
+ web pages, videos, images or text descriptions. It is possible to go directly to any specifig tag ([gotoTag](#gototag)) from anywhere in Space.
490
+
491
+ It can be used as quick way to navigate around the space.
492
+
493
+ **3D Objects** - Space usually contains 3D objects or three-dimentional models. Some 3D objects may have some simple animations.
494
+
495
+ **Video Screens** - Another interesting objects that can be found inside the space are Video Screens. They practially look like TV
496
+ screens placed at selected locations. The Video screens will automatically play when a User is nearby (2 meters). And automatically turns off when the User leaves.
497
+
498
+
499
+ **Slideshow Screens** - Space can also contain Image Slideshow Screens. This is similar to the Video Screen, but uses static images.
500
+ Clicking on the right section of the current slide image will display the next slide.
501
+ Clicking on the the left section will display the previous slide.
502
+
503
+ The slideshow can be auto played in whole by clicking the lower-right corner.
504
+
505
+
506
+ **Note**: We use the word Space and Showcase interchangeably.
507
+
508
+ ## Subscribing to Space Events
509
+ Your 3D space allows your users to move around and interact with objects loaded into that space. Interactions such as clicking and dragging 3D objects in a space are events that your app may need to listen to and subsequently trigger the appropriate function for such an event.
510
+
511
+ You can subscribe to a particular event and pass callback method or methods to trigger when a subscribed event is fired using the `subscribeSpaceEvent()` method.
512
+
513
+ The method accepts the following as its parameters:
514
+ | parameter | type | required | default | values |
515
+ | :----: | :----: | :---: | :---: | :---: |
516
+ | eventType | SPACE_EVENTS or string | yes | none | valid event type |
517
+ | callback | Function or Array of Functions | yes | none | function or async function |
518
+
519
+ ### Subscribing a method to an event
520
+ To subscribe to an event, simpley call the `subscribeSpaceEvent()` and pass the event you want to subscribe to and the method you want to trigger. Subscribing to an event will also return to you the data of an object if you are interacting with one. Said object data will implement the `IShowcaseObject` interface.
521
+
522
+ *Example:*
523
+ ```typescript
524
+ function myFunction(objectData){
525
+ console.log("I will run during a DRAG_END event",objectData)
526
+ }
527
+
528
+ atwin.subscribeSpaceEvent('DRAG_END',myFunction)
529
+ ```
530
+
531
+ You can subscribe your method to more than one event. Currently, we support subscribing only the following events but we are working to add more events in the future.
532
+
533
+ **SUPPORTED EVENTS**
534
+
535
+ - CLICK
536
+ - DRAG_END
537
+ - LOADING_PHASE
538
+ - STARTING_PHASE
539
+ - PLAYING_PHASE
540
+
541
+ For more information regarding the loading,starting, and playing phase events. Please refer to [this section](#executing-methods-on-specific-app-phases)
542
+
543
+ ### Subscribing multiple methods to an event
544
+ If you wish to subscribe multiple methods to an event. You can use the folliwing methods listed below
545
+
546
+ **Method 1:**
547
+ Subscribing each method one at a time
548
+
549
+ ```typescript
550
+ function myFunction(objectData){
551
+ console.log("Function 1")
552
+ }
553
+
554
+ function myFunction2(objectData){
555
+ console.log("Function 2")
556
+ }
557
+
558
+ atwin.subscribeSpaceEvent('DRAG_END',myFunction)
559
+ atwin.subscribeSpaceEvent('DRAG_END',myFunction2)
560
+ ```
561
+
562
+ **Method 2:**
563
+ Placing multiple methods in a parent method and passing it to the `subscribeSpaceEvent` method
564
+
565
+ ```typescript
566
+ function myFunction(){
567
+ console.log("Function 1")
568
+ }
569
+
570
+ function myFunction2(){
571
+ console.log("Function 2")
572
+ }
573
+
574
+ function parentFunction(objectData) {
575
+ myFunction()
576
+ myFunction2()
577
+ }
578
+
579
+ atwin.subscribeSpaceEvent('DRAG_END',parentFunction)
580
+ ```
581
+
582
+ **Method 3:**
583
+ Inserting multiple methods into an array and passing it to the `subscribeSpaceEvent` method.
584
+
585
+ ```typescript
586
+ function myFunction(){
587
+ console.log("Function 1")
588
+ }
589
+
590
+ function myFunction2(){
591
+ console.log("Function 2")
592
+ }
593
+
594
+ const functionArray = [myFunction,myFunction2]
595
+
596
+ atwin.subscribeSpaceEvent('DRAG_END',functionArray)
597
+ ```
598
+
599
+ Keep in mind that the library's event system utilizes an FIFO algorithm. Your functions will always be executed in chronological order meaning functions that were subscribed first will be executed first.
600
+
601
+ ### Unsubscribing a method from an event
602
+ If you wish to unsubscribe your method from a subscribed event, simply call the `unsubscribeSpaceEvent()` method to so. The method accepts the following parameters:
603
+
604
+ The method accepts the following as its parameters:
605
+ | parameter | type | required | default | values |
606
+ | :----: | :----: | :---: | :---: | :---: |
607
+ | eventType | SPACE_EVENTS or string | yes | none | valid event type |
608
+ | callback | Function or Array of Functions | yes | none | function or async function |
609
+
610
+ *Example:*
611
+ ```typescript
612
+ function myFunction(){
613
+ console.log("I will be unsubscribed and no longer trigger during the next DRAG_END event")
614
+ }
615
+
616
+ atwin.unsubscribeSpaceEvent('DRAG_END',myFunction)
617
+ ```
618
+
619
+ If you used **Method 3** in subscribing multiple methods. You can pass the same array to the `unsubscribeSpaceEvent()` method and they will all be unsubscribed from the event.
620
+
621
+ ```typescript
622
+ const functionArray = [myFunction,myFunction2]
623
+
624
+ atwin.unsubscribeSpaceEvent('DRAG_END',functionArray)
625
+ ```
626
+
627
+ ### Creating Custom Events
628
+ The library has a list of default event types you can subscribe to but you may at times need to create your own event type to use for a specific task. You can easily create and subscribe to your own custom event by using `registerCustomSpaceEvent()` and `subscribeSpaceEvent()` respectively. Here is how to do it.
629
+
630
+ **IMPORTANT:** Your custom event type name must **not** be the same as an existing custom event type or a default event type. Doing so will return an error and the registration will fail.
631
+
632
+ **STEP 1:**
633
+ Register your event type name. As a convention, the name of your event type should be in uppercase and use snake_case (e.g. FOO_BAR). It is important to register you custom event type first before subscribing a method to it. You can register one or multiple events using the method.
634
+
635
+ ```typescript
636
+ //Register one custom event type
637
+ atwin.registerCustomSpaceEvent('MY_EVENT')
638
+
639
+ //Register multiple custom events
640
+ const newEvents = ['FOO','BAR','MY_EVENT']
641
+ atwin.registerCustomSpaceEvent(newEvents)
642
+ ```
643
+
644
+ **STEP 2:**
645
+ Subscribe to your custom event
646
+
647
+ ```typescript
648
+ function myFunction(objectData){
649
+ console.log("Function 1")
650
+ }
651
+
652
+ atwin.subscribeSpaceEvent('MY_EVENT',myFunction)
653
+ ```
654
+
655
+ To trigger your custom event, you can use the `dispatchSpaceEvent()` in your app. You can also optionally pass a data payload with said event. Just make sure that you have done steps 1 and 2 before doing so.
656
+
657
+ The `dispatchSpaceEvent()` method accepts the following as its parameters:
658
+ | parameter | type | required | default | values |
659
+ | :----: | :----: | :---: | :---: | :---: |
660
+ | eventType | SPACE_EVENTS or string | yes | none | valid event type |
661
+ | payload | any | no | none | any |
662
+
663
+ ```typescript
664
+ const someData = {
665
+ //some data here
666
+ }
667
+
668
+ atwin.dispatchSpaceEvent('MY_EVENT',someData)
669
+ ```
670
+
671
+
672
+ ## Points of Interest
673
+
674
+ Tags are primarily use to mark locations or objects in space for quick and direct navigation.
675
+ Tags usually contain additional content that will be rendered when hovered. Contents can be web pages,
676
+ text descriptions, videos, or images.
677
+
678
+ You may use the [getTags()](#gettags) method in order to get a list of Tags found in the space.
679
+
680
+ You may use the [goToTag()](#gototag) method in order to navigate to specific Tag
681
+
682
+ You may use the [getSweeps()](#getsweeps) method in order get a list of Sweeps found in the Space.
683
+
684
+ You may use the [moveToSweep()](#movetosweep) method in order to move to a specific Sweep
685
+
686
+ | parameter | type | required | default | values |
687
+ | :----: | :----: | :---: | :---: | :---: |
688
+ | sweepId | string | yes | | Id of the sweep |
689
+
690
+ ````typescript
691
+ import * as atwin from 'architwin';
692
+
693
+ ...
694
+
695
+ const spaceUrl = "https://basic-dev.rev-kitten.com/showcase/model3d_public/1?token=e707880f-0fc5-48a6-b3f6-643a19f81464"
696
+
697
+ const ispace = {
698
+ id: 1;
699
+ name: "mySpace";
700
+ space_url: spaceUrl;
701
+ tagpin_image: null;
702
+ } as ISpace
703
+
704
+ const tagId = "5"
705
+ const sweepId = "10"
706
+
707
+ // returns a list of Tags found in the Space
708
+ await atwin.getTags(ispace)
709
+
710
+ // to navigate to specific Tag and accepts a Tag's ID
711
+ await atwin.goToTag(tagId)
712
+
713
+ // returns a list of Sweeps found in the Space
714
+ await atwin.getSweeps()
715
+
716
+ // to move to a specific Sweep
717
+ await atwin.moveToSweep(sweepId)
718
+
719
+ ...
720
+ ````
721
+
722
+ **More Examples:**
723
+ ````typescript
724
+ import * as atwin from 'architwin';
725
+
726
+ ...
727
+
728
+ // get current sweep data
729
+ await atwin.getCurrentSweep()
374
730
 
375
- ## Config Options
731
+ ...
732
+ ````
733
+
734
+ <!-- ## Config Options
376
735
 
377
736
  ```typescript
378
737
  export interface IMPConfig{
@@ -382,8 +741,18 @@ export interface IMPConfig{
382
741
  viewMode?: string
383
742
  play?: 0 | 1,
384
743
  qs?: 0 | 1,
744
+ brand?: 0 | 1,
745
+ dh?: 0 | 1,
385
746
  tour?: 0 | 1 | 2 | 3,
747
+ hr?: 0 | 1,
748
+ mls?: 0 | 1 | 2,
749
+ mt?: 0 | 1,
750
+ tagNav?: 0 | 1,
751
+ f?: 0 | 1,
752
+ fp?: 0 | 1,
753
+ title?: 0 | 1 | 2,
386
754
  vr?: 0 | 1,
755
+ search?: 0 | 1,
387
756
  mapConfig?: {
388
757
  mapId: string
389
758
  position?: string //topRight | topLeft | bottomRight | bottomLeft
@@ -494,19 +863,54 @@ Example:
494
863
  ```
495
864
  - **zIndex** - (optional) Set the z-index of the map. In cases where you have UI elements that coincide with the position of the minimap. You set the z-index value of the minimap to determine what order the minimap should be rendered.
496
865
 
866
+ ## Executing methods on specific App Phases
867
+
868
+ Your application may need to execute certain methods during the initialization of your 3D space. For example, you may want to use`addObjectToSpace()` method to render a model to your 3D space the moment the 3D space becomes interactive. While you can always just invoke the function after the `connectSpace()` method there may be times where this will cause an error as the `connectSpace()` method which is an async method, may have not finished initializing the necessary internal variables that allow other methods to work properly. When you invoke the `connectSpace()` method, the library does some internal validation and then goes to several phases to render your 3D space and make it interactive. These phases are the following:
869
+
870
+ **ARCHTWIN APP PHASES**
871
+
872
+ - **LOADING:** Initial fetch request to matterport. This is where the bundle downloads the 3D space from matterport and starts rendering it
873
+ - **STARTING:** Matterport begins the transition to the start location
874
+ - **PLAYING** The 3D space is now ready for user interaction
875
+
876
+ You can also view the technical diagram of how this work below:
877
+
878
+ <img src="https://drive.google.com/uc?id=1I_NuuI_PWkRzB0DueCmBCBH-1V_upiOB" width="400" height="300" />
879
+
880
+ To invoke a function from your application during one of the phases. Simple pass the function name as a parameter in the `connectSpace()` method. Make sure to not add a parenthesis to your function name when you pass it as a parameter to avoid invoking the function prematurely.
881
+
882
+ *Example:*
883
+
884
+ ```typescript
885
+ //Your application side function
886
+ async function runThisOnPlayState(){
887
+ const tags = await axios.get('my-custom-endpoint')
888
+
889
+ //Keep in mind that you should map the data from your endpoint into an object structure that the library supports
890
+
891
+ await atwin.showTags(tags)
892
+ }
893
+
894
+ await atwin.connectSpace(spaceUrl, auth, config,{onPlay:runThisOnPlayState})
895
+ ```
896
+
897
+ In this example, the method named `runThisOnPlayState` is passed as a value to the `onPlay` key of an object. This will invoke the function during the PLAYING phase of the library. To invoke your function in a different phase, simply pass it to a different key in the object. You can pass your functions to onLoad,onStart, and onPlay. Async and synchronous functions are valid. Refer to the table below for more information
898
+
899
+ | parameter | type | required | default | values |
900
+ | :----: | :----: | :---: | :---: | :---: |
901
+ | onLoad | Function | no | none | async or non-async function|
902
+ | onStart | Function | no | none | async or non-async function|
903
+ | onPlay | Function | no | none | async or non-async function|
904
+
497
905
  ## Space Navigation and Camera Control
498
- -----------------------------
906
+
499
907
  #### Moving Around
500
908
 
501
909
  You can navigate around the space using keyboard arrow keys or using a mouse.
502
910
 
503
- Progmmatically, you also can navigate the space. You may use `moveInDirection()` method to move around inside the space.
911
+ Progmmatically, you also can navigate the space. You may use [moveInDirection()](#moveindirection) method to move around inside the space.
504
912
  This will move the user to the nearest Sweep marker in the indicated direction.
505
913
 
506
- | parameter | type | required | default | values |
507
- | :----: | :----: | :---: | :---: | :---: |
508
- | direction | string | yes | | "FORWARD" or "BACKWARD" or "LEFT" or "RIGHT" or "UP" or "DOWN" |
509
-
510
914
  ````typescript
511
915
  import * as atwin from 'architwin';
512
916
 
@@ -532,16 +936,6 @@ async function moveLeft() {
532
936
  await atwin.moveInDirection("LEFT")
533
937
  }
534
938
 
535
- // this function moves you to the nearest sweep above you
536
- async function moveUp() {
537
- await atwin.moveInDirection("UP")
538
- }
539
-
540
- // this function moves you to the nearest sweep below you
541
- async function moveDown() {
542
- await atwin.moveInDirection("DOWN")
543
- }
544
-
545
939
  ...
546
940
  ````
547
941
 
@@ -549,7 +943,7 @@ async function moveDown() {
549
943
 
550
944
  While inside the space, you can control the camera rotation and panning to have a better view around you.
551
945
 
552
- You may use the `cameraRotate()` to rotate the camera view.
946
+ You may use the [cameraRotate()](#camerarotate) to rotate the camera view.
553
947
 
554
948
  | parameter | type | required | default | values |
555
949
  | :----: | :----: | :---: | :---: | :---: |
@@ -571,7 +965,7 @@ await atwin.cameraRotate(0,45,5)
571
965
  ...
572
966
  ```
573
967
 
574
- You may use `cameraPan()` method to tilt and pan the Camera.
968
+ You may use [cameraPan()](#camerapan) method to tilt and pan the Camera.
575
969
 
576
970
  | parameter | type | required | default | values |
577
971
  | :----: | :----: | :---: | :---: | :---: |
@@ -591,148 +985,47 @@ await atwin.cameraPan(30,0)
591
985
 
592
986
  ...
593
987
  ````
594
- **Note:** cameraPan will work only in *Dollhouse* mode.
988
+ **Note:** [cameraPan()](#camerapan) will work only in *Dollhouse* mode.
595
989
 
596
- ## Space Overview
597
- (Note that we use the word Space and Showcase interchangeably)
598
990
 
599
- **Space** - Space is an immersive and realistic Digital Twin model of a physical space, with virtual custom objects like animated 3D objects, Video Screens, Slideshow Screens and Tags, co-existing and enhancing the real objects.
600
991
 
601
- A user should be able to navigate around using PC or devices (keyboard and mouse), measure real object dimensions and interact with the virtual objects as if you are actually visiting the physical space.
992
+ ## Loading and Interacting with 3D/2D Objects
602
993
 
603
- **Sweeps** - Space have static sweep markers (white circles on floor) which serves as primary navigation points. Users can go to sweeps (or click), stand and look around.
994
+ Architwin allows you to load and interact with 3D or 2D objects into a 3D showcase. Architwin has internal functions that performs GET requests from an API enpoint, parses it, and then renders it to your 3D showcase. The result fetched data implement the `IShowcaseObject` type interface which matches the schema of the response of the API. Please take note that this guide assumes that you have implemented the recommended database schema for storing your showcase objects.
604
995
 
605
- **Tags** - Space also have tags which are virtual markers attached to Objects or Locations in space. Tags can be clicked which will render and display relevant contents like
606
- web pages, videos, images or text descriptions. It is possible to go directly to any specifig tag (gotoTag) from anywhere in Space.
996
+ ### What is an Object?
607
997
 
608
- It can be used as quick way to navigate around the space.
998
+ We define objects as 3D or 2D assets that have or will be loaded into a space. This could be a 3D model of a statue or a 2D video or image. An object can be static or interactive. Static objects are objects that the user cannot interact with (e.g. clickable or playable). An example of a static object would be 3D statue with no animations. Interactive objects are objects that the user can interact with by either clicking the object directly or just by being near it (e.g. videos). Architwin currently supports the following file types:
609
999
 
610
- **3D Objects** - Space usually contains 3D objects or three-dimentional models. Some 3D objects may have some simple animations.
1000
+ **3D Models**
611
1001
 
612
- **Video Screens** - Another interesting objects that can be found inside the space are Video Screens. They practially look like TV
613
- screens placed at selected locations. The Video screens will automatically play when a User is nearby (2 meters). And automatically turns off when the User leaves.
1002
+ - GTLF/GLB
1003
+ - FBX
614
1004
 
1005
+ **2D Objects**
615
1006
 
616
- **Slideshow Screens** - Space can also contain Image Slideshow Screens. This is similar to the Video Screen, but uses static images.
617
- Clicking on the right section of the current slide image will display the next slide.
618
- Clicking on the the left section will display the previous slide.
1007
+ - MP4 (Videos)
1008
+ - WMV (Videos)
1009
+ - PNG (Images)
1010
+ - JPEG (Images)
1011
+ - ZIP (Image/Image slideshows)
619
1012
 
620
- The slideshow can be auto played in whole by clicking the lower-right corner.
1013
+ We add support for more file types in future updates
621
1014
 
622
- <!-- **Meeting** - Space meeting feature introduces immersive way to conduct virtual gatherings and collaborative sessions. This innovative feature allows users to convene inside a Space, where participants represented by an avatar and can interact, communicate, and share ideas in a more lifelike and engaging manner.
1015
+ ### Loading Objects
623
1016
 
624
- Please check [Meeting Guide](#meeting-guide) to know how to use Meeting feature. -->
1017
+ Objects come in many shapes and sizes. Loading objects may sometimes take a lot of resources especially if you intend to load a lot of objects in your space. Architwin is optimized to load your 3D spaces and its associated objects as fast and efficiently as possible to reduce the TTI.
625
1018
 
626
- ## Points of Interest
627
- Tags are primarily use to mark locations or objects in space for quick and direct navigation.
628
- Tags usually contain additional content that will be rendered when hovered. Contents can be web pages,
629
- text descriptions, videos, or images.
1019
+ To achieve this, instead of loading all of your objects at the same time at the start which causes long initial load times, Architwin eagerly renders objects in the space when the user is at a certain distance from the objects intended position. We call this feature **Render On Demand**.
630
1020
 
631
- You may use the `getTags()` method in order to get a list of Tags found in the space.
1021
+ By default, objects are rendered in the space when objects are within a **2 meters** diameter from the Camera (User view). You can increase or decrease this distance by setting the render distance using the `setRenderDistance()` method.
632
1022
 
633
1023
  | parameter | type | required | default | values |
634
1024
  | :----: | :----: | :---: | :---: | :---: |
635
- | space | ISpace | yes | | |
1025
+ | distance | number | yes | | number in meters |
636
1026
 
637
- You may use the `goToTag()` method in order to navigate to specific Tag
638
-
639
- | parameter | type | required | default | values |
640
- | :----: | :----: | :---: | :---: | :---: |
641
- | tag_id | string | yes | | Id of the tag |
642
-
643
- You may use the `getSweeps()` method in order get a list of Sweeps found in the Space. This method doesn't have a parameter.
644
-
645
- You may use the `moveToSweep()` method in order to move to a specific Sweep
646
-
647
- | parameter | type | required | default | values |
648
- | :----: | :----: | :---: | :---: | :---: |
649
- | sweepId | string | yes | | Id of the sweep |
650
-
651
- ````typescript
652
- import * as atwin from 'architwin';
653
-
654
- ...
655
-
656
- const spaceUrl = "https://basic-dev.rev-kitten.com/showcase/model3d_public/1?token=e707880f-0fc5-48a6-b3f6-643a19f81464"
657
-
658
- const ispace = {
659
- id: 1;
660
- name: "mySpace";
661
- space_url: spaceUrl;
662
- tagpin_image: null;
663
- } as ISpace
664
-
665
- const tagId = "5"
666
- const sweepId = "10"
667
-
668
- // returns a list of Tags found in the Space
669
- await atwin.getTags(ispace)
670
-
671
- // to navigate to specific Tag and accepts a Tag's ID
672
- await atwin.goToTag(tagId)
673
-
674
- // returns a list of Sweeps found in the Space
675
- await atwin.getSweeps()
676
-
677
- // to move to a specific Sweep
678
- await atwin.moveToSweep(sweepId)
679
-
680
- ...
681
- ````
682
-
683
- **More Examples:**
684
- ````typescript
685
- import * as atwin from 'architwin';
686
-
687
- ...
688
-
689
- // get current sweep data
690
- await atwin.getCurrentSweep()
691
-
692
-
693
- // get current sweep position
694
- await atwin.getSweepPosition()
695
-
696
- ...
697
- ````
698
-
699
- ## Loading and Interacting with 3D/2D Objects
700
-
701
- Architwin allows you to load and interact with 3D or 2D objects into a 3D showcase. Architwin has internal functions that performs GET requests from an API enpoint, parses it, and then renders it to your 3D showcase. The result fetched data implement the `IShowcaseObject` type interface which matches the schema of the response of the API. Please take note that this guide assumes that you have implemented the recommended database schema for storing your showcase objects.
702
-
703
- ### What is an Object?
704
-
705
- We define objects as 3D or 2D assets that have or will be loaded into a space. This could be a 3D model of a statue or a 2D video or image. An object can be static or interactive. Static objects are objects that the user cannot interact with (e.g. clickable or playable). An example of a static object would be 3D statue with no animations. Interactive objects are objects that the user can interact with by either clicking the object directly or just by being near it (e.g. videos). Architwin currently supports the following file types:
706
-
707
- **3D Models**
708
-
709
- - GTLF/GLB
710
- - FBX
711
-
712
- **2D Objects**
713
-
714
- - MP4 (Videos)
715
- - WMV (Videos)
716
- - PNG (Images)
717
- - JPEG (Images)
718
- - ZIP (Image/Image slideshows)
719
-
720
- We add support for more file types in future updates
721
-
722
- ### Loading Objects
723
-
724
- Objects come in many shapes and sizes. Loading objects may sometimes take a lot of resources especially if you intend to load a lot of objects in your space. Architwin is optimized to load your 3D spaces and its associated objects as fast and efficiently as possible to reduce the TTI.
725
-
726
- To achieve this, instead of loading all of your objects at the same time at the start which causes long initial load times, Architwin eagerly renders objects in the space when the user is at a certain distance from the objects intended position. We call this feature **Render On Demand**.
727
-
728
- By default, objects are rendered in the space when objects are within a **2 meters** diameter from the Camera (User view). You can increase or decrease this distance by setting the render distance using the `setRenderDistance()` method.
729
-
730
- | parameter | type | required | default | values |
731
- | :----: | :----: | :---: | :---: | :---: |
732
- | distance | number | yes | | number in meters |
733
-
734
- ```typescript
735
- import * as atwin from 'architwin'
1027
+ ```typescript
1028
+ import * as atwin from 'architwin'
736
1029
 
737
1030
  ...
738
1031
 
@@ -744,9 +1037,9 @@ atwin.connectSpace(url, auth, config)
744
1037
  ...
745
1038
  ```
746
1039
 
747
- You only need to set the render distance once. Make sure to invoke the function before running `connectSpace()`
1040
+ You only need to set the render distance once. Make sure to invoke the function before running [connectSpace](###connectSpace) method.
748
1041
 
749
- Architwin also allows you to get **rendered** objects near the user by calling the `getNearbyObjects()` method which will return an array of nodes of the rendered objects within the target range.
1042
+ Architwin also allows you to get **rendered** objects near the user by calling the [getNearbyObjects()](#getnearbyobjects) method which will return an array of nodes of the rendered objects within the target range.
750
1043
 
751
1044
  | parameter | type | required | default | values |
752
1045
  | :----: | :----: | :---: | :---: | :---: |
@@ -880,7 +1173,7 @@ The `atwin.selectedObject` variable is an example of a variable that implements
880
1173
 
881
1174
  Transformation such as translate, scale, and rotate are actions used to manipulate objects in a 3D space. These transformations allow you to change an object's position, size, and orientation respectively.
882
1175
 
883
- **NOTE:** Please be aware that transform controls are disabled when viewMode in the [config object](#config-options) you pass into connectSpace is undefined or is set to public. To enable transform controls in your 3D space. Make sure to set viewMode to 'interactive'.
1176
+ **NOTE:** Please be aware that transform controls are disabled when viewMode in the [config object](#config-options) you pass into [connectSpace](###connectSpace) is undefined or is set to public. To enable transform controls in your 3D space. Make sure to set viewMode to 'interactive'.
884
1177
 
885
1178
  **Translate** - Translation refers to moving an object from one position to another in space. It involves shifting the object's entire coordinate system without altering its orientation.
886
1179
 
@@ -896,7 +1189,7 @@ Clicking on any object in the space will attach the axis controls to it. By defa
896
1189
 
897
1190
  <img src="https://matterport.github.io/showcase-sdk/images/sdkbundle-components-transform-controls.png" width="300" height="200" />
898
1191
 
899
- You can switch the transform mode on the currently selected object by using the `setTransformMode()` method.
1192
+ You can switch the transform mode on the currently selected object by using the [setTransformMode()](#settransformmode) method.
900
1193
 
901
1194
  Please take note that transform controls can only be attached to one object at a time. Clicking on another object will remove the transform controls in the previous object and add it the currently selected object. It is impractical to attach multiple transform controls on more than one object. If you wish to programmatically transform multiple methods, then the next method offers a solution.
902
1195
 
@@ -914,7 +1207,7 @@ console.log("Selected object data", atwin.selectedObject)
914
1207
 
915
1208
  **Switching Transform Modes**
916
1209
 
917
- If you wish switch transformation mode, you can pass either 'translate' or 'scale' or 'rotate' as parameters to the `setTransformMode()` method. This will switch the transform controls on the currently selected object
1210
+ If you wish switch transformation mode, you can pass either 'translate' or 'scale' or 'rotate' as parameters to the [setTransformMode()](#settransformmode) method. This will switch the transform controls on the currently selected object
918
1211
 
919
1212
  | parameter | type | required | default | values |
920
1213
  | :----: | :----: | :---: | :---: | :---: |
@@ -1020,7 +1313,7 @@ Redo and undo are actions that allow you to revert or replay previous transforma
1020
1313
 
1021
1314
  Assuming that you have already selected an object and already performed different transformation actions. You can use the methods in the library to redo and undo the changes.
1022
1315
 
1023
- In order to do this, you may use the `revertTransform()` method to revert changes. By default, the action is set to 'undo'.
1316
+ In order to do this, you may use the [revertTransform()](#reverttransform) method to revert changes. By default, the action is set to 'undo'.
1024
1317
 
1025
1318
  ```typescript
1026
1319
  import * as atwin from 'architwin';
@@ -1048,7 +1341,7 @@ atwin.revertTransform('redo')
1048
1341
 
1049
1342
  Adding an object to your space refers to the process of incorporating a pre-existing 2D or 3D object from the database into the 3D space. It allows for the creation of visualizations, simulations, and interactive experiences in your space.
1050
1343
 
1051
- In order to add an object, you may use the `addObjectToSpace()` method.
1344
+ In order to add an object, you may use the [addObjectToSpace()](#addobjecttospace) method.
1052
1345
 
1053
1346
  | parameter | type | required | default |values |
1054
1347
  | :----: | :----: | :---: | :---: | :---: |
@@ -1056,11 +1349,11 @@ In order to add an object, you may use the `addObjectToSpace()` method.
1056
1349
  | objectType | string | yes | none | valid supported file type (GLB,FBX) |
1057
1350
  | config | ObjectConfig | yes | | valid config object |
1058
1351
 
1059
- There are two ways you can use the `addObjectToSpace()` method. We will go through each one
1352
+ There are two ways you can use the [addObjectToSpace()](#addobjecttospace) method. We will go through each one
1060
1353
 
1061
1354
  **Method 1: Adding Programmatically**
1062
1355
 
1063
- If you wish to add new object to your space to a pre-defined position, you can use the `addObjectToSpace()` method and pass the `objectConfig` along.
1356
+ If you wish to add new object to your space to a pre-defined position, you can use the [addObjectToSpace()](#addobjecttospace) method and pass the `objectConfig` along.
1064
1357
 
1065
1358
  ```typescript
1066
1359
  import * as atwin from 'architwin';
@@ -1091,7 +1384,7 @@ atwin.addObjectToSpace(objectUrl,objectType, objectConfig)
1091
1384
 
1092
1385
  **Method 2: Adding with click method using getTargetPosition**
1093
1386
 
1094
- The library has several helper methods that provide a range of commmon functionalities to help you achieve certain actions easier. If for example, you do not have your intended position coordinates stored in the database or in a local area and wish to click a specific area of the 3D space and get that the coordinates of the area you clicked, you may do some by using the `getTargetPosition()` helper method in tangent with the `addObjectToSpace()` method to do so. You can [click here](#getting-the-coordinates-of-a-clicked-area-in-the-3d-space) to know more about the `getTargetPosition()` method
1387
+ The library has several helper methods that provide a range of commmon functionalities to help you achieve certain actions easier. If for example, you do not have your intended position coordinates stored in the database or in a local area and wish to click a specific area of the 3D space and get that the coordinates of the area you clicked, you may do some by using the `getTargetPosition()` helper method in tangent with the [addObjectToSpace()](#addobjecttospace) method to do so. You can [click here](#getting-the-coordinates-of-a-clicked-area-in-the-3d-space) to know more about the `getTargetPosition()` method
1095
1388
 
1096
1389
  Here is an example of how you can use the two methods together. This is just one example, it is up to you on how you wish to combine different methods provided by the library
1097
1390
 
@@ -1127,7 +1420,7 @@ A Media Screen is a customizable 2D object whose content can be used to display
1127
1420
 
1128
1421
  #### Adding a Media Screen
1129
1422
 
1130
- In order to add a media screen, you may use the `addMediaScreen()` method. The `addMediaScreen()` method accepts the following parameters:
1423
+ In order to add a media screen, you may use the [addMediaScreen()](#addmediascreen) method. The [addMediaScreen()](#addmediascreen) method accepts the following parameters:
1131
1424
 
1132
1425
  #### Media Screen Parameter Reference
1133
1426
 
@@ -1146,7 +1439,7 @@ The **transform** object is an object that contains the following key-value pair
1146
1439
  | scale | Vector3 | no | {x:1,y:1,z:1} | valid numeric x,y,z values|
1147
1440
  | rotation | Vector3 | no | {x:0,y:0,z:0} | valid numeric x,y,z values|
1148
1441
 
1149
- By default, your media screen will show a blank white canvas if you set the mediaUrl parameter of the `addMediaScreen()` method as an empty string or `undefined`.
1442
+ By default, your media screen will show a blank white canvas if you set the mediaUrl parameter of the [addMediaScreen()](#addmediascreen) method as an empty string or `undefined`.
1150
1443
 
1151
1444
  **IMPORTANT:** The link to your media you provide to the mediaUrl **MUST** be publicly accessible and have the appropriate CORS headers, otherwise, your media will not load into the media screen.
1152
1445
 
@@ -1186,7 +1479,7 @@ If done correctly, you should be able to see your media screen in your intended
1186
1479
 
1187
1480
  **Method 2: Adding with click method using getTargetPosition**
1188
1481
 
1189
- The library has several helper methods that provide a range of commmon functionalities to help you achieve certain actions easier. If for example, you do not have your intended position coordinates stored in the database or in a local area and wish to click a specific area of the 3D space and get that the coordinates of the area you clicked, you may do some by using the `getTargetPosition()` helper method in tangent with the `addMediaScreen()` method to do so. You can [click here](#getting-the-coordinates-of-a-clicked-area-in-the-3d-space) to know more about the `getTargetPosition()` method
1482
+ The library has several helper methods that provide a range of commmon functionalities to help you achieve certain actions easier. If for example, you do not have your intended position coordinates stored in the database or in a local area and wish to click a specific area of the 3D space and get that the coordinates of the area you clicked, you may do some by using the `getTargetPosition()` helper method in tangent with the [addMediaScreen()](#addmediascreen) method to do so. You can [click here](#getting-the-coordinates-of-a-clicked-area-in-the-3d-space) to know more about the `getTargetPosition()` method
1190
1483
 
1191
1484
  Here is an example of how you can use the two methods together. This is just one example, it is up to you on how you wish to combine different methods provided by the library
1192
1485
 
@@ -1257,9 +1550,9 @@ await atwin.attachMediaScreenContent(targetMediaScreenId, validUrl, 'video')
1257
1550
  ...
1258
1551
  ```
1259
1552
 
1260
- When setting a video as the media screen content. You can use the `setVideoPlayback()` method to programmatically play,pause,mute,and unmute a video. You can navigate to the [playback controls section](#setting-video-playback-in-the-space) to learn more about the method. Here is an example on how to use it.
1553
+ When setting a video as the media screen content. You can use the [setVideoPlayback()](#setvideoplayback) method to programmatically play,pause,mute,and unmute a video. You can navigate to the [playback controls section](#setting-video-playback-in-the-space) to learn more about the method. Here is an example on how to use it.
1261
1554
 
1262
- In this example, we are getting a random media screen from the `atwin._3DXObject` array which contains all the objects rendered in the space. Media screens whose media type is a video will have a variable called `planeElement` inside the object's `component` which contains an HTML video element that we can manipulate using the [setVideoPlayback()`](#setting-video-playback-in-the-space) method. Please take note that this variable is not acessible if the media type of the media screen content is an image.
1555
+ In this example, we are getting a random media screen from the `atwin._3DXObject` array which contains all the objects rendered in the space. Media screens whose media type is a video will have a variable called `planeElement` inside the object's `component` which contains an HTML video element that we can manipulate using the [setVideoPlayback()](#setvideoplayback) method. Please take note that this variable is not acessible if the media type of the media screen content is an image.
1263
1556
 
1264
1557
  *Interface used*
1265
1558
  ```typescript
@@ -1302,7 +1595,7 @@ Setting video playback refers to the act of adjusting various controls associate
1302
1595
 
1303
1596
  Assuming that you have already selected a video, you can now set the playback of the video.
1304
1597
 
1305
- Inorder to set the playback of a video, you may use the `setVideoPlayback()` method.
1598
+ Inorder to set the playback of a video, you may use the [setVideoPlayback()](#setvideoplayback) method.
1306
1599
 
1307
1600
  | parameter | type | required | default | values |
1308
1601
  | :----: | :----: | :---: | :---: | :---: |
@@ -1343,7 +1636,7 @@ Setting animation control refers to the process of manipulating the playback of
1343
1636
 
1344
1637
  Assuming that you have already selected an animated 3D object, you can now control the setting of the animation.
1345
1638
 
1346
- In order to set the animation control of a 3D object, you may use the `setAnimationState()` method. By default the action is set to 'play'.
1639
+ In order to set the animation control of a 3D object, you may use the [setAnimationState()](#setanimationstate) method. By default the action is set to 'play'.
1347
1640
 
1348
1641
  **NOTE:** Please take note that the 3D object MUST be fully rendered first in the space before you can manipuate its animation state. This method will have no affect on 3D objects that do not have any animations in them.
1349
1642
 
@@ -1378,7 +1671,7 @@ atwin.setAnimationState('pause', modelID)
1378
1671
  ### Copying object To Your Space
1379
1672
  Copying an object refers to creating a duplicate or clone of an object. When an object is copied in the space, it means that the object's data is duplicated.
1380
1673
 
1381
- Assuming that you have already selected an object to be copied, you may now copy the object by calling `copyObject()` method. You may also specify a custom offset position and rotation of the object to be cloned.
1674
+ Assuming that you have already selected an object to be copied, you may now copy the object by calling [copyObject()](#copyobject) method. You may also specify a custom offset position and rotation of the object to be cloned.
1382
1675
 
1383
1676
  | parameter | type | required | default | values |
1384
1677
  | :----: | :----: | :---: | :---: | :---: |
@@ -1406,7 +1699,7 @@ if (atwin.selectedObject.object) {
1406
1699
 
1407
1700
  **Adding Object**: Adding an object in the database refers to the process of creating and inserting a new record into a data table. This involves providing the necessary data and attributes that define the object, and then store the object in the database. The newly added object becomes a part of the dataset and can be retrieved and manipulated as needed.
1408
1701
 
1409
- In order to add an object in the database, you may use the `addObject()` method. Assuming that you have already setup to have an event listener for file upload.
1702
+ In order to add an object in the database, you may use the [addObject()](#addobject) method. Assuming that you have already setup to have an event listener for file upload.
1410
1703
 
1411
1704
  | parameter | type | required | default | values |
1412
1705
  | :----: | :----: | :---: | :---: | :---: |
@@ -1476,7 +1769,7 @@ async function handleAddObject() {
1476
1769
 
1477
1770
  **Getting Object**: Getting an object in the database refers to the action of retrieving a specific record from a data table. Once retrieved, the object's information and attributes can be utilized for various purposes, such as displaying data to the user or displaying the object into the space.
1478
1771
 
1479
- In order to get an object in the database, you may use the `getObject()` method.
1772
+ In order to get an object in the database, you may use the [getObject()](#getobject) method.
1480
1773
 
1481
1774
  | parameter | type | required | default | values |
1482
1775
  | :----: | :----: | :---: | :---: | :---: |
@@ -1504,7 +1797,7 @@ async function handleGetObject() {
1504
1797
  ...
1505
1798
  ```
1506
1799
 
1507
- Now that you already get the object and store it in the variable objectPayload, you may now place the object in the space by using `addObjectToSpace()` method and pass the objectPayload in the parameter.
1800
+ Now that you already get the object and store it in the variable objectPayload, you may now place the object in the space by using [addObjectToSpace()](#addobjecttospace) method and pass the objectPayload in the parameter.
1508
1801
 
1509
1802
  ```typescript
1510
1803
  import * as atwin from 'architwin';
@@ -1519,7 +1812,7 @@ if (objectPayload) {
1519
1812
  ```
1520
1813
  **Updating Object**: Updating an object in the database involves modifying the attributes or properties of an existing record from a data table.
1521
1814
 
1522
- In order to update an object in the database, you may use the `updateObject()` method.
1815
+ In order to update an object in the database, you may use the [updateObject()](#updateobject) method.
1523
1816
 
1524
1817
  | parameter | type | required | default | values |
1525
1818
  | :----: | :----: | :---: | :---: | :---: |
@@ -1560,7 +1853,7 @@ async function handleUpdateObject() {
1560
1853
  ```
1561
1854
  **Deleting Object**: Deleting an object in the database refers to the process of removing a specific record from a data table. This operation permanently erases the object from the database, making its data and attributes no longer accessible.
1562
1855
 
1563
- In order to delete an object in the databse, you may use the `deleteObject()` method.
1856
+ In order to delete an object in the databse, you may use the [deleteObject()](#deleteobject) method.
1564
1857
 
1565
1858
  | parameter | type | required | default | values |
1566
1859
  | :----: | :----: | :---: | :---: | :---: |
@@ -1585,11 +1878,32 @@ async function handleDeleteObject() {
1585
1878
  ...
1586
1879
  ```
1587
1880
 
1881
+ ### Navigate to Object
1882
+
1883
+ Navigating to an object in space refers to the process of moving the camera's location near to the object.
1884
+
1885
+ Assuming that you have already selected an object to navigate to, you may now navigate to the object by using [goTo3dx()](#goto3dx) method.
1886
+
1887
+ | parameter | type | required | default | values |
1888
+ | :----: | :----: | :---: | :---: | :---: |
1889
+ | objectId | number | yes | | |
1890
+
1891
+ ```typescript
1892
+ import * as atwin from 'architwin';
1893
+
1894
+ ....
1895
+
1896
+ await atwin.goTo3dx(objectId)
1897
+
1898
+ ....
1899
+
1900
+ ```
1901
+
1588
1902
  ### Deleting Object To Your Space
1589
1903
 
1590
1904
  Deleting an object in space refers to the process of removing a pre-existing 2D or 3D object from the 3D environment or space. This action results in the elimination of the visual representation and physical presence of the object within the virtual space. By removing the object, users can maintain control over the composition and contents of their space, allowing for more dynamic and tailored virtual experiences.
1591
1905
 
1592
- Assuming that you have already selected an object to be deleted, you may now delete the object by using `deleteObjectFromSpace()` method.
1906
+ Assuming that you have already selected an object to be deleted, you may now delete the object by using [deleteObjectFromSpace()](#deleteobjectfromspace) method.
1593
1907
 
1594
1908
  | parameter | type | required | default | values |
1595
1909
  | :----: | :----: | :---: | :---: | :---: |
@@ -1614,7 +1928,7 @@ async function handleDeleteObjectFromSpace() {
1614
1928
 
1615
1929
  Replacing an object in space refers to the process of substituting a pre-existing 2D or 3D object within a 3D environment or space with another object. This action involves removing the original object and introducing a new one in its place, while maintaining the object's location and any associated properties or attributes.
1616
1930
 
1617
- Assuming that you have already selected an object to be replaced, you may now delete the object by using `replaceObject()` method.
1931
+ Assuming that you have already selected an object to be replaced, you may now delete the object by using [replaceObject()](#replaceobject) method.
1618
1932
 
1619
1933
  | parameter | type | required | default | values |
1620
1934
  | :----: | :----: | :---: | :---: | :---: |
@@ -1646,7 +1960,7 @@ async function handleReplaceObject() {
1646
1960
 
1647
1961
  A text markup screen is a graphical user interface objecet that allows users to input and display formatted text in the 3D space. The method internally generates elements and programmatically applies CSS styling. You can use this method to display text messages to the 3D screen.
1648
1962
 
1649
- In order to add a text markup screen in your space, you may use the `addTextMarkupScreen()` method.
1963
+ In order to add a text markup screen in your space, you may use the [addTextMarkupScreen()](#addtextmarkupscreen) method.
1650
1964
 
1651
1965
  | parameter | type | required | default | values |
1652
1966
  | :----: | :----: | :---: | :---: | :---: |
@@ -1685,7 +1999,7 @@ atwin.addTextMarkupScreen(title, message, transform)
1685
1999
 
1686
2000
  #### Setting Content to Text Markup Screen
1687
2001
 
1688
- If you wish to update the style and content for the text frame, you may use the `setTextMarkupScreenContent()` method. You can customize the text content as well as the foreground and background color of the target text markup screen.
2002
+ If you wish to update the style and content for the text frame, you may use the [setTextMarkupScreenContent()](#settextmarkupscreencontent) method. You can customize the text content as well as the foreground and background color of the target text markup screen.
1689
2003
 
1690
2004
  | parameter | type | required | default | values |
1691
2005
  | :----: | :----: | :---: | :---: | :---: |
@@ -1711,7 +2025,276 @@ atwin.setTextMarkupScreenContent(id, title, text, textColor, backgroundColor)
1711
2025
  ...
1712
2026
  ```
1713
2027
 
1714
- <!-- ## Meeting Guide
2028
+ ## Typescript Interface Reference
2029
+ We encourage that you use typescript for any new project you intend to use the library with. With typescript, you can take advantage of the type interfaces provided by the library. This helps you catch errors more easily on your IDE instead of seeing it on production. If you do intend to just use vanilla JS for your project, you can still use this section as reference on how how to structure the javascript objects in yours project
2030
+
2031
+ You can use the library's type interfaces by importing it using the following import path
2032
+
2033
+ ```typescript
2034
+ import type {IShowcaseObject} from 'architwin/lib/types'
2035
+
2036
+ const spaceObject:IShowcaseObject = {}
2037
+ ```
2038
+
2039
+ The library also exports a couple enums that you can use in your project too. Here are a few ways of importing enums
2040
+
2041
+ ```typescript
2042
+ //Method 1: Import interface and enums in one line
2043
+ import {type IShowcaseObject,SPACE_EVENTS} from 'architwin/lib/types'
2044
+
2045
+ //Method 2: Import interface and enums separately
2046
+ import type {IShowcaseObject} from 'archtwin/lib/types'
2047
+ import {SPACE_EVENTS} from 'architwin/lib/types'
2048
+
2049
+ const spaceObject:IShowcaseObject = {}
2050
+ ```
2051
+
2052
+ As a convention, interfaces provided by the library are written in PascalCase while enums are written in an uppercase SNAKE_CASE. We recommend that you follow this convention for your own interfaces for uniformity.
2053
+
2054
+ ### Tag Interfaces
2055
+
2056
+ ```typescript
2057
+ interface ITag {
2058
+ id: number,
2059
+ tag_name: string, // required
2060
+ showcase_id: number, // required
2061
+ floor_id: number, // required
2062
+ color_id: number, // required
2063
+ details?: string,
2064
+ remarks?: string,
2065
+ json_data: MpSdk.Tag.TagData, // required (mp tag data)
2066
+ tag_type_id?: number,
2067
+ sid: string,
2068
+ bid?: string,
2069
+ filename?: string,
2070
+ tag_image?: string,
2071
+ tag_url?: string,
2072
+ tag_order?: number,
2073
+ label: number, // required
2074
+ }
2075
+ ```
2076
+
2077
+ ```typescript
2078
+ interface ITagPublic {
2079
+ id: string;
2080
+ name: string;
2081
+ }
2082
+ ```
2083
+
2084
+ ### Object Interfaces
2085
+
2086
+ ```typescript
2087
+ interface IShowcaseObject {
2088
+ id: number;
2089
+ showcase_id: number;
2090
+ object_id: number;
2091
+ user_id: number;
2092
+ uuid?: string;
2093
+ space_uuid?: string;
2094
+ object_uuid?: string;
2095
+ object_position: {
2096
+ x: number;
2097
+ y: number;
2098
+ z: number;
2099
+ };
2100
+ object_rotation: {
2101
+ x: number;
2102
+ y: number;
2103
+ z: number;
2104
+ };
2105
+ object_scale: {
2106
+ x: number;
2107
+ y: number;
2108
+ z: number;
2109
+ };
2110
+ autoplay: boolean;
2111
+ autoplay_distance: number;
2112
+ offset_position: number;
2113
+ offset_rotation: number;
2114
+ position_unit: string;
2115
+ showcase_object_name: string;
2116
+ is_deleted: boolean;
2117
+ is_read: boolean;
2118
+ is_new: boolean;
2119
+ object_data: I3DObject;
2120
+ }
2121
+ ```
2122
+
2123
+ ```typescript
2124
+ interface I3DObject {
2125
+ id: number;
2126
+ uuid?: string;
2127
+ upload_file: string;
2128
+ upload_filename: string;
2129
+ filename: string;
2130
+ user_id: number;
2131
+ name: string;
2132
+ description: string;
2133
+ object_type: string;
2134
+ object_key: string;
2135
+ amazon_uri: string;
2136
+ object_thumbnail?: string;
2137
+ thumbnail_key?: string;
2138
+ thumbnail_type?: string;
2139
+ }
2140
+ ```
2141
+
2142
+ ```typescript
2143
+ interface IObjectData {
2144
+ collider?: any
2145
+ object: IShowcaseObject
2146
+ component: Scene.IComponent
2147
+ node: Scene.INode
2148
+ type?: string
2149
+ }
2150
+ ```
2151
+
2152
+ ```typescript
2153
+ interface NearbyObjects {
2154
+ x3d: Array<IObjectData>
2155
+ videos: Array<IObjectData>
2156
+ slideshows: Array<IObjectData>
2157
+ }
2158
+ ```
2159
+
2160
+ ```typescript
2161
+ interface ObjectConfig {
2162
+ options?: {
2163
+ name?: string | undefined
2164
+ title?: string | undefined
2165
+ type?: string | undefined
2166
+ url?: string | undefined
2167
+ iframeId?: string | undefined
2168
+ wrapperId?: string | undefined
2169
+ textColor?: string | undefined
2170
+ backgroundColor?: string | undefined
2171
+ visible?: boolean | undefined
2172
+ aspectRatio?: number | undefined
2173
+ text?: string | undefined
2174
+ fontSize?: number | undefined
2175
+ background?: boolean | undefined
2176
+ centered?: boolean | undefined
2177
+ height?: number | undefined
2178
+ curveSegments?: number | undefined
2179
+ bevelEnabled?: boolean | undefined
2180
+ bevelThickness?: number | undefined
2181
+ bevelSize?: number | undefined
2182
+ bevelOffset?: number | undefined
2183
+ bevelSegments?: number | undefined
2184
+ }
2185
+ position?: Vector3
2186
+ scale?: Vector3
2187
+ rotation?: Vector3
2188
+ }
2189
+ ```
2190
+
2191
+ ```typescript
2192
+ interface MediaScreenConfig {
2193
+ mediaUrl?: string
2194
+ mediaType?:string
2195
+ transform?: VectorCoords
2196
+ readonly?: boolean
2197
+ autoplay?:boolean
2198
+ }
2199
+ ```
2200
+
2201
+ ```typescript
2202
+ export interface VectorCoords {
2203
+ object_position: Vector3
2204
+ object_rotation: Vector3
2205
+ object_scale:Vector3
2206
+ }
2207
+ ```
2208
+
2209
+ ### Meeting Interfaces
2210
+
2211
+ ```typescript
2212
+ interface MeetingInfo {
2213
+ space_id: string;
2214
+ meeting_id?: string;
2215
+ host_name?: string;
2216
+ title?: string;
2217
+ meeting_start?: Date;
2218
+ meeting_status?: MeetingStatus;
2219
+ duration?: number;
2220
+ password?: string;
2221
+ }
2222
+ ```
2223
+
2224
+ ```typescript
2225
+ interface MeetingConfig {
2226
+ customColors?: MeetingCustomColors;
2227
+ customAvatars?: Avatar[];
2228
+ deviceControl?: MeetingDeviceControl;
2229
+ meetingBarPosition?: MeetingBarPosition;
2230
+ }
2231
+ ```
2232
+
2233
+ ```typescript
2234
+ interface MeetingDeviceControl {
2235
+ videoInput: boolean;
2236
+ audioInput: boolean;
2237
+ audioOutput: boolean;
2238
+ }
2239
+ ```
2240
+
2241
+ ```typescript
2242
+ interface Avatar {
2243
+ model: string;
2244
+ thumbnail: string;
2245
+ }
2246
+ ```
2247
+
2248
+ ```typescript
2249
+ interface MeetingConfig {
2250
+ customColors?: MeetingCustomColors;
2251
+ customAvatars?: Avatar[];
2252
+ deviceControl?: MeetingDeviceControl;
2253
+ meetingBarPosition?: MeetingBarPosition;
2254
+ }
2255
+ ```
2256
+
2257
+ ```typescript
2258
+ interface MeetingDeviceControl {
2259
+ videoInput: boolean;
2260
+ audioInput: boolean;
2261
+ audioOutput: boolean;
2262
+ }
2263
+ ```
2264
+
2265
+ ```typescript
2266
+ interface IParticipant {
2267
+ id?: string;
2268
+ name?: string;
2269
+ type?: IParticipantType;
2270
+ color?: string;
2271
+ avatar?: Avatar;
2272
+ shapeNum?: number;
2273
+ }
2274
+ ```
2275
+
2276
+ ```typescript
2277
+ interface IMpParticipant{
2278
+ avatar: {
2279
+ model: string,
2280
+ thumbnail: string,
2281
+ },
2282
+ avatarConfig: {
2283
+ height: number,
2284
+ scale: number,
2285
+ laserOrigin: {x: number, y: number, z: number}
2286
+ },
2287
+ id: string,
2288
+ name: string,
2289
+ color?: string,
2290
+ shape?: PShapes,
2291
+ position: {x: number, y: number, z: number},
2292
+ rotation: {x: number, y: number, z: number},
2293
+ }
2294
+ ```
2295
+
2296
+
2297
+ ## Meeting Guide
1715
2298
 
1716
2299
  Hosting Live Virtual Meetings in 3D Space
1717
2300
 
@@ -1735,7 +2318,7 @@ atwin.createMeeting(
1735
2318
  )
1736
2319
  ````
1737
2320
 
1738
- The `createMeeting` method requires the following parameters to work.
2321
+ The [createMeeting()](#createmeeting) method requires the following parameters to work.
1739
2322
 
1740
2323
  | parameter | type | required | values |
1741
2324
  | :----: | :----: | :---: | :---: |
@@ -1781,7 +2364,7 @@ Note: `duration` can accept floating numbers like `1.5`. `1.5` is equivalent to
1781
2364
  </script>
1782
2365
  ````
1783
2366
 
1784
- Successfuly invoking the `createMeeting` method will return an object containing the meeting password, and meeting URL for host and guest which is used in another method called [startMeeting](#start-meeting).
2367
+ Successfuly invoking the [createMeeting()](#createmeeting) method will return an object containing the meeting password, and meeting URL for host and guest which is used in another method called [startMeeting()](#startmeeting).
1785
2368
 
1786
2369
  *Return Example:*
1787
2370
  ````json
@@ -1795,11 +2378,11 @@ Successfuly invoking the `createMeeting` method will return an object containing
1795
2378
 
1796
2379
  ### Start Meeting
1797
2380
 
1798
- Star the meeting using `startMeeting` method.
2381
+ Star the meeting using [startMeeting()](#startmeeting) method.
1799
2382
  ````typescript
1800
2383
  atwin.startMeeting(meetingUrl: string, meetingPassword?: string, meetingConfig?: MeetingConfig)
1801
2384
  ````
1802
- The `startMeeting` method requires the following parameters to work.
2385
+ The [startMeeting()](#startmeeting) method requires the following parameters to work.
1803
2386
 
1804
2387
  | parameter | type | required | values |
1805
2388
  | :----: | :----: | :---: | :---: |
@@ -1807,9 +2390,9 @@ The `startMeeting` method requires the following parameters to work.
1807
2390
  | meetingPassword | string | no | any string|
1808
2391
  | meetingConfig | MeetingConfig | no | MeetingConfig object |
1809
2392
 
1810
- This `startMeeting` method will initialize the meeting and display pre-meeting settings.
2393
+ This [startMeeting()](#startmeeting) method will initialize the meeting and display pre-meeting settings.
1811
2394
 
1812
- `meetingUrl` : string - The URL that is generated from `createMeeting` method.
2395
+ `meetingUrl` : string - The URL that is generated from [createMeeting()](#createmeeting) method.
1813
2396
 
1814
2397
  `meetingPassword` : string - The password set during creation of the meeting.
1815
2398
 
@@ -1837,17 +2420,17 @@ atwin.startMeeting(
1837
2420
  }
1838
2421
  )
1839
2422
  ````
1840
- Successfuly invoking the `startMeeting` method will start the meeting.
2423
+ Successfuly invoking the [startMeeting()](#startmeeting) method will start the meeting.
1841
2424
 
1842
2425
  ### Stop Meeting
1843
2426
  ````typescript
1844
2427
  atwin.stopMeeting()
1845
2428
  ````
1846
- To end the current or initialized meeting use `stopMeeting` method.
2429
+ To end the current or initialized meeting use [stopMeeting()](#stopmeeting) method.
1847
2430
 
1848
- Note: `stopMeeting` method will have the same result of using hang-up button in meeting session control.
2431
+ Note: [stopMeeting()](#stopmeeting) method will have the same result of using hang-up button in meeting session control.
1849
2432
 
1850
- ### Utility Methods
2433
+ ### Meeting Utility Methods
1851
2434
 
1852
2435
  **Get Meeting Participants**
1853
2436
  ````typescript
@@ -2138,423 +2721,1648 @@ export const enum MeetingStatus {
2138
2721
  STOPPED = 2,
2139
2722
  CANCELLED = 3,
2140
2723
  }
2141
- ```` -->
2724
+ ````
2142
2725
 
2143
2726
  ## Function Reference
2144
-
2145
2727
  Some Functions are **async**; when invoking them, Use keyword **await** or **.then** syntax
2728
+ _______
2729
+
2730
+ ### Space
2731
+
2732
+ #### connectSpace()
2733
+ Connect and load a 3D space into an HTML iframe asynchronously using this function. It initializes various configuration settings and view modes based on the provided parameters.
2146
2734
 
2147
- --------------------------
2148
2735
  ```typescript
2149
- disconnectSpace()
2150
- // disconnects and clear currently displayed Space
2151
- // this is an async function that returns a Promise
2736
+ async function connectSpace(
2737
+ url: string,
2738
+ auth: { apiURL?: string; apiKey: string; user: IUser } | null,
2739
+ config: IMPConfig,
2740
+ callbacks: { onLoad: Function; onStart: Function; onPlay: Function } | undefined = undefined
2741
+ ): Promise<void>
2152
2742
  ```
2153
2743
 
2154
- #### Tags
2155
- ````typescript
2156
- gotoTag(space: ISpace)
2157
- // returns an array of an array of ITag containing information of all tags in the space. Please take note that this function is executed internally when the space is loaded and you can access the tag data via calling atwin.tags
2158
- // this is an async function that requires a Tag ID param and returns a Promise
2744
+ | parameter | type | required | default | values |
2745
+ | :----: | :----: | :---: | :---: | :---: |
2746
+ | url | string | yes | | valid space URL |
2747
+ | auth | { string; string; IUser } | yes | | |
2748
+ | config | IMPConfig | yes | | |
2159
2749
 
2160
- atwin.tags - // variable containing an array of ITag
2750
+ **url** - the URL of the space you wish to connect to.
2161
2751
 
2162
- gotoTag(tagId: number)
2163
- // transport navigate directly to the tag with given ID
2164
- // this is an async function that requires a Tag ID param and returns a Promise
2752
+ - The [connectSpace](#connectSpace) method can also accomodate the following URL parameters:
2753
+ - "objectId" : ID of the object
2754
+ * If the 'objectId' is present in the URL with a value, the camera location will immediately navigate to the specific object within the 3D space after loading. This specific object will be identified using the value of the 'objectId' parameter.
2165
2755
 
2166
- goToRandomTag()
2167
- // go to a random tag inside the space
2168
- // this is a void function
2169
- ````
2170
- ### Sweeps
2171
- ````typescript
2172
- getSweeps()
2173
- // returns an array of ISweep, please note that this function is executed internally upon starting the space and you can just get the sweep data by calling the atwin.sweeps
2174
- // this is an async function that requires a Sweep ID then returns a Promise
2756
+ - "tag" : ID of the tag
2757
+ * In cases where the 'tag' is included in the URL with an assigned value, the camera location will swiftly adjust to the specified tag within the 3D space once the loading is complete. The particular tag to focus on will be determined by the value of the 'tag' parameter.
2175
2758
 
2176
- atwin.sweeps
2177
- // variable containg an array of ISweep data
2759
+ - "sweep" : ID of the sweep
2760
+ * If the 'sweep' is present in the URL with a value, the camera location will immediately navigate to the specific sweep within the 3D space after loading. This specific sweep will be identified using the value of the 'sweep' parameter.
2178
2761
 
2179
- moveToSweep(sweepId: string)
2180
- // transport navigate directly to the Sweep with given ID.
2181
- // this is an async function that requires a Sweep ID then returns a Promise
2762
+ - "brand" : 0 | 1
2763
+ * 0 : Remove the 'Presented By' information upon model launch. Additionally, hide contact details within the "About" panel located in the upper-left corner of the 3D Showcase interface.
2764
+ * 1 (Default) : Show all branding-related information within the "About" panel positioned at the top-left corner of the 3D Showcase interface.
2182
2765
 
2183
- moveToSweep(sweepId: string)
2184
- // transport navigate directly to the Sweep with given ID.
2185
- // this is an async function that requires a Sweep ID then returns a Promise
2766
+ - "hr" : 0 | 1
2767
+ * 0 : Hide the highlight reel located at the bottom of the 3D Showcase user interface.
2768
+ * 1 (Default) : Dispaly highlight reel
2186
2769
 
2187
- getNearbySweeps(sweepId: string)
2188
- // returns the nearby or neighbors of a given sweep.
2189
- // this is an async function that requires a Sweep ID then returns a Promise
2770
+ - "tour" : 0 | 1 | 2 | 3
2771
+ * 0 : Tour controls and highlight reel will not be visible.
2772
+ * 1 (Default) : The saved tour mode within the model is used.
2773
+ * 2 : Story mode tour is used.
2774
+ * 3: Highlight reel mode tour is used.
2190
2775
 
2191
- getCurrentSweep()
2192
- // returns the current sweep detail
2193
- // this is a function
2776
+ - "dh" : 0 | 1
2777
+ * 0 : Hide the Dollhouse View during the introductory fly-in. Additionally, hide the Dollhouse Button located in the bottom left corner of the 3D Showcase user interface. Moreover, remove the snapshots of the Dollhouse and Floorplan views from the highlight reel.
2778
+ * 1 (Default) : Display Dollhouse View
2194
2779
 
2195
- getSweepPosition(): {x: number, y: number, z: number}
2196
- // returns the position of the current sweep:
2197
- // this is a function
2780
+ - "tagNav" : 0 | 1
2781
+ * 0 : Removes the < and > buttons from Tags and disables navigation through Tags using the "," and "." keys.
2782
+ * 1 (Default): Displays the < and > buttons for Tags and permits navigation through Tags using the "," and "." keys.
2198
2783
 
2199
- goToRandomSweep()
2200
- // move to a random sweep inside the space
2201
- // this is a void function
2202
- ````
2784
+ - "mt" : 0 | 1
2785
+ * 0 : Conceal Mattertags and "Mattertag™ Content" toggle in the "About" panel.
2786
+ * 1 (Default) : Display Mattertag™ Posts
2203
2787
 
2204
- **Example:**
2205
- ````typescript
2206
- <script lang="ts">
2207
- import * as atwin from 'architwin';
2788
+ - "mls": 0 | 1 | 2
2789
+ * 0 (Default) : Show branding information, links in Mattertag™ Posts, and VR.
2790
+ * 1 : Show the MLS-friendly version of the Matterport model. This hides branding, hides links in Mattertag™ Posts, and hides VR.
2791
+ * 2 : Same behavior as &mls=1 but also hides the "About" panel in the top-left corner after loading.
2208
2792
 
2209
- ...
2210
-
2211
- // get current sweep data
2212
- atwin.getCurrentSweep()
2793
+ - "f" : 0 | 1
2794
+ * 0 : Hide the option to switch floors. This treats the Matterport model as "all one floor".
2795
+ * 1 (Default) : Allow the user navigate the 3D model floor by floor.
2213
2796
 
2214
- // get current sweep position
2215
- atwin.getSweepPosition()
2797
+ - "fp" : 0 | 1
2798
+ * 0 : Hide the floor plan view button from the bottom-left corner of the 3D Showcase UI.
2799
+ * 1 (Default) : Display the floor plan view button in the bottom-left corner of the 3D Showcase UI.
2216
2800
 
2217
- // moving to a Sweep
2218
- await atwin.moveToSweep('mfj45ligf')
2801
+ - "search" : 0 | 1
2802
+ * 0 : Hide the magnifying glass (search) icon from the upper-left corner of the 3D Showcase UI.
2803
+ * 1 (Default) : Display the magnifying glass (search) icon in the upper-left corner of the 3D Showcase UI. If Space Search is disabled at the account level, this parameter has no effect.
2804
+
2805
+ - "title" : 0 | 1
2806
+ * 0 : The space title is not being shown, and the top-left about panel is also not visible.
2807
+ * 1 (Default) : "The space title is being shown. The top-left about panel is visible."
2219
2808
 
2220
- // get nearby sweeps from current Sweep
2221
- await atwin.getNearbySweeps('mfj45ligf')
2809
+ - "vr" : 0 | 1
2810
+ * 0 : Remove the VR button.
2811
+ * 1 (Default) : Display the VR button.
2222
2812
 
2223
- // move to a random sweep
2224
- goToRandomSweep()
2225
-
2226
- ...
2227
2813
 
2228
- </script>
2229
- ````
2814
+ If the parameters 'objectId,' 'tag,' and 'sweep' are present in the URL with values, the first parameter among the three will be accommodated based on the URL structure.
2230
2815
 
2231
- ### Video
2232
- ````typescript
2233
- playVideo(videoId: number)
2234
- // play a video screen
2235
- // this is a function
2236
-
2237
- pauseVideo(videoId: number)
2238
- // pause a video screen
2239
- // this is a function
2240
-
2241
- setVideoPlayback(action: 'play' | 'pause' | 'mute' | 'unmute', element: HTMLVideoElement) -
2242
- // action - can be play, pause, mute or unmute
2243
- // element - can be HTMLVideoElemens such as
2244
- // this is a function
2245
- ````
2816
+ **auth** - an authentication object with the apiKey and user credentials. Default user credentials will be provided by ArchiTwin for testing which you can change anytime to your own user credentials. The auth object passed to the `connectSpace` method may consist of the following keys:
2246
2817
 
2247
- **Example:**
2248
- ````typescript
2249
- <script lang="ts">
2250
- import * as atwin from 'architwin';
2818
+ - apiURL: (string) an optional key which if set, will point all internal API calls to the api endpoint or base URL you assign. If this is not set, all api calls will be directed to the proxy address set in the `vite.config.ts` file during **local development**. Example: `apiURL: "apps.awesomesite.com/api"` will resolve internally to `apps.awesomesite.com/api/cas/tickets?someparams` or `apps.awesomesite.com/api/v1/showcase/id/1`. It is important to add `/api` to the base url of your custom apiURL to ensure the api requests are properly sent. There is no need to add a forward slash at the end of our custom apiURL. Please take note that you *may* have to setup a proxy server to bypass CORS issues when you deploy your application on your production servers
2819
+ - apiKey: (string) sets the required apiKey that is inserted into the authorization headers of each API request
2820
+ - user: (IUser | Object) an object that contains the `email` and `password` of the user.
2251
2821
 
2252
- ...
2822
+ **config** - a config object to set some default space behavior. You can learn more about the config object below.
2253
2823
 
2254
- // play a video
2255
- atwin.playVideo(1)
2824
+ **Config Options**
2256
2825
 
2257
- // pause a video
2258
- atwin.pauseVideo(2)
2826
+ ```typescript
2827
+ export interface IMPConfig{
2828
+ iframeId: string, // required
2829
+ appKey?: string,
2830
+ bundlePath?: string,
2831
+ viewMode?: string
2832
+ play?: 0 | 1,
2833
+ qs?: 0 | 1,
2834
+ tour?: 0 | 1 | 2 | 3,
2835
+ vr?: 0 | 1,
2836
+ mapConfig?: {
2837
+ mapId: string
2838
+ position?: string //topRight | topLeft | bottomRight | bottomLeft
2839
+ fixedSized: {
2840
+ width: number //Numerical pixel values
2841
+ height?: number //Numerical pixel values
2842
+ }
2843
+ zIndex?: number
2844
+ }
2845
+ }
2846
+ ```
2259
2847
 
2260
- // play a video screen
2261
- atwin.setVideoPlayback('play', atwin.selectedObject.component.planeElement)
2848
+ **iframeId:** string: The `id` of the target iframe where the 3D space will be loaded into.
2262
2849
 
2263
- // pause a video screen
2264
- atwin.setVideoPlayback('pause', atwin.selectedObject.component.planeElement)
2850
+ **appKey:** your appKey is used to authenticate your connection when loading the 3D showcase. For security purposes, the appKey can only be used by a domain (e.g. awesomesite.com) it is associated with. This key is important especially when you launch your app in production and utilize your own site domain. Please contact us to request your appKey
2265
2851
 
2266
- // mute a video screen
2267
- atwin.setVideoPlayback('mute', atwin.selectedObject.component.planeElement)
2852
+ **bundlePath?:** string: bundlePath is an optional key that can be set for projects whose project structure requires a custom path to the bundle SDK provided by matterport. If not set, the package will by default set the bundle path to the bundle SDK found inside the architwin package in node_modules.
2268
2853
 
2269
- // unmute a video screen
2270
- atwin.setVideoPlayback('unmute', atwin.selectedObject.component.planeElement)
2854
+ **viewMode** string: viewMode is an optional key that enables and disables [transform controls](#transforming-objects) in your 3D space. If the value of viewMode is not set, it will default to setting the viewMode to 'public' which disables transform controls. To enable the ability to transform objects using the transform control axis UI, you must set viewMode to 'interactive'
2271
2855
 
2272
- ...
2856
+ *Example:*
2273
2857
 
2274
- </script>
2275
- ````
2276
- ### Navigation
2277
- ````typescript
2278
- cameraLookAt(x: number,y: number)
2279
- // set camera view at coordinate in SCREEN.
2280
- // x and y is in pixel valuews from top left corner of the space canvas
2281
- // this is an async function and returns a Promise
2282
-
2283
- moveInDirection(direction: string)
2284
- // move in DIRECTION, can be LEFT, RIGTH, UP, DOWN, FORWARD, BACKWARD
2285
- // this is an async function and returns a Promise
2286
-
2287
- getViewMode()
2288
- // returns the current View Mode of the space.
2289
- // there are three modes:
2290
- // "mode.inside" - shows the interior view of the space
2291
- // "mode.floorplan" - shows the floor plan of the space
2292
- // "mode.dollhouse" - shows the doll house view
2293
- // this is a function
2294
-
2295
- setViewMode(mode: string)
2296
- // to set the viewing mode to "INSIDE", "FLOORPLAN" or "DOLLHOUSE"
2297
- // this is an async function and returns a Promise
2298
- ````
2858
+ `bundlePath: "assets/customBundleName"`
2299
2859
 
2860
+ This will resolve internally to `"assets/customBundleName/showcase.html?someparams"`
2300
2861
 
2301
- ### Camera
2302
- ````typescript
2303
- getCurrentCameraPose()
2304
- // returns the current camera Pose object
2305
- // this is a function
2306
-
2307
- getCameraPosition()
2308
- // returns the current camera Position {x,y,z}
2309
- // this is a function
2310
-
2311
- cameraPan(x: number, z: number)
2312
- // pan (z-axis) makes the camera look left and right. tilt (x-axis) the camera look up and down.
2313
- // x and z are angles in degrees
2314
- // this is an async function and returns a Promise
2315
-
2316
- cameraRotate(x: number, y: number, speed: number)
2317
- // rotates the camera view, x and y is rotation in horizontal
2318
- // and vertical rotation in degrees
2319
- // this is an async function and returns a Promise
2320
- ````
2862
+ **play?:** 0 | 1, default = 0
2863
+
2864
+ - 0 Shows a Play button ▶️️ on the iframe. The user must press the Play button ▶️️ to open the Matterport model.
2865
+ - 1 Automatically opens the Matterport model when the iframe loads on the page. If the 3D Showcase is opened via a link (not embedded in an iframe), this option is chosen automatically. When embedding Showcase within an iframe, play=1 will only work if the iframe is large enough on the user’s screen to provide a good user experience. Specifically, on mobile devices, the iframe has to cover at least 60% of the screen.
2866
+
2867
+ **qs?:** 0 | 1, default = 0
2868
+
2869
+ - 0 Disable Quickstart (when the Matterport model first opens, zoom in from Dollhouse View).
2870
+ - 1 Enable Quickstart (when the Matterport model first opens, go straight into Inside View). Learn more. Only works if Start Position is Inside View.
2871
+
2872
+ **tour?:** 0 | 1 | 2 | 3, default = 1
2873
+ - 0 No tour controls or highlight reel appear.
2874
+ - 1 The tour mode saved in the model is used.
2875
+ - 2 Story mode tour is used.
2876
+ - 3 Highlight reel mode tour is used.
2877
+
2878
+ **vr?:** 0 | 1, default = 1
2879
+ - 0 Hide the VR button.
2880
+ - 1 Default Show the VR button.
2321
2881
 
2322
2882
  **Example:**
2323
- ````typescript
2324
- <script lang="ts">
2325
- import * as atwin from 'architwin';
2883
+ ```javascript
2884
+ import * as atwin from 'architwin'
2326
2885
 
2327
- ...
2886
+ // public URL for the space, you will be provided an API Endpoint for the list of public spaces
2887
+ const spaceUrl = "https://basic-dev.rev-kitten.com/showcase/model3d_public/1?token=e707880f-0fc5-48a6-b3f6-643a19f81464"
2888
+
2889
+ const auth = {
2890
+ apiURL: "YOUR-API-URL", //Set the url to make api requests to
2891
+ apiKey: "YOUR-API-KEY", //xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
2892
+ user: {
2893
+ email: 'su@email.com',
2894
+ password: 'su123'
2895
+ }
2896
+ }
2897
+
2898
+ const config = {
2899
+ iframeId: "mp-showcase", // this is required
2900
+ // ... other config options.
2901
+ }
2328
2902
 
2329
- // get current Camera Pose
2330
- atwin.getCurrentCameraPose()
2903
+ await atwin.connectSpace(url, auth, config)
2904
+ ```
2331
2905
 
2332
- // get current camera position
2333
- atwin.getCameraPosition()
2906
+ **Minimap Config**
2334
2907
 
2335
- // set Camera View
2336
- await atwin.cameraLookAt(0, 10)
2908
+ You can enable a minimap display of your 3D space by setting the following key-values in your config object that you pass into the `connectSpace` method
2337
2909
 
2338
- // move in different Directions
2339
- await atwin.moveInDirection("FORWARD")
2910
+ ```typescript
2911
+ const config = {
2912
+ //Other config values...
2913
+ mapConfig: {
2914
+ mapId: 'at-map', //required
2915
+ position: 'topLeft',
2916
+ }
2917
+ } as IMPConfig;
2918
+ ```
2340
2919
 
2341
- // pan around z axis (pan and tilt only works in Dollhouse mode)
2342
- await atwin.cameraPan(0,20)
2920
+ To ensure that you will not encounter any errors. Make sure to follow the prescribed markup structure under the [defining an iFrame section](#define-an-iframe-as-target-for-the-showcase). All CSS classes or ids used internally by the library will have an `at_` prefix for classes and an `at-` for ids. The classes and ids are named this way to avoid any naming conflicts with your apps own CSS classes or ids.
2343
2921
 
2344
- // tilt abpout x axis
2345
- await atwin.cameraPan(30,0)
2922
+ You can technically forego the at_showcase_container class of the parent div with your own class. Just make sure it has the `position` attribute set to `relative` otherwise things may not position correctly.
2346
2923
 
2347
- // rotate around X axis, last parameter is the Speed of rotation in seconds
2348
- await atwin.cameraRotate(20,0,2)
2924
+ **mapConfig Options**
2349
2925
 
2350
- // rotate around Y axis
2351
- await atwin.cameraRotate(20,5,2)
2926
+ - **mapId** - The id attribute value of the div element that will hold the map.
2927
+ - **position** - (optional) Specify where to place the minimap. Valid positions are topLeft, topRight, bottomRight, bottomLeft. By default, the map is placed at the topRight corner if this value is not set.
2928
+ - **fixedSized** - (optional) Specify a fixed width of the minimap. By default, the minimap has width of 100px and expands to 250px upon mouse hover. Please take note that setting a fixed width of your minimap will disable the hover-to-expand animation. Any numberic value you provide will be translated into pixel units
2352
2929
 
2353
- // get current View
2354
- atwin.getViewMode()
2930
+ Example:
2355
2931
 
2356
- // set View Mode
2357
- await atwin.setViewMode("INSIDE")
2358
- await atwin.setViewMode("FLOORPLAN")
2359
- await atwin.setViewMode("DOLLHOUSE")
2932
+ ```typescript
2933
+ const config = {
2934
+ //Other config values...
2935
+ mapConfig: {
2936
+ mapId: 'at-map', //required
2937
+ position: 'topLeft',
2938
+ fixedSized:{
2939
+ width: 300
2940
+ }
2941
+ }
2942
+ } as IMPConfig;
2943
+ ```
2944
+ - **zIndex** - (optional) Set the z-index of the map. In cases where you have UI elements that coincide with the position of the minimap. You set the z-index value of the minimap to determine what order the minimap should be rendered.
2360
2945
 
2361
- ...
2362
2946
 
2363
- </script>
2364
- ````
2947
+ #### disconnectSpace()
2365
2948
 
2366
- ### Objects
2949
+ Utilize this asynchronous function for disconnecting and efficiently cleaning up resources linked to the connected 3D space. It stops any playing videos, disposes of tags, clears objects and states, and ultimately disconnects while clearing the currently displayed Space.
2367
2950
 
2951
+ *Function Signature*
2952
+ ```typescript
2953
+ async function disconnectSpace(): Promise<void>
2954
+ ```
2368
2955
 
2956
+ *Example*
2369
2957
  ````typescript
2370
- getNearbyObjects(type?: '3DX' | 'SLIDESHOW' | 'VIDEO', distance?: number = 2)
2371
- // returns a list of nearby objects
2372
- // type - can be 3Dx, Slideshow or Video; parameter is optional. if no parameter is passed, it returns all objects
2373
- // distance - is optional but with a default of 2 meters
2374
- // this is a function
2375
-
2376
- addObjectToSpace(object:I3DObject | undefined, option:Object)
2377
- // object - accepts I3DObject or undefined
2378
- // option - accepts an Object. Default is null
2379
- // this is an async function that returns a Promise
2380
-
2381
- addMediaScreen(mediaUrl?: string, transform:Object3DPosition, readonly?:boolean, autoplay?:boolean)
2382
- // creates a 2D object that can be used to display a wide variety images or videos dynamically
2383
- // mediaUrl - optional but default is empty string
2384
- // transform - optional but default is null
2385
- // readonly - optional but default is false
2386
- // autoplay - optional but default is false
2387
- // this is an async function
2388
-
2389
- setTransformMode(mode: 'translate' | 'scale' | 'rotate')
2390
- // sets the transform mode of the selected object
2391
- // mode - can be translate, scale or rotate
2392
- // this is an async function
2393
-
2394
- revertTransform(action: 'undo' | 'redo')
2395
- // action - can be undo or redo
2396
- // returns a boolean
2397
-
2398
- clearTransformControls()
2399
- // clears the transform component attached to the selected object
2400
-
2401
- setAnimationState(action: 'play' | 'stop', target:I3DObject)
2402
- // sets the animation state of a 3D model
2403
- // action - can be play or stop
2404
- // this is a function
2405
-
2406
- showObjectDimensions(selected:IObjectData)
2407
- // shows the width, height, depth of a 3D model
2408
- // this is a function
2409
-
2410
- copyObject(payload:IShowcaseObject, position_offset:Vector3 | undefined, rotation_offset:Vector3 | undefined)
2411
- // copies the the selected objecte
2412
- // payload - the payload of the selected object
2413
- // position_offset - optional; the offset of the position on where to add the object in the space
2414
- // rotation_offset - optional; the offset of the rotation of the object
2415
- // this is an async function
2416
-
2417
- addObject(payload:FileUpload)
2418
- // adds object from the database
2419
- // payload - payload for the file to be uploaded
2420
- // this is an async function that returns a Promise<I3DObject>
2421
-
2422
- getObject(id:number)
2423
- // retrieves object from the database
2424
- // id - the unique id of the object
2425
- // this is an async function that returns a Promise<I3DObject>
2426
-
2427
- updateObject(id:number,payload:FileUpload)
2428
- // updates object from the database
2429
- // id - the unique id of the object
2430
- // payload - payload for the file to be uploaded
2431
- // this is an async function that returns a Promise<I3DObject>
2432
-
2433
- deleteObject(id:number)
2434
- // deletes object from the database
2435
- // id - the unique id of the object
2436
- // this is an async function
2437
-
2438
- deleteObjectFromSpace(selected:IObjectData)
2439
- // deleted object from space
2440
- // selected - the selected or target object to be removed
2441
- // this is an async functon
2442
-
2443
- replaceObject(payload:I3DObject, target:IObjectData, options:Object = null)
2444
- // replaces the object in the space with another object
2445
- // payload - the new object to replace the target object
2446
- // target - the object to be replaced
2447
- // options - optional; options to pass into the loader
2448
- // this is an async function
2449
-
2450
- addTextMarkupScreen(title:string, message:string, textScreenName:string, transform:Object3DPosition, textColor:string, backgroundColor:string
2451
- )
2452
- // adds a text frame in the pace
2453
- // title - title of the message
2454
- // message - message content
2455
- // textScreenName - name of the text frame.
2456
- // transform - x,y,x values for position, rotation, and scale
2457
- // textColor - optional; valid color value
2458
- // backgroundColor - optional; valid background color value
2459
- // this is an async function
2460
-
2461
- setTextMarkupScreenContent(showcase_id:string, title:string, text:string, textColor:string, backgroundColor:string)
2462
- // updates the style and content of the text frame
2463
- // showcase_id - showcase id of the target object
2464
- // title - title of your content
2465
- // text - body of the text content
2466
- // textColor - optional; set the color of the text
2467
- // backgroundColor - optional; set the color of the background
2468
- // this is a function
2958
+ import * as atwin from 'architwin'
2469
2959
 
2960
+ atwin.disconnectSpace();
2470
2961
  ````
2962
+ -----
2963
+ ### Tags
2471
2964
 
2472
- **Example**
2473
- ````typescript
2474
- <script lang="ts">
2475
- import * as atwin from 'architwin';
2476
- import type { Object3DPosition } from '../../architwin/src/types';
2477
- ...
2965
+ #### getTags()
2966
+
2967
+ This method returns an array of `ITag` containing information of all tags in the space.
2478
2968
 
2479
- // get all nearby objects
2480
- atwin.getNearbyObjects()
2969
+ *Function Signature*
2970
+ ```typescript
2971
+ async function getTags(space: ISpace): Promise<ITag[] | null>;
2972
+ ```
2973
+
2974
+ *Parameter Table*
2975
+ | parameter | type | required | default | values |
2976
+ | :----: | :----: | :---: | :---: | :---: |
2977
+ | space | ISpace | yes | | |
2481
2978
 
2482
- // get all nearby 3dx objects
2483
- atwin.getNearbyObjects('3DX')
2979
+ *Example*
2980
+ ```typescript
2981
+ import * as atwin from 'architwin'
2484
2982
 
2485
- // get all slideshow objects
2486
- atwin.getNearbyObjects('SLIDESHOW')
2983
+ const space = /* specify the space object */;
2984
+ const tags = await atwin.getTags(space);
2985
+ if (tags) {
2986
+ console.log('Tags:', tags);
2987
+ } else {
2988
+ console.log('No tags found or an error occurred.');
2989
+ }
2990
+ ```
2487
2991
 
2488
- // get all video screen objects
2489
- atwin.getNearbyObjects('VIDEO')
2490
2992
 
2491
- // get all video screen objects with distance
2492
- atwin.getNearbyObjects('3DX', 3)
2993
+ #### gotoTag()
2493
2994
 
2494
- // creates pre-existing 2D/3D from the DB to the 3D space
2495
- await atwin.addObjectToSpace(objectPayload)
2995
+ This method enables direct navigation to the tag within the space, identified by a specific ID.
2496
2996
 
2497
- // creates a 2D Frame Object
2498
- atwin.addMediaScreen()
2997
+ *Function Signature*
2998
+ ```typescript
2999
+ async function gotoTag(tagId: string): Promise<void>
3000
+ ```
2499
3001
 
2500
- // translates object
2501
- atwin.setTransformMode('translate')
3002
+ *Parameter Table*
3003
+ | parameter | type | required | default | values |
3004
+ | :----: | :---: | :---: | :---: | :---: |
3005
+ | tagId | string | yes | | any string |
2502
3006
 
2503
- // scales object
2504
- atwin.setTransformMode('scale')
3007
+ *Example*
3008
+ ```typescript
3009
+ import * as atwin from 'architwin'
2505
3010
 
2506
- // rotates object
2507
- atwin.setTransformMode('rotate')
3011
+ const tagId = /* specify the tag ID */;
3012
+ await atwin.gotoTag(tagId);
3013
+ ```
2508
3014
 
2509
- // undo object transformation
2510
- atwin.revertTransform('undo')
2511
-
2512
- // redo object transformation
2513
- atwin.revertTranform('redo')
3015
+ -----
2514
3016
 
2515
- // clears the transform component
2516
- atwin.clearTransformControls()
3017
+ ### Sweeps
2517
3018
 
2518
- // play object animation
2519
- atwin.setAnimationState('play', atwin.selectedObject.object.object_data)
3019
+ #### getSweeps()
2520
3020
 
2521
- // pause object animation
2522
- atwin.setAnimationState('pause', atwin.selectedObject.object.object_data)
3021
+ Retrieve information about the sweeps (viewpoints) within the loaded 3D space using this asynchronous method.
2523
3022
 
2524
- // show object dimension
2525
- atwin.showObjectDimensions(atwin.selectedObject)
3023
+ *Function Signature*
3024
+ ```typescript
3025
+ async function getSweeps(): Promise<ISweep[] | null>
3026
+ ```
2526
3027
 
2527
- // create a duplicate to an existing object in the space
2528
- await atwin.copyObject(objectPayload)
3028
+ *Example*
3029
+ ```typescript
3030
+ import * as atwin from 'architwin'
2529
3031
 
2530
- // adds an object to the database
2531
- await atwin.addObject(objectPayload)
3032
+ const sweeps = await atwin.getSweeps();
3033
+ if (sweeps) {
3034
+ console.log('Sweeps:', sweeps);
3035
+ } else {
3036
+ console.log('No sweeps found in the loaded space.');
3037
+ }
3038
+ ```
2532
3039
 
2533
- // gets an object from the database
2534
- await atwin.getObject(objectID)
3040
+ #### moveToSweep()
2535
3041
 
2536
- // updates an existing object from the database
2537
- await atwin.updateObject(objectID, objectPayload)
3042
+ This asynchronous function moves the camera location to a specific sweep (viewpoint) within the loaded 3D space.
2538
3043
 
2539
- // deletes an object from the database
2540
- await atwin.deleteObject(objectID)
3044
+ *Function Signature*
3045
+ ```typescript
3046
+ async function moveToSweep(sweepId: string): Promise<void>
3047
+ ```
2541
3048
 
2542
- // deletes an object from the space
2543
- await atwin.deleteObjectFromSpace(atwin.selectedObject)
3049
+ *Parameter Table*
3050
+ | parameter | type | required | default | values |
3051
+ | :----: | :----: | :---: | :---: | :---: |
3052
+ | sweepId | string | yes | | Id of the sweep |
2544
3053
 
2545
- // replaces an object in the space
2546
- await atwin.replaceObject(objectData, atwin.selectedObject)
3054
+ *Example*
3055
+ ```typescript
3056
+ import * as atwin from 'architwin'
2547
3057
 
2548
- // adds a text frame in the pace
2549
- await atwin.addTextMarkupScreen(title, message, transform, textColor, backgroundColor)
3058
+ const sweepId = /* specify the sweep ID */;
3059
+ await atwin.moveToSweep(sweepId);
3060
+ console.log('Camera view moved to sweep ' + sweepId);
3061
+ ```
2550
3062
 
2551
- // updates the style and content of the text frame
2552
- atwin.setTextMarkupScreenContent(id, title, text, textColor, backgroundColor)
2553
3063
 
2554
- ...
3064
+ #### getNearbySweeps()
2555
3065
 
2556
- </script>
2557
- ````
3066
+ Retrieve information about nearby sweeps (viewpoints) for a given sweep within the loaded 3D space using this asynchronous function.
3067
+
3068
+ *Function Signature*
3069
+ ```typescript
3070
+ async function getNearbySweeps(sweepId: string): Promise<string[] | undefined>
3071
+ ```
3072
+
3073
+ *Parameter Table*
3074
+ | parameter | type | required | default | values |
3075
+ | :----: | :----: | :---: | :---: | :---: |
3076
+ | sweepId | string | yes | | Id of the sweep |
3077
+
3078
+ *Example*
3079
+ ```typescript
3080
+ import * as atwin from 'architwin'
3081
+
3082
+ const sweepId = /* specify the sweep ID */;
3083
+ const nearbySweeps = await atwin.getNearbySweeps(sweepId);
3084
+ console.log('Nearby Sweeps:', nearbySweeps);
3085
+ ```
3086
+
3087
+ #### getCurrentSweep()
3088
+
3089
+ Obtain information about the current sweep that the camera view is focused on within the loaded 3D space using this function.
3090
+
3091
+ *Function Signature*
3092
+ ```typescript
3093
+ function getCurrentSweep(): ISweep
3094
+ ```
3095
+
3096
+ *Example*
3097
+ ```typescript
3098
+ import * as atwin from 'architwin'
3099
+
3100
+ const currentSweep = atwin.getCurrentSweep();
3101
+ console.log('Current Sweep:', currentSweep);
3102
+ ```
3103
+
3104
+ -----
3105
+
3106
+ ### Video
3107
+
3108
+ #### playVideo()
3109
+
3110
+ Initiate playback of a video object with a specified ID in the loaded 3D space using this function. It fetches the video object using the provided video ID and starts playback.
3111
+
3112
+ *Function Signature*
3113
+ ```typescript
3114
+ function playVideo(videoId: number): void
3115
+ ```
3116
+
3117
+ *Parameter Table*
3118
+ | parameter | type | required | default | values |
3119
+ | :----: | :----: | :---: | :---: | :---: |
3120
+ | videoId | number | yes | | Id of the video |
3121
+
3122
+ *Example*
3123
+ ```typescript
3124
+ import * as atwin from 'architwin'
3125
+
3126
+ const videoId = /* specify the video ID */;
3127
+ atwin.playVideo(videoId);
3128
+ ```
3129
+
3130
+ #### pauseVideo()
3131
+
3132
+ Pause playback of a video object with a specified ID in the loaded 3D space using this function. It retrieves the video object using the provided video ID and halts its playback.
3133
+
3134
+ *Function Signature*
3135
+ ```typescript
3136
+ function pauseVideo(videoId: number): void;
3137
+ ```
3138
+
3139
+ *Parameter Table*
3140
+ | parameter | type | required | default | values |
3141
+ | :----: | :----: | :---: | :---: | :---: |
3142
+ | videoId | number | yes | | Id of the video |
3143
+
3144
+ *Example*
3145
+ ```typescript
3146
+ import * as atwin from 'architwin'
3147
+
3148
+ const videoId = /* specify the video ID */;
3149
+ atwin.pauseVideo(videoId);
3150
+ ```
3151
+
3152
+ #### setVideoPlayback()
3153
+
3154
+ This function enables you to control the playback and mute state of an HTML video element by specifying an action. Supported actions include "play," "pause", "mute," and "unmute." The function modifies the playback and mute settings of the provided video element based on the action.
3155
+
3156
+ *Function Signature*
3157
+ ```typescript
3158
+ function setVideoPlayback(action: string, element: HTMLVideoElement): void;
3159
+ ```
3160
+
3161
+ *Parameter Table*
3162
+ | parameter | type | required | default | values |
3163
+ | :----: | :----: | :---: | :---: | :---: |
3164
+ | action | string | yes | | 'play' or 'pause' or 'mute' or 'unmute' |
3165
+ | element | HTMLVideoElement | yes | | HTML video element |
3166
+
3167
+ *Example*
3168
+ ```typescript
3169
+ import * as atwin from 'architwin'
3170
+
3171
+ const action = "play"; // Specify the desired action
3172
+ const videoElement = /* Specify the HTML video element */;
3173
+ atwin.setVideoPlayback(action, videoElement);
3174
+ ```
3175
+
3176
+ -----
3177
+
3178
+ ### Navigation
3179
+
3180
+ #### moveInDirection()
3181
+
3182
+ Move the camera within the space in a specified direction using this asynchronous function. Supported directions comprise 'LEFT,' 'RIGHT,' 'UP,' 'DOWN,' 'FORWARD,' and 'BACKWARD'.
3183
+
3184
+ *Function Signature*
3185
+ ```typescript
3186
+ async function moveInDirection(direction: string): Promise<void>;
3187
+ ```
3188
+
3189
+ *Parameter Table*
3190
+ | parameter | type | required | default | values |
3191
+ | :----: | :----: | :---: | :---: | :---: |
3192
+ | direction | string | yes | | "FORWARD" or "BACKWARD" or "LEFT" or "RIGHT" |
3193
+
3194
+ *Example*
3195
+ ```typescript
3196
+ import * as atwin from 'architwin'
3197
+
3198
+ const desiredDirection = "LEFT"; // Specify the desired direction
3199
+ atwin.moveInDirection(desiredDirection)
3200
+ .then(() => {
3201
+ console.log("Camera moved successfully!");
3202
+ })
3203
+ .catch(() => {
3204
+ console.error("Error occurred while moving the camera.");
3205
+ });
3206
+ ```
3207
+
3208
+ -----
3209
+
3210
+ ### Camera
3211
+
3212
+ #### getCurrentCameraPose()
3213
+
3214
+ Retrieve the current camera pose, including the details about the camera's spatial orientation and position within the space. The camera pose provides details about the camera's spatial location and orientation, allowing you to understand its position in the virtual environment.
3215
+
3216
+ *Function Signature*
3217
+ ```typescript
3218
+ function getCurrentCameraPose(): any;
3219
+ ```
3220
+
3221
+ *Example*
3222
+ ```typescript
3223
+ import * as atwin from 'architwin'
3224
+
3225
+ const cameraPose = atwin.getCurrentCameraPose();
3226
+ console.log("Current Camera Pose:", cameraPose);
3227
+ ```
3228
+
3229
+ #### getCameraPosition()
3230
+
3231
+ Retrieve the present camera position within the 3D space using this function. The function provides the coordinates (x, y, z) that signify the camera's placement in the 3D space.
3232
+
3233
+ *Function Signature*
3234
+ ```typescript
3235
+ function getCameraPosition(): Vector3;
3236
+ ```
3237
+
3238
+ *Example*
3239
+ ```typescript
3240
+ import * as atwin from 'architwin'
3241
+
3242
+ const cameraPosition = atwin.getCameraPosition();
3243
+ console.log("Current Camera Position:", cameraPosition);
3244
+ ```
3245
+
3246
+ #### cameraPan()
3247
+
3248
+ Pan the camera view adjustments by specifying rotation angles along both the horizontal and vertical axes using this function. The panning action simulates looking sideways left and right (horizontal) and looking up and down (vertical).
3249
+
3250
+ *Function Signature*
3251
+ ```typescript
3252
+ async function cameraPan(x: number, z: number): Promise<void>;
3253
+ ```
3254
+
3255
+ *Parameter Table*
3256
+ | parameter | type | required | default | values |
3257
+ | :----: | :----: | :---: | :---: | :---: |
3258
+ | x | number | yes | | number of degrees will pan the camera to the right |
3259
+ | y | number | yes | | number of degrees will tilt the camera upward |
3260
+
3261
+ *Example*
3262
+ ```typescript
3263
+ import * as atwin from 'architwin'
3264
+
3265
+ // Pan the camera by 30 degrees to the right and tilt by 10 degrees upward
3266
+ atwin.cameraPan(30, 10)
3267
+ .then(() => {
3268
+ console.log("Camera pan success");
3269
+ })
3270
+ .catch((error) => {
3271
+ console.error("Camera pan error:", error);
3272
+ });
3273
+ ```
3274
+
3275
+ #### cameraRotate()
3276
+ This function allows you to rotate the camera's view by specifying rotation angles along the horizontal and vertical axes. The rotation action simulates changing the direction the camera is facing.
3277
+
3278
+ *Function Signature*
3279
+ ```typescript
3280
+ async function cameraRotate(x: number, y: number, speed: number): Promise<void>;
3281
+ ```
3282
+
3283
+ *Parameter Table*
3284
+ | parameter | type | required | default | values |
3285
+ | :----: | :----: | :---: | :---: | :---: |
3286
+ | x | number | yes | | number of degrees will pan the camera to the right |
3287
+ | y | number | yes | | number of degrees will tilt the camera upward |
3288
+ | speed | number | yes | | number of second will camera animate to specified angle ( x , y) |
3289
+
3290
+ *Example*
3291
+ ```typescript
3292
+ import * as atwin from 'architwin'
3293
+
3294
+ // Rotate the camera by 45 degrees horizontally and 15 degrees vertically at a speed of 0.5
3295
+ cameraRotate(45, 15, 0.5)
3296
+ .then(() => {
3297
+ console.log("Camera rotate success");
3298
+ })
3299
+ .catch((error) => {
3300
+ console.error("Camera rotate error:", error);
3301
+ });
3302
+ ```
3303
+
3304
+ #### getViewMode()
3305
+
3306
+ Obtain the existing view mode of the Matterport scene using this function. The view mode illustrates the manner in which the scene is presented, which includes 3D walkthrough mode, dollhouse mode, or floor plan mode.
3307
+
3308
+ *Function Signature*
3309
+ ```typescript
3310
+ function getViewMode(): string | null;
3311
+ ```
3312
+
3313
+ *Example*
3314
+ ```typescript
3315
+ import * as atwin from 'architwin'
3316
+
3317
+ const currentViewMode = atwin.getViewMode();
3318
+ console.log("Current view mode:", currentViewMode);
3319
+ ```
3320
+
3321
+ #### setViewMode()
3322
+
3323
+ Change the current view mode of the 3D space scene to the designated mode using this function. The chosen view mode dictates the presentation style of the space, including options like 3D walkthrough mode, dollhouse mode, or floor plan mode.
3324
+
3325
+ *Function Signature*
3326
+ ```typescript
3327
+ async function setViewMode(mode: string): Promise<void>;
3328
+ ```
3329
+
3330
+ *Parameter Table*
3331
+ | parameter | type | required | default | values |
3332
+ | :----: | :----: | :---: | :---: | :---: |
3333
+ | mode | string | yes | | "dollhouse" or "floorplan" or "inside" or "outside" or "transitioning" |
3334
+
3335
+ *Example*
3336
+ ```typescript
3337
+ import * as atwin from 'architwin'
3338
+
3339
+ async function changeToDollhouseMode() {
3340
+ await atwin.setViewMode("dollhouse");
3341
+ console.log("Changed to Dollhouse mode");
3342
+ }
3343
+ ```
3344
+
3345
+ #### cameraLookAt()
3346
+
3347
+ This function adjusts the camera's view to focus on a specific point in the Matterport scene. The point is defined in screen coordinates, where x and y represent the pixel coordinates from the upper-left corner of the screen.
3348
+
3349
+ *Function Signature*
3350
+ ```typescript
3351
+ async function setViewMode(mode: string): Promise<void>;
3352
+ ```
3353
+
3354
+ *Example*
3355
+ ```typescript
3356
+ import * as atwin from 'architwin'
3357
+
3358
+ async function focusOnPoint(x, y) {
3359
+ await atwin.cameraLookAt(x, y);
3360
+ console.log("Camera focused on point", x, y);
3361
+ }
3362
+
3363
+ ```
3364
+
3365
+ #### captureSpaceScreenshot()
3366
+
3367
+ This function takes a screenshot (JPEG) of the user’s current space view. It creates a temporary download link for the screenshot image with the filename 'image.png', and then triggers the download.
3368
+
3369
+ *Function Signature*
3370
+ ```typescript
3371
+ async function captureSpaceScreenshot(resolution:Renderer.Resolution, visibility: Renderer.Visibility);
3372
+ ```
3373
+
3374
+ *Parameter Table*
3375
+ | parameter | type | required | default | values |
3376
+ | :----: | :----: | :---: | :---: | :---: |
3377
+ | resolution | Renderer.Resolution | optional | { width : 1920, height : 1080 } | { width : 600, height : 800 } or any values exceed to 4096 |
3378
+ | visibility | Renderer.Visbility | optional | { mattertags : false, measurements : false, sweeps: false, views : false } | {mattertags : true, measurements : false, sweeps: false, views : true} |
3379
+
3380
+ *Example*
3381
+ ```typescript
3382
+ import * as atwin from 'architwin'
3383
+
3384
+ async function captureSpace() {
3385
+ // The desired resolution for the screenshot. For example: {width: 1920, height: 1080} If no resolution is specified, then the resolution of the size of Showcase (the current window or the iframe embed) is used. Maximum 4096 x 4096.
3386
+ const resolution = {
3387
+ width : 1920,
3388
+ height : 1080
3389
+ }
3390
+
3391
+ // Toggles certain scene objects such as Mattertag Posts and sweep markers. If no visibility object is specified, then all scene objects are hidden.
3392
+ const visibility = {
3393
+ mattertags : true,
3394
+ measurements : false,
3395
+ sweeps: true,
3396
+ views : false
3397
+ }
3398
+
3399
+ // With Parameters:
3400
+ await atwin.captureSpaceScreenshot(resolution, visibility);
3401
+
3402
+ // Without Parameters
3403
+ await atwin.captureSpaceScreenshot();
3404
+
3405
+
3406
+ }
3407
+ ```
3408
+ -----
3409
+
3410
+ ### Objects
3411
+
3412
+ #### getNearbyObjects()
3413
+ The [getNearbyObjects()](#getnearbyobjects) method retrieves nearby rendered objects based on a given payload containing type and distance parameters. It calculates the distance between the camera position and the objects' positions and returns a categorized list of nearby objects.
3414
+
3415
+ *Function Signature*
3416
+ ```typescript
3417
+ function getNearbyObjects(payload: NearbyPayload): NearbyObjects
3418
+ ```
3419
+
3420
+ *Parameter Table*
3421
+ | parameter | type | required | default | values |
3422
+ | :----: | :----: | :---: | :---: | :---: |
3423
+ | payload | NearbyPayload | yes | none | '3DX' or 'SLIDESHOW' or 'VIDEO' |
3424
+
3425
+ *Example*
3426
+ ```typescript
3427
+ import * as atwin from 'architwin'
3428
+
3429
+ ...
3430
+ const payload = {
3431
+ type: "ALL",
3432
+ distance: 10
3433
+ } as NearbyPayload
3434
+
3435
+ // gets ALL object types within a 10 meter range
3436
+ const nearByObjects:NearbyObjects = atwin.getNearbyObjects(payload)
3437
+ ...
3438
+ ```
3439
+
3440
+ #### addObjectToSpace()
3441
+ Use this asynchronous void function to add a showcase object into a space. It accepts a media URL, object type, and optional configuration, and returns a promise resolving to the added showcase object. This function logs details about the process and validates the provided parameters.
3442
+
3443
+ *Function Signature*
3444
+ ```typescript
3445
+ async function addObjectToSpace(
3446
+ mediaUrl: string,
3447
+ objectType: string,
3448
+ config: ObjectConfig = undefined
3449
+ ): Promise<IShowcaseObject>
3450
+ ```
3451
+
3452
+ *Parameter Table*
3453
+ | parameter | type | required | default | values |
3454
+ | :----: | :----: | :---: | :---: | :---: |
3455
+ | mediaUrl | string | yes | none | |
3456
+ | objectType | string | yes | none | |
3457
+ | config | ObjectConfig | no | undefine | |
3458
+
3459
+ *Example*
3460
+ ```typescript
3461
+ import * as atwin from 'architwin'
3462
+
3463
+ const mediaUrl = 'https://example.com/media/sample.mp4';
3464
+ const objectType = 'VIDEO';
3465
+ const config = {
3466
+ /* configuration properties here */
3467
+ };
3468
+
3469
+ atwin.addObjectToSpace(mediaUrl, objectType, config)
3470
+ .then(showcaseObject => {
3471
+ console.log('Showcase object added:', showcaseObject);
3472
+ })
3473
+ .catch(error => {
3474
+ console.error('Error adding showcase object:', error);
3475
+ });
3476
+ ```
3477
+
3478
+ #### addMediaScreen()
3479
+ The [addMediaScreen()](#addmediascreen) method is asynchronous function allows you to add a media screen to the space. The media screen displays a media content specified by the mediaUrl parameter. You can customize the media screen's position, scale, and rotation using the transform parameter. Additional options such as readonly mode and autoplay can also be configured. This function logs information about the provided parameters and performs media handling.
3480
+
3481
+ *Function Signature*
3482
+ ```typescript
3483
+ async function addMediaScreen(
3484
+ mediaUrl?: string,
3485
+ transform?: { position: Vector3, scale: Vector3, rotation: Vector3 },
3486
+ readonly?: boolean,
3487
+ autoplay?: boolean
3488
+ ): Promise<IShowcaseObject>
3489
+ ```
3490
+
3491
+ *Parameter Table*
3492
+ | parameter | type | required | default | values |
3493
+ | :----: | :----: | :---: | :---: | :---: |
3494
+ | mediaUrl | string | no | | |
3495
+ | transform | { position: Vector3, scale: Vector3, rotation: Vector3 } | no | |
3496
+ | readonly | boolean | no | | |
3497
+ | autoplay | boolean | no | | |
3498
+
3499
+
3500
+ *Example*
3501
+ ```typescript
3502
+ import * as atwin from 'architwin'
3503
+
3504
+ const mediaUrl = 'https://example.com/media/sample.mp4';
3505
+ const transform = {
3506
+ position: new Vector3(0, 0, 0),
3507
+ scale: new Vector3(1, 1, 1),
3508
+ rotation: new Vector3(0, 0, 0)
3509
+ };
3510
+ const readonly = true;
3511
+ const autoplay = false;
3512
+
3513
+ awtwin.addMediaScreen(mediaUrl, transform, readonly, autoplay)
3514
+ .then(showcaseObject => {
3515
+ console.log('Media screen added:', showcaseObject);
3516
+ })
3517
+ .catch(error => {
3518
+ console.error('Error adding media screen:', error);
3519
+ });
3520
+ ```
3521
+
3522
+ #### setTransformMode()
3523
+ The [setTransformMode()](#settransformmode) asynchronous void function sets the transform mode for a specific type of transformation. The mode parameter defines the transformation mode, which can be translation, rotation, or scaling.
3524
+
3525
+ *Function Signature*
3526
+ ```typescript
3527
+ async function setTransformMode(mode: TRANSFORM_TYPE | string): Promise<void>
3528
+ ```
3529
+
3530
+ *Parameter Table*
3531
+ | parameter | type | required | default | values |
3532
+ | :----: | :----: | :---: | :---: | :---: |
3533
+ | mode | TRANSFORM_TYPE or string | yes | none |'translate' or 'scale' or 'rotate' |
3534
+
3535
+ *Example*
3536
+ ```typescript
3537
+ import * as atwin from 'architwin'
3538
+
3539
+ const desiredMode = TRANSFORM_TYPE.ROTATE;
3540
+
3541
+ atwin.setTransformMode(desiredMode)
3542
+ .then(() => {
3543
+ console.log('Transform mode set successfully:', desiredMode);
3544
+ })
3545
+ .catch(error => {
3546
+ console.error('Error setting transform mode:', error);
3547
+ });
3548
+ ```
3549
+
3550
+ #### revertTransform()
3551
+ The [revertTransform()](#reverttransform) function allows you to revert transformations applied to a selected object. The function retrieves previous or next transformation data from the history, applies it to the selected object, and updates the internal state.
3552
+
3553
+ *Function Signature*
3554
+ ```typescript
3555
+ function revertTransform(action: string = 'undo'): boolean
3556
+ ```
3557
+
3558
+ *Parameter Table*
3559
+ | parameter | type | required | default | values |
3560
+ | :----: | :----: | :---: | :---: | :---: |
3561
+ | action | string | yes | none |'undo' or 'redo'|
3562
+
3563
+ *Example*
3564
+ ```typescript
3565
+ import * as atwin from 'architwin'
3566
+
3567
+ // Revert to the previous state
3568
+ if (awtwin.revertTransform('undo')) {
3569
+ console.log('Reverted to previous state.');
3570
+ } else {
3571
+ console.log('No further undo actions available.');
3572
+ }
3573
+
3574
+ // Reapply a reverted state
3575
+ if (atwin.revertTransform('redo')) {
3576
+ console.log('Reapplied a reverted state.');
3577
+ } else {
3578
+ console.log('No further redo actions available.');
3579
+ }
3580
+ ```
3581
+
3582
+ #### removeTransformControls()
3583
+
3584
+ Use this function to remove transformation controls and associated components from the scene. It stops the transformation control node and potentially cancels any input control component, if available. The function ensures that the transformation controls are properly removed to maintain the integrity of the scene.
3585
+
3586
+ *Function Signature*
3587
+ ```typescript
3588
+ function removeTransformControls(): void
3589
+ ```
3590
+
3591
+ *Parameter Table*
3592
+ | parameter | type | required | default | values |
3593
+ | :----: | :----: | :---: | :---: | :---: |
3594
+ | none | none | none | none |none|
3595
+
3596
+ *Example*
3597
+ ```typescript
3598
+ import * as atwin from 'architwin'
3599
+
3600
+ atwin.removeTransformControls();
3601
+ ```
3602
+
3603
+ #### setAnimationState()
3604
+ This function is used to set the animation state of a specific model object in the scene. It allows you to play or stop the animation associated with the specified model using the provided action parameter. The function locates the animation state path corresponding to the given modelId and updates it accordingly.
3605
+
3606
+ *Function Signature*
3607
+ ```typescript
3608
+ function setAnimationState(action: string, modelId: number): void
3609
+ ```
3610
+
3611
+ *Parameter Table*
3612
+ | parameter | type | required | default | values |
3613
+ | :----: | :----: | :---: | :---: | :---: |
3614
+ | action | string | yes | none |'play' or 'stop'|
3615
+ | modelId | number | yes | none |ID of the model|
3616
+
3617
+ *Example*
3618
+ ```typescript
3619
+ import * as atwin from 'architwin'
3620
+ const action = 'play';
3621
+ const modelId = 123;
3622
+
3623
+ setAnimationState(action, modelId);
3624
+ ```
3625
+
3626
+ #### showObjectDimensions()
3627
+
3628
+ Use this function to display the dimensions of a chosen object within a 3D space. The function computes the object's width, height, and depth through its bounding box and showcases this data as 3D text labels strategically positioned around the object.
3629
+
3630
+ *Function Signature*
3631
+ ```typescript
3632
+ function showObjectDimensions(selected: IObjectData): void
3633
+ ```
3634
+
3635
+ *Parameter Table*
3636
+ | parameter | type | required | default | values |
3637
+ | :----: | :----: | :---: | :---: | :---: |
3638
+ | selected | IObjectData | yes | | |
3639
+
3640
+ *Example*
3641
+ ```typescript
3642
+ import * as atwin from 'architwin'
3643
+
3644
+ atwin.showObjectDimensions(selectedObject)
3645
+ ```
3646
+
3647
+ #### copyObject()
3648
+
3649
+ Generate a duplicate of a showcase object asynchronously, with the option to include positional and rotational offsets. The function generates a fresh ID for the duplicated object, applies provided positional and rotational adjustments, and integrates the object into the scene.
3650
+
3651
+ *Function Signature*
3652
+ ```typescript
3653
+ async function copyObject(
3654
+ payload: IShowcaseObject,
3655
+ position_offset: Vector3 = undefined,
3656
+ rotation_offset: Vector3 = undefined
3657
+ ): Promise<IShowcaseObject>
3658
+ ```
3659
+
3660
+ *Parameter Table*
3661
+ | parameter | type | required | default | values |
3662
+ | :----: | :----: | :---: | :---: | :---: |
3663
+ | payload | IShowcaseObject | yes | | |
3664
+ | position_offset | Vector3 | yes | undefined | |
3665
+ | rotation_offset | Vector3 | yes | undefined | |
3666
+
3667
+ *Example*
3668
+ ```typescript
3669
+ import * as atwin from 'architwin'
3670
+
3671
+ const objectToCopy = /* the object to be copied */;
3672
+ const positionOffset = new Vector3(1, 0, 1);
3673
+ const rotationOffset = new Vector3(0, Math.PI / 2, 0);
3674
+
3675
+ awtwin.copyObject(objectToCopy, positionOffset, rotationOffset)
3676
+ .then(copiedObject => {
3677
+ console.log('Object copied:', copiedObject);
3678
+ })
3679
+ .catch(error => {
3680
+ console.error('Error copying object:', error);
3681
+ });
3682
+ ```
3683
+
3684
+ #### addObject()
3685
+ This asynchronous function is used to upload and add a new 3D object to the scene. It receives a file upload payload, checks the validity of the file type, uploads the file to an external service, and returns the resulting object's data.
3686
+
3687
+ *Function Signature*
3688
+ ```typescript
3689
+ async function addObject(payload: FileUpload): Promise<I3DObject>
3690
+ ```
3691
+
3692
+ *Parameter Table*
3693
+ | parameter | type | required | default | values |
3694
+ | :----: | :----: | :---: | :---: | :---: |
3695
+ | payload | FileUpload | yes | | |
3696
+
3697
+ *Example*
3698
+ ```typescript
3699
+ import * as atwin from 'architwin'
3700
+
3701
+ const uploadPayload = /* construct the upload payload */;
3702
+ addObject(uploadPayload)
3703
+ .then(addedObject => {
3704
+ console.log('Object added:', addedObject);
3705
+ })
3706
+ .catch(error => {
3707
+ console.error('Error adding object:', error);
3708
+ });
3709
+
3710
+ ```
3711
+
3712
+ #### getObject()
3713
+
3714
+ Retrieve the data of a 3D object by using this asynchronous function with the provided object ID.
3715
+
3716
+ *Function Signature*
3717
+ ```typescript
3718
+ async function getObject(id: number): Promise<I3DObject>
3719
+ ```
3720
+
3721
+ *Parameter Table*
3722
+ | parameter | type | required | default | values |
3723
+ | :----: | :----: | :---: | :---: | :---: |
3724
+ | id | number | yes | | |
3725
+
3726
+ *Example*
3727
+ ```typescript
3728
+ import * as atwin from 'architwin'
3729
+
3730
+ const objectId = /* specify the object's ID */;
3731
+ awtwin.getObject(objectId)
3732
+ .then(retrievedObject => {
3733
+ console.log('Object retrieved:', retrievedObject);
3734
+ })
3735
+ .catch(error => {
3736
+ console.error('Error retrieving object:', error);
3737
+ });
3738
+ ```
3739
+
3740
+ #### updateObject()
3741
+
3742
+ The [updateObject()](#updateobject) function used to refresh a pre-existing 3D object by uploading a fresh file payload. Supply the object's ID along with the file upload payload. The function validates the file type, executes an update and returns the resulting object's data.
3743
+
3744
+ *Function Signature*
3745
+ ```typescript
3746
+ async function updateObject(id: number, payload: FileUpload): Promise<I3DObject>
3747
+ ```
3748
+
3749
+ *Parameter Table*
3750
+ | parameter | type | required | default | values |
3751
+ | :----: | :----: | :---: | :---: | :---: |
3752
+ | id | number | yes | none | |
3753
+ | payload | FileUpload | yes | | |
3754
+
3755
+ *Example*
3756
+ ```typescript
3757
+ import * as atwin from 'architwin'
3758
+
3759
+ const objectId = /* specify the object's ID */;
3760
+ const uploadPayload = /* construct the upload payload */;
3761
+
3762
+ atwin.updateObject(objectId, uploadPayload)
3763
+ .then(updatedObject => {
3764
+ console.log('Object updated:', updatedObject);
3765
+ })
3766
+ .catch(error => {
3767
+ console.error('Error updating object:', error);
3768
+ });
3769
+ ```
3770
+
3771
+ #### deleteObject()
3772
+
3773
+ Use asynchronous function to delete an existing 3D object. The deletion target is determined by the `id` parameter value.
3774
+
3775
+ *Function Signature*
3776
+ ```typescript
3777
+ async function deleteObject(id: number): Promise<void>
3778
+ ```
3779
+
3780
+ *Parameter Table*
3781
+ | parameter | type | required | default | values |
3782
+ | :----: | :----: | :---: | :---: | :---: |
3783
+ | id | number | yes | | |
3784
+
3785
+ *Example*
3786
+ ```typescript
3787
+ import * as atwin from 'architwin'
3788
+
3789
+ const objectId = /* specify the object's ID */;
3790
+ atwin.deleteObject(objectId)
3791
+ .then(() => {
3792
+ console.log('Object deleted successfully.');
3793
+ })
3794
+ .catch(error => {
3795
+ console.error('Error deleting object:', error);
3796
+ });
3797
+ ```
3798
+
3799
+ #### goTo3dx()
3800
+
3801
+ Use the [goTo3dx()](#goto3dx) asynchronous function to navigate to a specific 3D object or point of interest within a 3D environment. Provide an object ID as input, and the function will search for the closest associated sweep. If a suitable sweep is found, the function will initiate navigation to that specific point
3802
+
3803
+ *Function Signature*
3804
+ ```typescript
3805
+ async function goTo3dx(objectId: number): Promise<void>
3806
+ ```
3807
+
3808
+ *Parameter Table*
3809
+ | parameter | type | required | default | values |
3810
+ | :----: | :----: | :---: | :---: | :---: |
3811
+ | objectId | number | yes | | |
3812
+
3813
+ *Example*
3814
+ ```typescript
3815
+ import * as atwin from 'architwin'
3816
+
3817
+ const targetObjectId = /* specify the object's ID */;
3818
+ atwin.goTo3dx(targetObjectId)
3819
+ .then(() => {
3820
+ console.log('Navigation to the object completed.');
3821
+ })
3822
+ .catch(error => {
3823
+ console.error('Error navigating to the object:', error);
3824
+ });
3825
+ ```
3826
+
3827
+ #### deleteObjectFromSpace()
3828
+
3829
+ To remove a designated object from a 3D space use [deleteObjectFromSpace()](#deleteobjectfromspace). Provide an `IObjectData` object as input, and the function will eliminate the object from the scene. Additionally, it undertakes essential cleanup tasks like halting animations and removing linked markup elements.
3830
+
3831
+ *Function Signature*
3832
+ ```typescript
3833
+ async function deleteObjectFromSpace(target: IObjectData): Promise<number>
3834
+ ```
3835
+
3836
+ *Parameter Table*
3837
+ | parameter | type | required | default | values |
3838
+ | :----: | :----: | :---: | :---: | :---: |
3839
+ | target | IObjectData | yes | | |
3840
+
3841
+ *Example*
3842
+ ```typescript
3843
+ import * as atwin from 'architwin'
3844
+
3845
+ const targetObject = /* specify the target object */;
3846
+ atwin.deleteObjectFromSpace(targetObject)
3847
+ .then(deletedObjectId => {
3848
+ console.log(`Object with ID ${deletedObjectId} deleted from the space.`);
3849
+ })
3850
+ .catch(error => {
3851
+ console.error('Error deleting object:', error);
3852
+ });
3853
+ ```
3854
+
3855
+ #### replaceObject()
3856
+
3857
+ To replace a particular object within a 3D space with a fresh one use [replaceObject()](#replaceobject) method. Provide an `I3DObject` payload for the new object, an IObjectData target for the object to be replaced, and optional configuration choices. The function eliminates the target object from the scene and introduces the new object in its designated position.
3858
+
3859
+ *Function Signature*
3860
+ ```typescript
3861
+ async function replaceObject(payload: I3DObject, target: IObjectData, options: Object = null): Promise<IShowcaseObject>
3862
+ ```
3863
+
3864
+ *Parameter Table*
3865
+ | parameter | type | required | default | values |
3866
+ | :----: | :----: | :---: | :---: | :---: |
3867
+ | payload | I3DObject | yes | | |
3868
+ | target | IObjectData | yes | | |
3869
+ | options | Object | yes | null | |
3870
+
3871
+ *Example*
3872
+ ```typescript
3873
+ import * as atwin from 'architwin'
3874
+
3875
+ const newObjectPayload = /* specify the new object's payload */;
3876
+ const targetObject = /* specify the target object to be replaced */;
3877
+ const replacementOptions = /* specify optional replacement options */;
3878
+
3879
+ atwin.replaceObject(newObjectPayload, targetObject, replacementOptions)
3880
+ .then(replacedObject => {
3881
+ console.log('Object replaced:', replacedObject);
3882
+ })
3883
+ .catch(error => {
3884
+ console.error('Error replacing object:', error);
3885
+ });
3886
+ ```
3887
+ #### addTextMarkupScreen()
3888
+
3889
+ To introduce a text markup screen into the 3D space use the [addTextMarkupScreen()](#addtextmarkupscreen) method. The function generates a 3D object based on the supplied title and message. The screen's placement, scaling, and rotation align with the designated transformation parameters.
3890
+
3891
+ *Function Signature*
3892
+ ```typescript
3893
+ async function addTextMarkupScreen(
3894
+ title: string = '',
3895
+ message: string,
3896
+ textScreenName: string,
3897
+ transform: { position: Vector3, scale: Vector3, rotation: Vector3 },
3898
+ textColor: string = 'black',
3899
+ backgroundColor: string = '#fff'
3900
+ ): Promise<IShowcaseObject>
3901
+ ```
3902
+
3903
+ *Parameter Table*
3904
+ | parameter | type | required | default | values |
3905
+ | :----: | :----: | :---: | :---: | :---: |
3906
+ | title | string | yes | ' ' | |
3907
+ | message | string | yes | | |
3908
+ | textScreenName | string | yes | | |
3909
+ | transform | { position: Vector3, scale: Vector3, rotation: Vector3 } | yes | | |
3910
+ | textColor | string | yes | 'black' | |
3911
+ | backgroundColor | string | yes | '#fff' | |
3912
+
3913
+ *Example*
3914
+ ```typescript
3915
+ import * as atwin from 'architwin'
3916
+ ```
3917
+
3918
+ #### setTextMarkupScreenContent()
3919
+
3920
+ To set the content of a text markup screen within a 3D space use the [setTextMarkupScreenContent()](#settextmarkupscreencontent). The function modifies multiple properties of the screen, including its title, text content, text color, and background color.
3921
+
3922
+ *Function Signature*
3923
+ ```typescript
3924
+ function setTextMarkupScreenContent(
3925
+ showcase_id: number,
3926
+ title: string = '',
3927
+ text: string = '',
3928
+ textColor: string = '',
3929
+ backgroundColor: string = ''
3930
+ ): void
3931
+ ```
3932
+
3933
+ *Parameter Table*
3934
+ | parameter | type | required | default | values |
3935
+ | :----: | :----: | :---: | :---: | :---: |
3936
+ | title | string | yes | ' ' | |
3937
+ | message | string | yes | | |
3938
+ | textScreenName | string | yes | | |
3939
+ | transform | { position: Vector3, scale: Vector3, rotation: Vector3 } | yes | | |
3940
+ | textColor | string | yes | 'black' | |
3941
+ | backgroundColor | string | yes | '#fff' | |
3942
+
3943
+ *Example*
3944
+ ```typescript
3945
+ import * as atwin from 'architwin'
3946
+
3947
+ const showcaseId = /* specify the showcase ID */;
3948
+ const newTitle = 'New Title';
3949
+ const newText = 'Updated content.';
3950
+ const newTextColor = 'blue';
3951
+ const newBackgroundColor = 'white';
3952
+
3953
+ atwin.setTextMarkupScreenContent(showcaseId, newTitle, newText, newTextColor, newBackgroundColor);
3954
+ ```
3955
+ -----
3956
+
3957
+ ## Meeting
3958
+
3959
+ ### createMeeting()
3960
+
3961
+ Facilitates the creation of a virtual meeting within the specified 3D space. It allows the host to provide details such as the space ID, host's name, meeting title, start time, duration, and password protection.
3962
+
3963
+ *Function Signature*
3964
+ ```typescript
3965
+ async function createMeeting(
3966
+ spaceId: string,
3967
+ hostName: string,
3968
+ title: string,
3969
+ meetingStart: any,
3970
+ duration: number,
3971
+ password: string
3972
+ ): Promise<MeetingURLs | undefined>;
3973
+ ```
3974
+
3975
+ *Parameter Table*
3976
+ | parameter | type | required | values |
3977
+ | :----: | :----: | :---: | :---: |
3978
+ | spaceId | string | yes | any string |
3979
+ | hostName | string | yes | any string|
3980
+ | title | string | yes | any string |
3981
+ | meetingStart | string | yes | any string |
3982
+ | meetingStatus | string | yes | '0', '1', '2', or '3'|
3983
+ | duration | number | yes | any number |
3984
+ | password | string | no | any string|
3985
+
3986
+ *Example*
3987
+ ```typescript
3988
+ import * as atwin from 'architwin'
3989
+
3990
+ async function scheduleMeeting(spaceId, hostName, title, meetingStart, duration, password) {
3991
+ try {
3992
+ const meetingUrls = await atwin.createMeeting(spaceId, hostName, title, meetingStart, duration, password);
3993
+ console.log("Meeting URLs:", meetingUrls);
3994
+ } catch (error) {
3995
+ console.error("Error creating meeting:", error);
3996
+ }
3997
+ }
3998
+
3999
+ const spaceId = "your-space-id";
4000
+ const hostName = "John Doe";
4001
+ const title = "Team Meeting";
4002
+ const meetingStart = new Date(); // Current time
4003
+ const duration = 60; // Duration in minutes
4004
+ const password = "secret123";
4005
+
4006
+ await scheduleMeeting(spaceId, hostName, title, meetingStart, duration, password);
4007
+ ```
4008
+
4009
+ ### startMeeting()
4010
+
4011
+ Initiate a virtual meeting within the 3D space using this function. The function examines the meeting URL and conditions before launching the meeting with the specified configuration.
4012
+
4013
+ *Function Signature*
4014
+ ```typescript
4015
+ async function startMeeting(meetingUrl: string, meetingPassword?: string, meetingConfig?: MeetingConfig): Promise<void>
4016
+ ```
4017
+
4018
+ *Parameter Table*
4019
+ | parameter | type | required | values |
4020
+ | :----: | :----: | :---: | :---: |
4021
+ | meetingUrl | string | yes | valid public URL |
4022
+ | meetingPassword | string | no | any string|
4023
+ | meetingConfig | MeetingConfig | no | MeetingConfig object |
4024
+
4025
+ *Example*
4026
+ ```typescript
4027
+ import * as atwin from 'architwin'
4028
+
4029
+ // Example usage of startMeeting function
4030
+ async function joinMeeting(meetingUrl, meetingPassword, meetingConfig) {
4031
+ try {
4032
+ await atwin.startMeeting(meetingUrl, meetingPassword, meetingConfig);
4033
+ console.log("Joining the meeting...");
4034
+ } catch (error) {
4035
+ console.error("Error starting/joining the meeting:", error);
4036
+ }
4037
+ }
4038
+
4039
+ // Call the function with example values
4040
+ const meetingUrl = "https://your-meeting-url.com/?meetingId=your-meeting-id&role=guest";
4041
+ const meetingPassword = "secret123";
4042
+ const meetingConfig = {
4043
+ videoEnabled: true,
4044
+ audioEnabled: true,
4045
+ screenSharingEnabled: false
4046
+ };
4047
+
4048
+ await joinMeeting(meetingUrl, meetingPassword, meetingConfig);
4049
+ ```
4050
+
4051
+ ### stopMeeting()
4052
+
4053
+ This function is used to stop ongoing virtual meeting session.
4054
+
4055
+ *Function Signature*
4056
+ ```typescript
4057
+ async function stopMeeting(): Promise<void>
4058
+ ```
4059
+
4060
+
4061
+ *Example*
4062
+ ```typescript
4063
+ import * as atwin from 'architwin'
4064
+
4065
+ // Example usage of stopMeeting function
4066
+ async function endMeeting() {
4067
+ try {
4068
+ await atwin.stopMeeting();
4069
+ console.log("Meeting has been stopped and cleaned up.");
4070
+ } catch (error) {
4071
+ console.error("Error stopping the meeting:", error);
4072
+ }
4073
+ }
4074
+
4075
+ // Call the function
4076
+ endMeeting();
4077
+ ```
4078
+
4079
+ ### getMeeting()
4080
+
4081
+ Retrieve details about a particular virtual meeting by utilizing its distinct meeting ID with this function.
4082
+
4083
+ *Function Signature*
4084
+ ```typescript
4085
+ async function getMeeting(meetingId: string): Promise<any>
4086
+ ```
4087
+
4088
+ *Parameter Table*
4089
+ | parameter | type | required | values |
4090
+ | :----: | :----: | :---: | :---: |
4091
+ | meetingId | string | yes | valid meeting Id |
4092
+
4093
+ *Example*
4094
+ ```typescript
4095
+ import * as atwin from 'architwin'
4096
+
4097
+ // Example usage of getMeeting function
4098
+ async function fetchMeetingDetails(meetingId) {
4099
+ try {
4100
+ const meetingInfo = await atwin.getMeeting(meetingId);
4101
+ console.log("Meeting Details:", meetingInfo.data);
4102
+ } catch (error) {
4103
+ console.error("Error fetching meeting details:", error);
4104
+ }
4105
+ }
4106
+
4107
+ // Call the function with a specific meeting ID
4108
+ fetchMeetingDetails("exampleMeetingId123");
4109
+ ```
4110
+
4111
+ ### getMeetingParticipants()
4112
+
4113
+ Obtain a list of meeting participants and their associated colors from the ongoing meeting session using this function.
4114
+
4115
+ *Function Signature*
4116
+ ```typescript
4117
+ function getMeetingParticipants(): IMpParticipant[]
4118
+ ```
4119
+
4120
+
4121
+ *Example*
4122
+ ```typescript
4123
+ import * as atwin from 'architwin'
4124
+
4125
+ // Example usage of getMeetingParticipants function
4126
+ function displayMeetingParticipants() {
4127
+ const participants = atwin.getMeetingParticipants();
4128
+ if (participants.length > 0) {
4129
+ console.log("Meeting Participants:", participants);
4130
+ } else {
4131
+ console.log("No participants in the meeting.");
4132
+ }
4133
+ }
4134
+
4135
+ // Call the function to display meeting participants
4136
+ displayMeetingParticipants();
4137
+ ```
4138
+
4139
+ ### getSpaceMeetings()
4140
+
4141
+ Retrieve a compilation of meetings linked to a designated space by using its space ID through this function.
4142
+
4143
+ *Function Signature*
4144
+ ```typescript
4145
+ async function getSpaceMeetings(spaceId: number): Promise<any>
4146
+ ```
4147
+
4148
+ *Parameter Table*
4149
+ | parameter | type | required | values |
4150
+ | :----: | :----: | :---: | :---: |
4151
+ | spaceId | string | yes | valid space Id |
4152
+
4153
+ *Example*
4154
+ ```typescript
4155
+ import * as atwin from 'architwin'
4156
+
4157
+ const meetingsResponse = await atwin.getSpaceMeetings(spaceId);
4158
+ ```
4159
+
4160
+ ### generateMeetingURL()
4161
+
4162
+ Generate URLs for hosting and joining a meeting using the provided meeting ID through this function. The function additionally verifies the validity of the meeting ID before generating the URLs
4163
+
4164
+ *Function Signature*
4165
+ ```typescript
4166
+ async function generateMeetingURL(meeting_id: string): Promise<any>
4167
+ ```
4168
+
4169
+ *Parameter Table*
4170
+ | parameter | type | required | values |
4171
+ | :----: | :----: | :---: | :---: |
4172
+ | meeting_id | string | yes | valid meeting Id |
4173
+
4174
+ *Example*
4175
+ ```typescript
4176
+ import * as atwin from 'architwin'
4177
+
4178
+ const meetingUrls = await atwin.generateMeetingURL(meetingId);
4179
+ console.log("Generated Meeting URLs:", meetingUrls);
4180
+ ```
4181
+
4182
+ ### isMeetingExists()
4183
+
4184
+ Determine the existence of a meeting with the provided meeting ID. The function yields 'true' if the meeting exists and 'false' if it doesn't.
4185
+
4186
+ *Function Signature*
4187
+ ```typescript
4188
+ async function isMeetingExists(meetingId: string): Promise<boolean>
4189
+ ```
4190
+
4191
+ *Parameter Table*
4192
+ | parameter | type | required | values |
4193
+ | :----: | :----: | :---: | :---: |
4194
+ | meetingId | string | yes | valid meeting Id |
4195
+
4196
+ *Example*
4197
+ ```typescript
4198
+ import * as atwin from 'architwin'
4199
+
4200
+ const exists = await atwin.isMeetingExists(meetingId);
4201
+ ```
4202
+
4203
+ ### isMeetingActive()
4204
+
4205
+ Verify the status of a meeting with the provided meeting ID to ascertain its activity.
4206
+
4207
+ *Function Signature*
4208
+ ```typescript
4209
+ async function isMeetingActive(meetingId: string): Promise<boolean>
4210
+ ```
4211
+
4212
+ *Parameter Table*
4213
+ | parameter | type | required | values |
4214
+ | :----: | :----: | :---: | :---: |
4215
+ | meetingId | string | yes | valid meeting Id |
4216
+
4217
+ *Example*
4218
+ ```typescript
4219
+ import * as atwin from 'architwin'
4220
+
4221
+ const isActive = await atwin.isMeetingActive(meetingId);
4222
+ ```
4223
+
4224
+ ### updateMeetingTitle()
4225
+
4226
+ Revise the title of a meeting using the provided meeting ID with this function. Initially, the function will retrieve the meeting object, thus acquiring the essential ID for the update process.
4227
+
4228
+ *Function Signature*
4229
+ ```typescript
4230
+ async function updateMeetingTitle(meetingId: string, meetingTitle: string): Promise<any>
4231
+ ```
4232
+
4233
+ *Parameter Table*
4234
+ | parameter | type | required | values |
4235
+ | :----: | :----: | :---: | :---: |
4236
+ | meetingId | string | yes | valid meeting Id |
4237
+ | meetingTitle | string | yes | new meeting title |
4238
+
4239
+ *Example*
4240
+ ```typescript
4241
+ import * as atwin from 'architwin'
4242
+
4243
+ // Example usage of updateMeetingTitle function
4244
+ async function handleUpateMeetingTitle() {
4245
+ const meetingId = "your_meeting_id"; // Replace with actual meeting ID
4246
+ const newTitle = "New Meeting Title"; // Replace with the desired new title
4247
+ try {
4248
+ const response = await atwin.updateMeetingTitle(meetingId, newTitle);
4249
+ console.log("Meeting title updated:", response.data.data.title);
4250
+ } catch (error) {
4251
+ console.error("An error occurred:", error);
4252
+ }
4253
+ }
4254
+
4255
+ // Call the function
4256
+ handleUpateMeetingTitle();
4257
+ ```
4258
+
4259
+ ### updateMeetingStart()
4260
+
4261
+ Change the start time of a meeting using the provided meeting ID through this function.
4262
+
4263
+ *Function Signature*
4264
+ ```typescript
4265
+ async function updateMeetingStart(meetingId: string, meetingStart: string): Promise<any>
4266
+ ```
4267
+
4268
+ *Parameter Table*
4269
+ | parameter | type | required | values |
4270
+ | :----: | :----: | :---: | :---: |
4271
+ | meetingId | string | yes | valid meeting Id |
4272
+ | meetingStart | string | yes | new date when the will start |
4273
+
4274
+ *Example*
4275
+ ```typescript
4276
+ import * as atwin from 'architwin'
4277
+
4278
+ // Example usage of updateMeetingStart function
4279
+ async function changeMeetingStart() {
4280
+ const meetingId = "your_meeting_id"; // Replace with actual meeting ID
4281
+ const newStartTime = "2023-09-01T10:00:00"; // Replace with the desired new start time
4282
+ try {
4283
+ const response = await atwin.updateMeetingStart(meetingId, newStartTime);
4284
+ console.log("Meeting start time updated:", response.data.data.meeting_start);
4285
+ } catch (error) {
4286
+ console.error("An error occurred:", error);
4287
+ }
4288
+ }
4289
+
4290
+ // Call the function
4291
+ changeMeetingStart();
4292
+ ```
4293
+
4294
+ ### updateMeetingStatus()
4295
+
4296
+ Modify the status of a meeting using the provided meeting ID using this function.
4297
+
4298
+ *Function Signature*
4299
+ ```typescript
4300
+ async function updateMeetingStatus(meetingId: string, meetingStatus: number): Promise<any>
4301
+ ```
4302
+
4303
+ *Parameter Table*
4304
+ | parameter | type | required | values |
4305
+ | :----: | :----: | :---: | :---: |
4306
+ | meetingId | string | yes | valid meeting Id |
4307
+ | meetingStatus | number | yes | 0 or 1 or 2 or 3 |
4308
+
4309
+ *Example*
4310
+ ```typescript
4311
+ import * as atwin from 'architwin'
4312
+
4313
+ // Example usage of updateMeetingStatus function
4314
+ async function handleChangeMeetingStatus() {
4315
+ const meetingId = "your_meeting_id"; // Replace with actual meeting ID
4316
+ const newStatus = 1; // Replace with the desired new status value
4317
+ try {
4318
+ const response = await atwin.updateMeetingStatus(meetingId, newStatus);
4319
+ console.log("Meeting status updated:", response.data.data.meeting_status);
4320
+ } catch (error) {
4321
+ console.error("An error occurred:", error);
4322
+ }
4323
+ }
4324
+
4325
+ // Call the function
4326
+ handleChangeMeetingStatus();
4327
+ ```
4328
+
4329
+
4330
+ ### updateMeetingSpace()
4331
+
4332
+ Modify the associated space of a meeting using the provided meeting ID with this function.
4333
+
4334
+ *Function Signature*
4335
+ ```typescript
4336
+ async function updateMeetingSpace(meetingId: string, spaceId: string): Promise<any>
4337
+ ```
4338
+
4339
+ *Parameter Table*
4340
+ | parameter | type | required | values |
4341
+ | :----: | :----: | :---: | :---: |
4342
+ | meetingId | string | yes | valid meeting Id |
4343
+ | spaceId | string | yes | valid space Id |
4344
+
4345
+ *Example*
4346
+ ```typescript
4347
+ import * as atwin from 'architwin'
4348
+
4349
+ // Example usage of updateMeetingSpace function
4350
+ async function changeMeetingSpace() {
4351
+ const meetingId = "your_meeting_id"; // Replace with actual meeting ID
4352
+ const newSpaceId = "new_space_id"; // Replace with the new space ID
4353
+ try {
4354
+ const response = await atwin.updateMeetingSpace(meetingId, newSpaceId);
4355
+ console.log("Meeting space updated:", response.data.data.space_id);
4356
+ } catch (error) {
4357
+ console.error("An error occurred:", error);
4358
+ }
4359
+ }
4360
+
4361
+ // Call the function
4362
+ changeMeetingSpace();
4363
+ ```
4364
+
4365
+ -----
2558
4366
 
2559
4367
  **To Do:**
2560
4368