architwin 1.0.31 → 1.0.33
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.
- package/README.md +518 -93
- package/package.json +4 -2
- package/static/map.css +88 -0
- package/webpack.config.cjs +5 -0
- package/webpack.config.js +25 -0
package/README.md
CHANGED
|
@@ -24,10 +24,20 @@ ArchiTwin Library
|
|
|
24
24
|
- [Loading and Interacting with 3D/2D Objects](#loading-and-interacting-with-3d2d-objects)
|
|
25
25
|
- [What is an Object?](#what-is-an-object)
|
|
26
26
|
- [Loading Objects](#loading-objects)
|
|
27
|
+
- [Accessing List of Rendered Objects and Object Structure](#accessing-list-of-rendered-objects-and-object-structure)
|
|
27
28
|
- [Transforming Objects](#transforming-objects)
|
|
29
|
+
- [Transforming Object by clicking it](#transforming-object-by-clicking-it)
|
|
30
|
+
- [Programmatically transforming objects](#programmatically-transforming-objects)
|
|
28
31
|
- [Undoing and Redoing Transformation Changes](#undoing-and-redoing-transformation-changes)
|
|
29
32
|
- [Adding Objects To Your Space](#adding-objects-to-your-space)
|
|
33
|
+
- [Programmatically Add Objects](#programmatically-add-objects)
|
|
30
34
|
- [Creating a Customizable Media Screen](#creating-a-customizable-media-screen)
|
|
35
|
+
- [Adding a Media Screen](#adding-a-media-screen)
|
|
36
|
+
- [Media Screen Parameter Reference](#media-screen-parameter-reference)
|
|
37
|
+
- [Attaching an image or video to a Media Screen](#attaching-an-image-or-video-to-a-media-screen)
|
|
38
|
+
- [Getting the coordinates of a clicked area in the 3D space](#getting-the-coordinates-of-a-clicked-area-in-the-3d-space)
|
|
39
|
+
- [Setting Video Playback in the Space](#setting-video-playback-in-the-space)
|
|
40
|
+
- [Setting Animation Control in the Space](#setting-animation-control-in-the-space)
|
|
31
41
|
- [Function Reference](#function-reference)
|
|
32
42
|
- [Tags](#tags)
|
|
33
43
|
- [Sweeps](#sweeps)
|
|
@@ -353,7 +363,8 @@ connectSpace(spaceUrl, auth, config)
|
|
|
353
363
|
export interface IMPConfig{
|
|
354
364
|
iframeId: string, // required
|
|
355
365
|
appKey?: string,
|
|
356
|
-
bundlePath?: string,
|
|
366
|
+
bundlePath?: string,
|
|
367
|
+
viewMode?: string
|
|
357
368
|
play?: 0 | 1,
|
|
358
369
|
qs?: 0 | 1,
|
|
359
370
|
tour?: 0 | 1 | 2 | 3,
|
|
@@ -367,6 +378,8 @@ export interface IMPConfig{
|
|
|
367
378
|
|
|
368
379
|
**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.
|
|
369
380
|
|
|
381
|
+
**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'
|
|
382
|
+
|
|
370
383
|
*Example:*
|
|
371
384
|
|
|
372
385
|
`bundlePath: "assets/customBundleName"`
|
|
@@ -572,6 +585,9 @@ We define objects as 3D or 2D assets that have or will be loaded into a space. T
|
|
|
572
585
|
**2D Objects**
|
|
573
586
|
|
|
574
587
|
- MP4 (Videos)
|
|
588
|
+
- WMV (Videos)
|
|
589
|
+
- PNG (Images)
|
|
590
|
+
- JPEG (Images)
|
|
575
591
|
- ZIP (Image/Image slideshows)
|
|
576
592
|
|
|
577
593
|
We add support for more file types in future updates
|
|
@@ -625,30 +641,157 @@ import * as atwin from 'architwin'
|
|
|
625
641
|
|
|
626
642
|
atwin.nearbyObjects //Gets updated everytime the User camera moves
|
|
627
643
|
```
|
|
644
|
+
|
|
645
|
+
### Accessing List of Rendered Objects and Object Structure
|
|
646
|
+
|
|
647
|
+
Objects that have been loaded and **rendered** into the 3D space are stored in an array called _3DXObjects which you can access by doing calling it this way
|
|
648
|
+
|
|
649
|
+
```typescript
|
|
650
|
+
atwin._3DXObjects
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
All the elements in this array implement the `IObjectData` interface. Each element in the array contains all the data you would need manipulate the object.
|
|
654
|
+
|
|
655
|
+
*interface used* (TS)
|
|
656
|
+
```typescript
|
|
657
|
+
interface IObjectData {
|
|
658
|
+
collider?: any
|
|
659
|
+
object: IShowcaseObject
|
|
660
|
+
component: Scene.IComponent
|
|
661
|
+
node: Scene.INode
|
|
662
|
+
type?: string
|
|
663
|
+
}
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
Each object element inside `atwin._3DXObjects` contains the value keys:
|
|
667
|
+
|
|
668
|
+
**collider:** Collider components define the shape of an 3D/2D object for the purposes of physical collisions. A collider, which is invisible, does not need to be the exact same shape as the GameObject’s mesh.
|
|
669
|
+
|
|
670
|
+
**object:** The object key is an object that implements the `IShowcaseObject` interface. This is one of the most important values as the object contains all the information about an object such as its id,name,position,rotation,scale,amazon_uri link, and etc. You can look at the interface below to view the full makeup of the object key.
|
|
671
|
+
|
|
672
|
+
*interface used* (TS)
|
|
673
|
+
```typescript
|
|
674
|
+
export interface IShowcaseObject {
|
|
675
|
+
id: number;
|
|
676
|
+
showcase_id: number;
|
|
677
|
+
object_id: number;
|
|
678
|
+
user_id: number;
|
|
679
|
+
object_position: {
|
|
680
|
+
x: number;
|
|
681
|
+
y: number;
|
|
682
|
+
z: number;
|
|
683
|
+
};
|
|
684
|
+
object_rotation: {
|
|
685
|
+
x: number;
|
|
686
|
+
y: number;
|
|
687
|
+
z: number;
|
|
688
|
+
};
|
|
689
|
+
object_scale: {
|
|
690
|
+
x: number;
|
|
691
|
+
y: number;
|
|
692
|
+
z: number;
|
|
693
|
+
};
|
|
694
|
+
autoplay: boolean;
|
|
695
|
+
autoplay_distance: number;
|
|
696
|
+
offset_position: number;
|
|
697
|
+
offset_rotation: number;
|
|
698
|
+
position_unit: string;
|
|
699
|
+
showcase_object_name: string;
|
|
700
|
+
is_deleted: boolean;
|
|
701
|
+
is_read: boolean;
|
|
702
|
+
is_new: boolean;
|
|
703
|
+
object_data: I3DObject;
|
|
704
|
+
}
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
**component:** This objects contains functions and variables responsible for intializing, updating, and destroying a rendered objects mesh, texture, etc. This object also contains the three.js instance. Since the 3D space is rendered with Three.js under the hood. You can use this instance to invoke methods made available by three.js. This gives you a lot of flexibility and control provided you know how to use it. This documentation will not cover Three.js specific methods. Visit their [official website](https://threejs.org/) if you want to learn more about it.
|
|
708
|
+
|
|
709
|
+
**node:** The node is responsible for managing the lifecycle of a 3D/2D objects. The node can be used to `start()` and `stop()` a rendered model. Invoking `start()` will render the model into the scene while `stop()` will destroy it and remove it from the scene.
|
|
710
|
+
|
|
711
|
+
**type:** A string that states the file or object type of a 3D/2D object. The file type could be any of the following
|
|
712
|
+
|
|
713
|
+
**Valid Types**
|
|
714
|
+
|
|
715
|
+
| type | context | description |
|
|
716
|
+
| :----: | :----: | :---: |
|
|
717
|
+
| GLB | 3D model | A 3D model with or without animation |
|
|
718
|
+
| FBX | 3D model | A 3D model with or without animation |
|
|
719
|
+
| FRAME | Media Screen | A customizable [media screen](#creating-a-customizable-media-screen) |
|
|
720
|
+
| ZIP | slideshow | A zip file rendered as a image slideshow |
|
|
721
|
+
|
|
722
|
+
The `atwin.selectedObject` variable is an example of a variable that implements this interfacea and contains this data.
|
|
628
723
|
### Transforming Objects
|
|
629
724
|
|
|
630
725
|
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.
|
|
631
726
|
|
|
727
|
+
**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'.
|
|
728
|
+
|
|
632
729
|
**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.
|
|
633
730
|
|
|
634
731
|
**Scale** - Scaling is the process of changing the size of an object by uniformly increasing or decreasing its dimensions along each axis. It can make an object larger (scaling up) or smaller (scaling down).
|
|
635
732
|
|
|
636
733
|
**Rotate** - Rotation involves changing the orientation or angle of an object around a specified point or axis. It rotates the object clockwise or counterclockwise by a certain angle.
|
|
637
734
|
|
|
638
|
-
|
|
735
|
+
There are several methods that allows you to transform an object. Let's go through each one
|
|
639
736
|
|
|
640
|
-
|
|
641
|
-
import * as atwin from 'architwin';
|
|
737
|
+
#### Transforming Object by clicking it
|
|
642
738
|
|
|
643
|
-
|
|
739
|
+
Clicking on any object in the space will attach the axis controls to it. By default, clicking on an object will show axis controls for translating the object. You can then use your mouse cursor to click and drag the object to modify its position,rotation, and scale in however way that pleases you. See screenshot for reference
|
|
740
|
+
|
|
741
|
+
<img src="https://matterport.github.io/showcase-sdk/images/sdkbundle-components-transform-controls.png" width="300" height="200" />
|
|
742
|
+
|
|
743
|
+
You can switch the transform mode on the currently selected object by using the `setTransformMode()` method.
|
|
744
|
+
|
|
745
|
+
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
|
|
746
|
+
|
|
747
|
+
If you wish the to access the object data of the object that has been clicked on. You can do so by calling the `atwin.selectedObject` variable which returns an object implementing the `IObjectData` interface containing all the necessary data you need. Know more about the structure of an object by going to this section
|
|
748
|
+
|
|
749
|
+
*Example*
|
|
750
|
+
```typescript
|
|
751
|
+
console.log("Selected object data",atwin.selectedObject)
|
|
644
752
|
```
|
|
645
|
-
|
|
646
|
-
|
|
753
|
+
|
|
754
|
+
#### Programmatically transforming objects
|
|
755
|
+
|
|
756
|
+
If you need to transform the position,rotation, and scale of one or more objects without having to use the mouse then the
|
|
757
|
+
`setObjectTransformation()` method will allow you to do so. The method accepts the following parameters
|
|
758
|
+
|
|
759
|
+
| parameter | type | required | default | values |
|
|
760
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
761
|
+
| node | Scene.INode | yes | none | The node of the object|
|
|
762
|
+
| transform | Object3DPosition | yes | | Object containing object position,rotation,scale. More information below|
|
|
763
|
+
|
|
764
|
+
The **transform** object contains the following key-value pairs. These values when set will be applied to your target object
|
|
765
|
+
|
|
766
|
+
| parameter | type | required | default | values |
|
|
767
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
768
|
+
| object_position | Vector3 | yes | none | Valid x,y,z coordinates|
|
|
769
|
+
| object_rotation | Vector3 | yes | none | Valid x,y,z coordinates|
|
|
770
|
+
| object_scale | Vector3 | yes | none | Valid x,y,z coordinates|
|
|
771
|
+
|
|
772
|
+
In this example, we will get a random 3D model from the array of rendered objects stored in `atwin._3DXObjects` and manipulate it using the method. The object we will be manipulating in this example is a 3D model with a file type of GLB (You can also transform other object types such as a media screen). This will return a javascript object that contains the rendered object's data which implement the `IObjectData` interface. You can know more about that by going to this section
|
|
647
773
|
|
|
648
774
|
```typescript
|
|
649
|
-
atwin.
|
|
775
|
+
const targetObject = atwin._3DXObjects.find(obj => obj.object.object_data.object_type == 'GLB')
|
|
776
|
+
|
|
777
|
+
const transform = {
|
|
778
|
+
object_position: {
|
|
779
|
+
x: 12.345435,
|
|
780
|
+
y: 0,
|
|
781
|
+
z: 4.54754732
|
|
782
|
+
},
|
|
783
|
+
object_rotation: {x:0,y:12,z:8},
|
|
784
|
+
object_scale: {x:2,y:2,z:2}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
atwin.setObjectTransformation(targetObject.node,transform)
|
|
650
788
|
```
|
|
651
|
-
|
|
789
|
+
|
|
790
|
+
If done correctly, you should see your target object(s) display or reposition to your intended position,rotation,and scale. Please take note that the transform controls UI will not be attached to the object if you use this method
|
|
791
|
+
|
|
792
|
+
**Switching Transform Modes**
|
|
793
|
+
|
|
794
|
+
If you wish switch transformation mode, you can pass either 'scale' or 'rotate' as parameters to the the `setTransformMode()` method. This will switch the transform controls on the currently selected object
|
|
652
795
|
|
|
653
796
|
```typescript
|
|
654
797
|
atwin.setTransformMode('scale')
|
|
@@ -680,8 +823,14 @@ In order to add an object, you may use the `addObjectToScene()` method.
|
|
|
680
823
|
|
|
681
824
|
| parameter | type | required | values |
|
|
682
825
|
| :----: | :----: | :---: | :---: |
|
|
683
|
-
| object | I3DObject | yes | object |
|
|
684
|
-
| option |
|
|
826
|
+
| object | I3DObject | yes | object payload |
|
|
827
|
+
| option | ObjectConfig | no | valid config object |
|
|
828
|
+
|
|
829
|
+
There are two ways you can use the `addObjectToScene()` method. We will go through each one
|
|
830
|
+
|
|
831
|
+
#### Programmatically Add Objects
|
|
832
|
+
|
|
833
|
+
If you wish to add new object to your space to a pre-defined position, you can use the `addObjectToScene()` method an pass the object data along
|
|
685
834
|
|
|
686
835
|
```typescript
|
|
687
836
|
atwin.addObjectToScene(object:I3DObject, option:object)
|
|
@@ -691,22 +840,221 @@ atwin.addObjectToScene(object:I3DObject, option:object)
|
|
|
691
840
|
|
|
692
841
|
A Media Screen is a customizable 2D object whose content can be used to display either an image or a video in the 3D space. You may for example use it in your 3D space and allow your users to interact with it and change its content.
|
|
693
842
|
|
|
694
|
-
|
|
843
|
+
#### Adding a Media Screen
|
|
844
|
+
|
|
845
|
+
In order to add a media screen, you may use the `addMediaScreen()` method. The `addMediaScreen()` method accepts the following parameters:
|
|
846
|
+
|
|
847
|
+
#### Media Screen Parameter Reference
|
|
848
|
+
|
|
849
|
+
| parameter | type | required | default | values |
|
|
850
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
851
|
+
| mediaUrl | string | no | empty string | valid public url to an image|
|
|
852
|
+
| transform | {Vector3,Vector3,Vector3} || | Refer to information below**|
|
|
853
|
+
| readonly | boolean | no |false | true or false|
|
|
854
|
+
| autoplay | boolean | no |false | true or false|
|
|
855
|
+
|
|
856
|
+
The **transform** object is an object that contains the following key-value pairs
|
|
857
|
+
|
|
858
|
+
| parameter | type | required | default | values |
|
|
859
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
860
|
+
| position | Vector3 | yes | no default | valid numeric x,y,z values|
|
|
861
|
+
| scale | Vector3 | no | {x:1,y:1,z:1} | valid numeric x,y,z values|
|
|
862
|
+
| rotation | Vector3 | no | {x:0,y:0,z:0} | valid numeric x,y,z values|
|
|
863
|
+
|
|
864
|
+
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`.
|
|
865
|
+
|
|
866
|
+
**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.
|
|
867
|
+
|
|
868
|
+
There are many ways you can use this method to add a media screen to your 3D space. Let's go through each one.
|
|
869
|
+
|
|
870
|
+
**NOTE:** The following examples utilize typescript and will utilize the TypeScript (TS) interfaces the library provides. While you can use just plain JavaScript (JS) for your project and copy the following code snippets (minus the TS interfaces) to your plain JS project, we **highly** recommend that you use TypeScript instead for your Architwin powered projects to take advantage of the type-safety and the custom interfaces provided by the library
|
|
871
|
+
|
|
872
|
+
**Method 1: Adding Programmatically**
|
|
695
873
|
|
|
696
|
-
|
|
697
|
-
|
|
874
|
+
To create a media screen on a pre-defined position, you can create an object that contains the position,rotation,and scale.
|
|
875
|
+
|
|
876
|
+
```typescript
|
|
877
|
+
const yourTargetPosition = {
|
|
878
|
+
x: 12.345435,
|
|
879
|
+
y: 0,
|
|
880
|
+
z: 4.54754732
|
|
881
|
+
}
|
|
882
|
+
const objRotation = {x:0,y:0,z:0}
|
|
883
|
+
const objScale = {x:1,y:1,z:1}
|
|
884
|
+
|
|
885
|
+
const transform = {
|
|
886
|
+
position: yourTargetPosition,
|
|
887
|
+
rotation: objRotation,
|
|
888
|
+
scale: objScale
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
atwin.addMediaScreen('',transform)
|
|
698
892
|
```
|
|
699
893
|
|
|
700
|
-
|
|
894
|
+
If done correctly, you should be able to see your media screen in your intended position. This method is useful if you already the have position,rotation, and scale values stored in a database or possibly in a local array
|
|
701
895
|
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
896
|
+
**Method 2: Adding with click method using getTargetPosition**
|
|
897
|
+
|
|
898
|
+
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
|
|
899
|
+
|
|
900
|
+
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
|
|
901
|
+
|
|
902
|
+
```typescript
|
|
903
|
+
function myCallbackFunction(clickedPosition){
|
|
904
|
+
const objRotation = {x:0,y:0,z:0}
|
|
905
|
+
const objScale = {x:1,y:1,z:1}
|
|
906
|
+
|
|
907
|
+
const transform = {
|
|
908
|
+
position: clickedPosition,
|
|
909
|
+
rotation: objRotation,
|
|
910
|
+
scale: objScale
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
atwin.addMediaScreen('',transform)
|
|
914
|
+
return coords
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
atwin.getTargetPosition(myCallbackFunction)
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
#### Attaching an image or video to a Media Screen
|
|
921
|
+
You can think of a media screen as a blank canvas whose content is totally up to you. If you wish to set the content of the media screen, you may use the `attachMediaScreenContent()` method.
|
|
922
|
+
|
|
923
|
+
**Attach Media Screen Parameters**
|
|
924
|
+
|
|
925
|
+
| parameter | type | required | default | values |
|
|
926
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
927
|
+
| mediaScreenId | number | yes | none | id of object |
|
|
928
|
+
| mediaUrl | string | yes | none | valid public url to the media|
|
|
929
|
+
| mediaType | string | no | image | 'image' or 'video' |
|
|
930
|
+
|
|
931
|
+
**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.
|
|
932
|
+
|
|
933
|
+
In this example, we are using a link pointing to the media stored in an s3 bucket as the mediaUrl and a random media screen id. You will have to substitute the id with an actual id of a **rendered** media screen.
|
|
934
|
+
|
|
935
|
+
Example with image:
|
|
936
|
+
```typescript
|
|
937
|
+
const targetMediaScreenId = 12
|
|
938
|
+
const validUrl = 'https://stg-feelpet.s3.ap-northeast-1.amazonaws.com/0CB45E51-EC48-4727-906A-4CD8A13C0770.jpg'
|
|
707
939
|
|
|
940
|
+
atwin.attachMediaScreenContent(targetMediaScreenId,validUrl,'image')
|
|
941
|
+
```
|
|
942
|
+
|
|
943
|
+
Example with video:
|
|
944
|
+
```typescript
|
|
945
|
+
const targetMediaScreenId = 12
|
|
946
|
+
const validUrl = 'https://stg-feelpet.s3.ap-northeast-1.amazonaws.com/VID_20230203_165202.mp4'
|
|
947
|
+
|
|
948
|
+
atwin.attachMediaScreenContent(targetMediaScreenId,validUrl,'video')
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
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.
|
|
952
|
+
|
|
953
|
+
In this example, we are getting a random media screen from the `atwin._3DXObjects` 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()` method. Please take note that this variable is not accessible if the media type of the media screen content is an image.
|
|
954
|
+
|
|
955
|
+
|
|
956
|
+
*Interface used* (TS)
|
|
708
957
|
```typescript
|
|
709
|
-
|
|
958
|
+
export interface IObjectData {
|
|
959
|
+
collider?: any
|
|
960
|
+
object: IShowcaseObject
|
|
961
|
+
component: Scene.IComponent
|
|
962
|
+
node: Scene.INode
|
|
963
|
+
type?: string
|
|
964
|
+
}
|
|
965
|
+
```
|
|
966
|
+
|
|
967
|
+
*Example*
|
|
968
|
+
```typescript
|
|
969
|
+
const randomMediaScreen:IObjectData = atwin._3DXObjects.find(obj => obj.object.object_data.object_type == 'FRAME')
|
|
970
|
+
|
|
971
|
+
setVideoPlayback('play',randomMediaScreen.component.planeElement)
|
|
972
|
+
```
|
|
973
|
+
|
|
974
|
+
You can use the [transform controls](#transforming-objects) to change the position, scale, and rotation of the media screen using the mouse cursor.
|
|
975
|
+
|
|
976
|
+
### Getting the coordinates of a clicked area in the 3D space
|
|
977
|
+
|
|
978
|
+
The 3D space you walk around in is a three dimensional mesh under the hood. Every point in this space has an x,y,z coordinate. These coordinates are important since it allows us to anchor objects into the 3D space and navigate around it. You may at times need the ability to get the coordinates of an area in the space. You can do this by utilizing the `getTargetPosition()` method.
|
|
979
|
+
|
|
980
|
+
**Parameter Reference**
|
|
981
|
+
| parameter | type | required | default | values |
|
|
982
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
983
|
+
| callback | Function | no | none | any valid function|
|
|
984
|
+
|
|
985
|
+
You can invoke the method by doing the following
|
|
986
|
+
|
|
987
|
+
```typescript
|
|
988
|
+
//pass a callback function to the method below to get
|
|
989
|
+
//the coordinates once the user has clicked on an area
|
|
990
|
+
function myCallbackFunction(coords){
|
|
991
|
+
//Line of code to do something else
|
|
992
|
+
return coords
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
atwin.getTargetPosition(myCallbackFunction)
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
The method accepts a callback function that is triggered once the user has clicked on an area in the space. The methods passes the x,y,z coordinates of the clicked position to the callback function you have passed into the method. When the method is invoked the original white circle pointer is replaced with the target pointer pictured below
|
|
999
|
+
|
|
1000
|
+
<img src="https://drive.google.com/uc?id=1vD4ELNj_rjBVh3hOyYjMcO12Ffmse2Rz" width="50" height="50" />
|
|
1001
|
+
|
|
1002
|
+
The pointer goes back to normal after the user has clicked on any area inside the 3D space
|
|
1003
|
+
|
|
1004
|
+
### Setting Video Playback in the Space
|
|
1005
|
+
|
|
1006
|
+
Setting video playback refers to the act of adjusting various controls associated with the playback of a video in the space. It involves manipulating controls such as pause, play, mute, and unmute to modify the playback behavior according to user's preferences.
|
|
1007
|
+
|
|
1008
|
+
**Pause** - Pausing a video temporarily allows user to freeze the video at a specific moment.
|
|
1009
|
+
|
|
1010
|
+
**Play** - Playing a video resumes its playback from paused state, allowing the user to watch the video in real-time .
|
|
1011
|
+
|
|
1012
|
+
**Mute** - Muting a video disables the audio playback, suppressing any sound embedded within the video.
|
|
1013
|
+
|
|
1014
|
+
**Unmute** - Unmuting a video enables the audio playback, restoring any sound embedded within the video.
|
|
1015
|
+
|
|
1016
|
+
Assuming that you have already selected a video, you can now set the playback of the video.
|
|
1017
|
+
|
|
1018
|
+
Inorder to set the playback of a video, you may use the `setVideoPlayback()` method. By default the action is set to 'play'.
|
|
1019
|
+
|
|
1020
|
+
| parameter | type | required | default | values |
|
|
1021
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
1022
|
+
| action | string | no | play | 'play' or 'pause' or 'mute' or 'unmute' |
|
|
1023
|
+
| element | HTMLVideoElement | yes | none | supported html video element |
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
If you wish to change the action of the playback, add a parameter such as 'pause', 'mute', 'unmute' depending on your preference.
|
|
1027
|
+
|
|
1028
|
+
Example:
|
|
1029
|
+
```typescript
|
|
1030
|
+
const targetVideoElement:HTMLVideoElmenent = document.getElementById('target-video')
|
|
1031
|
+
|
|
1032
|
+
atwin.setVideoPlayback('pause',targetVideoElement)
|
|
1033
|
+
atwin.setVideoPlayback('mute',targetVideoElement)
|
|
1034
|
+
atwin.setVideoPlayback('unmute',targetVideoElement)
|
|
1035
|
+
```
|
|
1036
|
+
### Setting Animation Control in the Space
|
|
1037
|
+
|
|
1038
|
+
Setting animation control refers to the process of manipulating the playback of animations applied to 3D objects in the space. It involves utilizing controls such as play and pause to control the the animation.
|
|
1039
|
+
|
|
1040
|
+
Assuming that you have already selected an animated 3D object, you can now control the setting of the animation.
|
|
1041
|
+
|
|
1042
|
+
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'.
|
|
1043
|
+
|
|
1044
|
+
**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.
|
|
1045
|
+
|
|
1046
|
+
| parameter | type | required | default | values |
|
|
1047
|
+
| :----: | :----: | :---: | :---: | :---: |
|
|
1048
|
+
| action | string | yes | play | 'play' or 'pause' |
|
|
1049
|
+
| modelId | number | yes | none | showcase id of the 3D model |
|
|
1050
|
+
|
|
1051
|
+
```typescript
|
|
1052
|
+
atwin.setAnimationState('play', 17)
|
|
1053
|
+
```
|
|
1054
|
+
If you wish to pause the Animation of the 3D object, change the parameter to 'pause'.
|
|
1055
|
+
|
|
1056
|
+
```typescript
|
|
1057
|
+
atwin.setAnimationState('pause',17)
|
|
710
1058
|
```
|
|
711
1059
|
|
|
712
1060
|
## Function Reference
|
|
@@ -715,50 +1063,59 @@ Some Functions are **async**; when invoking them, Use keyword **await** or **.th
|
|
|
715
1063
|
|
|
716
1064
|
--------------------------
|
|
717
1065
|
```typescript
|
|
718
|
-
disconnectSpace()
|
|
719
|
-
|
|
1066
|
+
disconnectSpace()
|
|
1067
|
+
// disconnects and clear currently displayed Space
|
|
1068
|
+
// this is an async function that returns a Promise
|
|
720
1069
|
```
|
|
721
1070
|
|
|
722
1071
|
#### Tags
|
|
723
1072
|
````typescript
|
|
724
|
-
gotoTag(space: ISpace)
|
|
725
|
-
|
|
1073
|
+
gotoTag(space: ISpace)
|
|
1074
|
+
// 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
|
|
1075
|
+
// this is an async function that requires a Tag ID param and returns a Promise
|
|
726
1076
|
|
|
727
|
-
atwin.tags //
|
|
1077
|
+
atwin.tags - // variable containing an array of ITag
|
|
728
1078
|
|
|
729
|
-
gotoTag(tagId: number)
|
|
730
|
-
|
|
1079
|
+
gotoTag(tagId: number)
|
|
1080
|
+
// transport navigate directly to the tag with given ID
|
|
1081
|
+
// this is an async function that requires a Tag ID param and returns a Promise
|
|
731
1082
|
|
|
732
|
-
goToRandomTag()
|
|
733
|
-
|
|
1083
|
+
goToRandomTag()
|
|
1084
|
+
// go to a random tag inside the space
|
|
1085
|
+
// this is a void function
|
|
734
1086
|
````
|
|
735
1087
|
### Sweeps
|
|
736
1088
|
````typescript
|
|
737
|
-
getSweeps()
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
atwin.sweeps //Variable containg an array of ISweep data
|
|
741
|
-
|
|
742
|
-
moveToSweep(sweepId: string) - // transport navigate directly to the Sweep with given ID.
|
|
743
|
-
// this is an async function that requires a Sweep ID then returns a Promise
|
|
1089
|
+
getSweeps()
|
|
1090
|
+
// 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
|
|
1091
|
+
// this is an async function that requires a Sweep ID then returns a Promise
|
|
744
1092
|
|
|
1093
|
+
atwin.sweeps
|
|
1094
|
+
// variable containg an array of ISweep data
|
|
745
1095
|
|
|
746
|
-
moveToSweep(sweepId: string)
|
|
747
|
-
|
|
1096
|
+
moveToSweep(sweepId: string)
|
|
1097
|
+
// transport navigate directly to the Sweep with given ID.
|
|
1098
|
+
// this is an async function that requires a Sweep ID then returns a Promise
|
|
748
1099
|
|
|
749
|
-
|
|
750
|
-
|
|
1100
|
+
moveToSweep(sweepId: string)
|
|
1101
|
+
// transport navigate directly to the Sweep with given ID.
|
|
1102
|
+
// this is an async function that requires a Sweep ID then returns a Promise
|
|
751
1103
|
|
|
752
|
-
|
|
753
|
-
|
|
1104
|
+
getNearbySweeps(sweepId: string)
|
|
1105
|
+
// returns the nearby or neighbors of a given sweep.
|
|
1106
|
+
// this is an async function that requires a Sweep ID then returns a Promise
|
|
754
1107
|
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
goToRandomSweep() - // move to a random sweep inside the space
|
|
759
|
-
// this is a void function
|
|
1108
|
+
getCurrentSweep()
|
|
1109
|
+
// returns the current sweep detail
|
|
1110
|
+
// this is a function
|
|
760
1111
|
|
|
1112
|
+
getSweepPosition(): {x: number, y: number, z: number} -
|
|
1113
|
+
// returns the position of the current sweep:
|
|
1114
|
+
// this is a function
|
|
761
1115
|
|
|
1116
|
+
goToRandomSweep()
|
|
1117
|
+
// move to a random sweep inside the space
|
|
1118
|
+
// this is a void function
|
|
762
1119
|
````
|
|
763
1120
|
|
|
764
1121
|
**Example:**
|
|
@@ -771,20 +1128,18 @@ goToRandomSweep() - // move to a random sweep inside the space
|
|
|
771
1128
|
// get current sweep data
|
|
772
1129
|
atwin.getCurrentSweep()
|
|
773
1130
|
|
|
774
|
-
|
|
775
1131
|
// get current sweep position
|
|
776
1132
|
atwin.getSweepPosition()
|
|
777
1133
|
|
|
778
|
-
|
|
779
1134
|
// moving to a Sweep
|
|
780
1135
|
await atwin.moveToSweep('mfj45ligf')
|
|
781
1136
|
|
|
782
|
-
|
|
783
1137
|
// get nearby sweeps from current Sweep
|
|
784
1138
|
await atwin.getNearbySweeps('mfj45ligf')
|
|
785
1139
|
|
|
786
1140
|
// move to a random sweep
|
|
787
1141
|
goToRandomSweep()
|
|
1142
|
+
|
|
788
1143
|
...
|
|
789
1144
|
|
|
790
1145
|
</script>
|
|
@@ -792,11 +1147,18 @@ goToRandomSweep() - // move to a random sweep inside the space
|
|
|
792
1147
|
|
|
793
1148
|
### Video
|
|
794
1149
|
````typescript
|
|
795
|
-
playVideo(videoId: number)
|
|
796
|
-
|
|
1150
|
+
playVideo(videoId: number)
|
|
1151
|
+
// play a video screen
|
|
1152
|
+
// this is a function
|
|
1153
|
+
|
|
1154
|
+
pauseVideo(videoId: number)
|
|
1155
|
+
// pause a video screen
|
|
1156
|
+
// this is a function
|
|
797
1157
|
|
|
798
|
-
|
|
799
|
-
|
|
1158
|
+
setVideoPlayback(action: 'play' | 'pause' | 'mute' | 'unmute', element: HTMLVideoElement) -
|
|
1159
|
+
// action - can be play, pause, mute or unmute
|
|
1160
|
+
// element - can be HTMLVideoElemens such as
|
|
1161
|
+
// this is a function
|
|
800
1162
|
````
|
|
801
1163
|
|
|
802
1164
|
**Example:**
|
|
@@ -805,93 +1167,106 @@ pauseVideo(videoId: number) - // pause a video screen
|
|
|
805
1167
|
import * as atwin from 'architwin';
|
|
806
1168
|
|
|
807
1169
|
...
|
|
1170
|
+
|
|
808
1171
|
// play a video
|
|
809
1172
|
atwin.playVideo(1)
|
|
810
1173
|
|
|
811
|
-
|
|
812
1174
|
// pause a video
|
|
813
1175
|
atwin.pauseVideo(2)
|
|
1176
|
+
|
|
1177
|
+
// play a video screen
|
|
1178
|
+
atwin.setVideoPlayback('play', atwin.selectedObject.component.planeElement)
|
|
1179
|
+
|
|
1180
|
+
// pause a video screen
|
|
1181
|
+
atwin.setVideoPlayback('pause', atwin.selectedObject.component.planeElement)
|
|
1182
|
+
|
|
1183
|
+
// mute a video screen
|
|
1184
|
+
atwin.setVideoPlayback('mute', atwin.selectedObject.component.planeElement)
|
|
1185
|
+
|
|
1186
|
+
// unmute a video screen
|
|
1187
|
+
atwin.setVideoPlayback('unmute', atwin.selectedObject.component.planeElement)
|
|
1188
|
+
|
|
814
1189
|
...
|
|
1190
|
+
|
|
815
1191
|
</script>
|
|
816
1192
|
````
|
|
817
1193
|
### Navigation
|
|
818
1194
|
````typescript
|
|
819
|
-
cameraLookAt(x: number,y: number)
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
1195
|
+
cameraLookAt(x: number,y: number)
|
|
1196
|
+
// set camera view at coordinate in SCREEN.
|
|
1197
|
+
// x and y is in pixel valuews from top left corner of the space canvas
|
|
1198
|
+
// this is an async function and returns a Promise
|
|
1199
|
+
|
|
1200
|
+
moveInDirection(direction: string)
|
|
1201
|
+
// move in DIRECTION, can be LEFT, RIGTH, UP, DOWN, FORWARD, BACKWARD
|
|
1202
|
+
// this is an async function and returns a Promise
|
|
1203
|
+
|
|
1204
|
+
getViewMode()
|
|
1205
|
+
// returns the current View Mode of the space.
|
|
1206
|
+
// there are three modes:
|
|
1207
|
+
// "mode.inside" - shows the interior view of the space
|
|
1208
|
+
// "mode.floorplan" - shows the floor plan of the space
|
|
1209
|
+
// "mode.dollhouse" - shows the doll house view
|
|
1210
|
+
// this is a function
|
|
1211
|
+
|
|
1212
|
+
setViewMode(mode: string)
|
|
1213
|
+
// to set the viewing mode to "INSIDE", "FLOORPLAN" or "DOLLHOUSE"
|
|
1214
|
+
// this is an async function and returns a Promise
|
|
835
1215
|
````
|
|
836
1216
|
|
|
837
1217
|
|
|
838
1218
|
### Camera
|
|
839
1219
|
````typescript
|
|
840
|
-
getCurrentCameraPose()
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
getCameraPosition() - // returns the current camera Position {x,y,z}
|
|
844
|
-
// this is a function
|
|
1220
|
+
getCurrentCameraPose()
|
|
1221
|
+
// returns the current camera Pose object
|
|
1222
|
+
// this is a function
|
|
845
1223
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
1224
|
+
getCameraPosition()
|
|
1225
|
+
// returns the current camera Position {x,y,z}
|
|
1226
|
+
// this is a function
|
|
849
1227
|
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
1228
|
+
cameraPan(x: number, z: number)
|
|
1229
|
+
// pan (z-axis) makes the camera look left and right. tilt (x-axis) the camera look up and down.
|
|
1230
|
+
// x and z are angles in degrees
|
|
1231
|
+
// this is an async function and returns a Promise
|
|
853
1232
|
|
|
1233
|
+
cameraRotate(x: number, y: number, speed: number)
|
|
1234
|
+
// rotates the camera view, x and y is rotation in horizontal
|
|
1235
|
+
// and vertical rotation in degrees
|
|
1236
|
+
// this is an async function and returns a Promise
|
|
854
1237
|
````
|
|
855
1238
|
|
|
856
1239
|
**Example:**
|
|
857
1240
|
````typescript
|
|
858
1241
|
<script lang="ts">
|
|
859
1242
|
import * as atwin from 'architwin';
|
|
1243
|
+
|
|
860
1244
|
...
|
|
861
1245
|
|
|
862
1246
|
// get current Camera Pose
|
|
863
1247
|
atwin.getCurrentCameraPose()
|
|
864
1248
|
|
|
865
|
-
|
|
866
1249
|
// get current camera position
|
|
867
1250
|
atwin.getCameraPosition()
|
|
868
1251
|
|
|
869
|
-
|
|
870
1252
|
// set Camera View
|
|
871
1253
|
await atwin.cameraLookAt(0, 10)
|
|
872
1254
|
|
|
873
|
-
|
|
874
1255
|
// move in different Directions
|
|
875
1256
|
await atwin.moveInDirection("FORWARD")
|
|
876
|
-
await atwin.moveInDirection("FORWARD")
|
|
877
|
-
|
|
878
1257
|
|
|
879
1258
|
// pan around z axis (pan and tilt only works in Dollhouse mode)
|
|
880
1259
|
await atwin.cameraPan(0,20)
|
|
881
1260
|
|
|
882
|
-
|
|
883
1261
|
// tilt abpout x axis
|
|
884
1262
|
await atwin.cameraPan(30,0)
|
|
885
1263
|
|
|
886
|
-
|
|
887
1264
|
// rotate around X axis, last parameter is the Speed of rotation in seconds
|
|
888
1265
|
await atwin.cameraRotate(20,0,2)
|
|
889
1266
|
|
|
890
|
-
|
|
891
1267
|
// rotate around Y axis
|
|
892
1268
|
await atwin.cameraRotate(20,5,2)
|
|
893
1269
|
|
|
894
|
-
|
|
895
1270
|
// get current View
|
|
896
1271
|
atwin.getViewMode()
|
|
897
1272
|
|
|
@@ -899,6 +1274,7 @@ cameraRotate(x: number, y: number, speed: number) - // rotates the camera view,
|
|
|
899
1274
|
await atwin.setViewMode("INSIDE")
|
|
900
1275
|
await atwin.setViewMode("FLOORPLAN")
|
|
901
1276
|
await atwin.setViewMode("DOLLHOUSE")
|
|
1277
|
+
|
|
902
1278
|
...
|
|
903
1279
|
|
|
904
1280
|
</script>
|
|
@@ -908,7 +1284,6 @@ cameraRotate(x: number, y: number, speed: number) - // rotates the camera view,
|
|
|
908
1284
|
|
|
909
1285
|
|
|
910
1286
|
````typescript
|
|
911
|
-
|
|
912
1287
|
getNearbyObjects(type?: '3DX' | 'SLIDESHOW' | 'VIDEO', distance?: number = 2)
|
|
913
1288
|
// returns a list of nearby objects
|
|
914
1289
|
// type - can be 3Dx, Slideshow or Video; parameter is optional. if no parameter is passed, it returns all objects
|
|
@@ -939,12 +1314,23 @@ revertTransform(action: 'undo' | 'redo')
|
|
|
939
1314
|
|
|
940
1315
|
clearTransformControls()
|
|
941
1316
|
// clears the transform component attached to the selected object
|
|
1317
|
+
|
|
1318
|
+
setAnimationState(action: 'play' | 'stop', target:I3DObject)
|
|
1319
|
+
// sets the animation state of a 3D model
|
|
1320
|
+
// action - can be play or stop
|
|
1321
|
+
// this is a function
|
|
1322
|
+
|
|
1323
|
+
showObjectDimensions(selected:IObjectData)
|
|
1324
|
+
// shows the width, height, depth of a 3D model
|
|
1325
|
+
// this is a function
|
|
1326
|
+
|
|
942
1327
|
````
|
|
943
1328
|
|
|
944
1329
|
**Example**
|
|
945
1330
|
````typescript
|
|
946
1331
|
<script lang="ts">
|
|
947
1332
|
import * as atwin from 'architwin';
|
|
1333
|
+
|
|
948
1334
|
...
|
|
949
1335
|
|
|
950
1336
|
// get all nearby objects
|
|
@@ -985,7 +1371,46 @@ clearTransformControls()
|
|
|
985
1371
|
|
|
986
1372
|
// clears the transform component
|
|
987
1373
|
atwin.clearTransformControls()
|
|
1374
|
+
|
|
1375
|
+
// play object animation
|
|
1376
|
+
atwin.setAnimationState('play', atwin.selectedObject.object.object_data)
|
|
1377
|
+
|
|
1378
|
+
// pause object animation
|
|
1379
|
+
atwin.setAnimationState('pause', atwin.selectedObject.object.object_data)
|
|
1380
|
+
|
|
1381
|
+
// show object dimension
|
|
1382
|
+
atwin.showObjectDimensions(atwin.selectedObject)
|
|
1383
|
+
|
|
988
1384
|
...
|
|
989
1385
|
|
|
990
1386
|
</script>
|
|
991
1387
|
````
|
|
1388
|
+
|
|
1389
|
+
**To Do:**
|
|
1390
|
+
* when adding an object it should specify the position, scale, rotate of the object
|
|
1391
|
+
for example:
|
|
1392
|
+
```typescript
|
|
1393
|
+
atwin.addObjectToScene(object:I3DObject, option:object, position:Vector3, scale:Vector3, rotate:Vector3)
|
|
1394
|
+
```
|
|
1395
|
+
|
|
1396
|
+
or
|
|
1397
|
+
```typescript
|
|
1398
|
+
atwin.addObjectToScene(object:I3DObject, option:object, tranform:Object3DPosition)
|
|
1399
|
+
```
|
|
1400
|
+
|
|
1401
|
+
* adding a media screen should be
|
|
1402
|
+
|
|
1403
|
+
```typescript
|
|
1404
|
+
addMediaScreen(mediaUrl:string, transform:Object3DPosition, readonly:boolean = false, autoplay:boolean = false)
|
|
1405
|
+
```
|
|
1406
|
+
where
|
|
1407
|
+
* media could be an empty string or URL string
|
|
1408
|
+
* readonly and autoplay is optional
|
|
1409
|
+
|
|
1410
|
+
* scale and rotation is not working in transform
|
|
1411
|
+
* setMediaScreenContent() has CORS error when getting url from google images
|
|
1412
|
+
* for setting the media screen content, we need to get the payload of the media screen object because we need the object ID
|
|
1413
|
+
* we can do this by returning the media screen payload from addMediaScreen()
|
|
1414
|
+
|
|
1415
|
+
* deleteMediaScreen()
|
|
1416
|
+
* hideMediaScreen()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "architwin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
4
4
|
"description": "ArchiTwin Library for Matterport",
|
|
5
5
|
"main": "./lib/architwin.min.js",
|
|
6
6
|
"types": "./lib/architwin.d.ts",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"author": "",
|
|
28
28
|
"license": "ISC",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"
|
|
30
|
+
"@superviz/matterport-plugin": "^0.8.7",
|
|
31
|
+
"@superviz/sdk": "^4.10.0",
|
|
31
32
|
"aws-sdk": "^2.1385.0",
|
|
32
33
|
"axios": "^1.4.0",
|
|
33
34
|
"jszip": "^3.10.1",
|
|
@@ -39,6 +40,7 @@
|
|
|
39
40
|
"@tsconfig/node18": "^2.0.1",
|
|
40
41
|
"@types/node": "^18.16.15",
|
|
41
42
|
"@types/validator": "^13.7.17",
|
|
43
|
+
"css-loader": "^6.8.1",
|
|
42
44
|
"javascript-obfuscator": "^4.0.2",
|
|
43
45
|
"terser-webpack-plugin": "^5.3.9",
|
|
44
46
|
"typescript": "5.0.4",
|
package/static/map.css
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
.showcase_container {
|
|
2
|
+
position: relative;
|
|
3
|
+
margin: 0 auto 10px auto;
|
|
4
|
+
box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.5);
|
|
5
|
+
}
|
|
6
|
+
.map_container {
|
|
7
|
+
opacity: 0;
|
|
8
|
+
line-height: 0;
|
|
9
|
+
position: absolute;
|
|
10
|
+
top: 10px;
|
|
11
|
+
right: 10px;
|
|
12
|
+
background: #222;
|
|
13
|
+
transition: opacity 0.75s;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/* Display Minimap -- this class is removed in scenarios where it should not be displayed */
|
|
17
|
+
body.minimap .map_container {
|
|
18
|
+
opacity: 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
#map {
|
|
22
|
+
z-index: 99;
|
|
23
|
+
width: 100px;
|
|
24
|
+
background: rgba(0, 0, 0, 0.5);
|
|
25
|
+
transition: width 0.5s;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#map:hover {
|
|
29
|
+
width: 250px;
|
|
30
|
+
}
|
|
31
|
+
#map img {
|
|
32
|
+
width: 100%;
|
|
33
|
+
-webkit-user-drag: none;
|
|
34
|
+
-khtml-user-drag: none;
|
|
35
|
+
-moz-user-drag: none;
|
|
36
|
+
-o-user-drag: none;
|
|
37
|
+
}
|
|
38
|
+
#map button {
|
|
39
|
+
display: none;
|
|
40
|
+
position: absolute;
|
|
41
|
+
padding: 0 0;
|
|
42
|
+
margin: 0;
|
|
43
|
+
height: 0.8rem;
|
|
44
|
+
width: 0.8rem;
|
|
45
|
+
margin-top: 0.8rem;
|
|
46
|
+
margin-left: -0.6rem;
|
|
47
|
+
border: 0.1rem solid #353535;
|
|
48
|
+
color: transparent;
|
|
49
|
+
background: #353535;
|
|
50
|
+
opacity: 0.5;
|
|
51
|
+
border-radius: 50%;
|
|
52
|
+
box-sizing: content-box;
|
|
53
|
+
font-size: 10px;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
transition: border-color 0.5s;
|
|
56
|
+
background: 0.5s;
|
|
57
|
+
opacity: 0.5s;
|
|
58
|
+
color: 0.5s;
|
|
59
|
+
}
|
|
60
|
+
#map button:hover {
|
|
61
|
+
color: #fff;
|
|
62
|
+
opacity: 1;
|
|
63
|
+
}
|
|
64
|
+
#map button.active {
|
|
65
|
+
background: #ff3158;
|
|
66
|
+
opacity: 1;
|
|
67
|
+
}
|
|
68
|
+
#map button:hover {
|
|
69
|
+
border: 0.1rem solid #ff3158;
|
|
70
|
+
background: #ff3158;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
#map.floor0:hover button.floor0,
|
|
74
|
+
#map.floor1:hover button.floor1,
|
|
75
|
+
#map.floor2:hover button.floor2,
|
|
76
|
+
#map.floor3:hover button.floor3,
|
|
77
|
+
#map.floor4:hover button.floor4,
|
|
78
|
+
#map.floor5:hover button.floor5,
|
|
79
|
+
#map.floor6:hover button.floor6,
|
|
80
|
+
#map.floor7:hover button.floor7,
|
|
81
|
+
#map.floor8:hover button.floor8,
|
|
82
|
+
#map.floor9:hover button.floor9,
|
|
83
|
+
#map.floor10:hover button.floor10,
|
|
84
|
+
#map.floor11:hover button.floor11,
|
|
85
|
+
#map.floor12:hover button.floor12,
|
|
86
|
+
#map.floor13:hover button.floor13 {
|
|
87
|
+
display: inline-block;
|
|
88
|
+
}
|
package/webpack.config.cjs
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const TerserPlugin = require("terser-webpack-plugin");
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
mode: 'production',
|
|
7
|
+
entry: './src/architwin.ts',
|
|
8
|
+
target: ['web', 'es5'],
|
|
9
|
+
module: {
|
|
10
|
+
rules: [
|
|
11
|
+
{
|
|
12
|
+
test: /\.tsx?$/,
|
|
13
|
+
use: 'ts-loader',
|
|
14
|
+
exclude: /node_modules/,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
resolve: {
|
|
19
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
20
|
+
},
|
|
21
|
+
output: {
|
|
22
|
+
filename: 'architwin.min.js',
|
|
23
|
+
path: path.resolve(__dirname, 'lib'),
|
|
24
|
+
},
|
|
25
|
+
};
|