architwin 1.8.2 → 1.8.3

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 (38) hide show
  1. package/README.md +21 -0
  2. package/lib/architwin.d.ts +49 -2
  3. package/lib/architwin.js +6498 -1
  4. package/lib/atwinui/components/toolbar/i18n.js +47 -2
  5. package/lib/atwinui/components/toolbar/index.js +9 -1
  6. package/lib/atwinui/components/toolbar/menuBar.d.ts +3 -0
  7. package/lib/atwinui/components/toolbar/menuBar.js +32 -16
  8. package/lib/atwinui/components/toolbar/objectListPane.js +1 -1
  9. package/lib/atwinui/components/toolbar/roomCreation/roomFormPane.d.ts +12 -0
  10. package/lib/atwinui/components/toolbar/roomCreation/roomFormPane.js +583 -0
  11. package/lib/atwinui/components/toolbar/roomCreation/roomLayerListPane.d.ts +33 -0
  12. package/lib/atwinui/components/toolbar/roomCreation/roomLayerListPane.js +448 -0
  13. package/lib/atwinui/components/toolbar/tagListPane.js +1 -2
  14. package/lib/atwinui/components/toolbar/themePane.js +1 -1
  15. package/lib/atwinui/events.d.ts +3 -1
  16. package/lib/atwinui/events.js +242 -2
  17. package/lib/atwinui/index.js +3 -1
  18. package/lib/convert.d.ts +1 -14
  19. package/lib/convert.js +6 -63
  20. package/lib/loaders/index.d.ts +2 -1
  21. package/lib/loaders/index.js +2 -1
  22. package/lib/loaders/polydrawerLoader.d.ts +147 -0
  23. package/lib/loaders/polydrawerLoader.js +760 -0
  24. package/lib/types.d.ts +88 -1
  25. package/lib/types.js +16 -0
  26. package/lib/utils.d.ts +2 -0
  27. package/lib/utils.js +16 -0
  28. package/lib/vertexPlacer.d.ts +18 -0
  29. package/lib/vertexPlacer.js +69 -0
  30. package/lib/zoom.d.ts +6 -1
  31. package/lib/zoom.js +10 -1
  32. package/package.json +4 -2
  33. package/static/atwinui.css +431 -2
  34. package/static/utility.css +39 -1
  35. package/lib/atwinui/components/toolbar/menu-bar.d.ts +0 -4
  36. package/lib/atwinui/components/toolbar/menu-bar.js +0 -35
  37. package/lib/atwinui/components/toolbar/sidebar-container.d.ts +0 -5
  38. package/lib/atwinui/components/toolbar/sidebar-container.js +0 -27
package/lib/types.d.ts CHANGED
@@ -200,6 +200,7 @@ export interface I3DObject {
200
200
  created_on?: string;
201
201
  object_file?: string;
202
202
  object_filename?: string;
203
+ json_data?: any;
203
204
  }
204
205
  export interface IShowcaseObject {
205
206
  id: number;
@@ -423,6 +424,10 @@ export interface ComponentOptions {
423
424
  lineEndOffset?: number | undefined;
424
425
  maxLineLength?: number | undefined;
425
426
  customPointerTexture?: string | undefined;
427
+ path?: Array<Vector3> | undefined;
428
+ fillColor?: string | undefined;
429
+ radius?: number | undefined;
430
+ scrollSpeed?: number | undefined;
426
431
  }
427
432
  export interface VectorCoords {
428
433
  object_position: Vector3;
@@ -675,7 +680,23 @@ export declare enum SPACE_EVENTS {
675
680
  CAMERA_PAN_START = "CAMERA_PAN_START",
676
681
  CAMERA_PAN_END = "CAMERA_PAN_END",
677
682
  CURRENT_CAMERA_POSE = "CURRENT_CAMERA_POSE",
678
- CURRENT_CAMERA_ZOOM = "CURRENT_CAMERA_ZOOM"
683
+ CURRENT_CAMERA_ZOOM = "CURRENT_CAMERA_ZOOM",
684
+ VERTEXPLACER_CREATED = "VERTEXPLACER_CREATED",
685
+ VERTEX_PLACED = "VERTEX_PLACED",
686
+ VERTEX_DRAG_BEGIN = "VERTEX_DRAG_BEGIN",
687
+ VERTEX_DRAG_END = "VERTEX_DRAG_END",
688
+ VERTEX_REMOVED = "VERTEX_REMOVED",
689
+ LINE_ATTACHED = "LINE_ATTACHED",
690
+ LINE_UPDATED = "LINE_UPDATED",
691
+ LINE_DETACHED = "LINE_DETACHED",
692
+ PARTITION_UPDATED = "PARTITION_UPDATED",
693
+ PARTITION_SAVED = "PARTITION_SAVED",
694
+ PARTITION_EDITED = "PARTITION_EDITED",
695
+ FLOOR_CLICKED = "FLOOR_CLICKED",
696
+ WALL_CLICKED = "WALL_CLICKED",
697
+ UPDATE_ROOM_LIST = "UPDATE_ROOM_LIST",
698
+ DISPLAY_SPACE_PARTITION_REPORT = "DISPLAY_SPACE_PARTITION_REPORT",
699
+ PARTITION_CLICKED = "PARTITION_CLICKED"
679
700
  }
680
701
  export declare const enum TAG_COLOR {
681
702
  MAROON = "MAROON",
@@ -819,6 +840,7 @@ export interface IToolbarConfig {
819
840
  models?: boolean;
820
841
  minimap?: boolean;
821
842
  theme?: boolean;
843
+ roomCreation?: boolean;
822
844
  };
823
845
  themeConfig?: IThemeConfig;
824
846
  }
@@ -933,6 +955,61 @@ export interface EmbedlyData {
933
955
  version: string;
934
956
  width: number;
935
957
  }
958
+ export interface FloorPolygonPayload {
959
+ startPoint: Vector3;
960
+ endPoint: Vector3;
961
+ length: number;
962
+ unit: string;
963
+ }
964
+ export interface WallPolygonPayload {
965
+ path: Array<Vector3>;
966
+ dimensions: {
967
+ area: number;
968
+ unit: string;
969
+ };
970
+ }
971
+ export interface PartitionPayload {
972
+ uuid?: string | undefined;
973
+ space_uuid?: string | undefined;
974
+ name?: string | undefined;
975
+ parent_uuid?: string | undefined;
976
+ polygon_json: PolygonData;
977
+ }
978
+ export interface EdgePolyData {
979
+ name?: string | undefined;
980
+ options?: any;
981
+ start?: Vector3;
982
+ end?: Vector3;
983
+ length?: number | undefined;
984
+ }
985
+ export interface FloorPolyData {
986
+ uuid?: string | undefined;
987
+ name?: string | undefined;
988
+ options?: {
989
+ color: number | undefined;
990
+ opacity: number | undefined;
991
+ };
992
+ area: number | undefined;
993
+ floor_level: number;
994
+ edges: Array<EdgePolyData>;
995
+ }
996
+ export interface WallPolyData {
997
+ uuid?: string | undefined;
998
+ name?: string | undefined;
999
+ options?: {
1000
+ color: number | undefined;
1001
+ opacity: number | undefined;
1002
+ };
1003
+ area: number;
1004
+ wall_height: number;
1005
+ edges: Array<EdgePolyData>;
1006
+ }
1007
+ export interface PolygonData {
1008
+ path: Array<Vector3>;
1009
+ options: any;
1010
+ floor: FloorPolyData;
1011
+ walls: Array<WallPolyData>;
1012
+ }
936
1013
  export declare const enum IO_PARTICIPANT_COLORS {
937
1014
  GREEN = "GREEN",
938
1015
  BLUE = "BLUE",
@@ -960,3 +1037,13 @@ export declare enum ZOOM_COMMAND {
960
1037
  TOGGLE_VIDEO_OFF = "TOGGLE VIDEO OFF",
961
1038
  TOGGLE_MIC_OFF = "TOGGLE MIC OFF"
962
1039
  }
1040
+ export interface RoomNode {
1041
+ uuid?: string;
1042
+ space_uuid: string;
1043
+ name: string;
1044
+ parent_uuid: string | null;
1045
+ polygon_json: string;
1046
+ children?: RoomNode[];
1047
+ created_on?: string;
1048
+ modified_on?: string;
1049
+ }
package/lib/types.js CHANGED
@@ -76,6 +76,22 @@ export var SPACE_EVENTS;
76
76
  SPACE_EVENTS["CAMERA_PAN_END"] = "CAMERA_PAN_END";
77
77
  SPACE_EVENTS["CURRENT_CAMERA_POSE"] = "CURRENT_CAMERA_POSE";
78
78
  SPACE_EVENTS["CURRENT_CAMERA_ZOOM"] = "CURRENT_CAMERA_ZOOM";
79
+ SPACE_EVENTS["VERTEXPLACER_CREATED"] = "VERTEXPLACER_CREATED";
80
+ SPACE_EVENTS["VERTEX_PLACED"] = "VERTEX_PLACED";
81
+ SPACE_EVENTS["VERTEX_DRAG_BEGIN"] = "VERTEX_DRAG_BEGIN";
82
+ SPACE_EVENTS["VERTEX_DRAG_END"] = "VERTEX_DRAG_END";
83
+ SPACE_EVENTS["VERTEX_REMOVED"] = "VERTEX_REMOVED";
84
+ SPACE_EVENTS["LINE_ATTACHED"] = "LINE_ATTACHED";
85
+ SPACE_EVENTS["LINE_UPDATED"] = "LINE_UPDATED";
86
+ SPACE_EVENTS["LINE_DETACHED"] = "LINE_DETACHED";
87
+ SPACE_EVENTS["PARTITION_UPDATED"] = "PARTITION_UPDATED";
88
+ SPACE_EVENTS["PARTITION_SAVED"] = "PARTITION_SAVED";
89
+ SPACE_EVENTS["PARTITION_EDITED"] = "PARTITION_EDITED";
90
+ SPACE_EVENTS["FLOOR_CLICKED"] = "FLOOR_CLICKED";
91
+ SPACE_EVENTS["WALL_CLICKED"] = "WALL_CLICKED";
92
+ SPACE_EVENTS["UPDATE_ROOM_LIST"] = "UPDATE_ROOM_LIST";
93
+ SPACE_EVENTS["DISPLAY_SPACE_PARTITION_REPORT"] = "DISPLAY_SPACE_PARTITION_REPORT";
94
+ SPACE_EVENTS["PARTITION_CLICKED"] = "PARTITION_CLICKED";
79
95
  })(SPACE_EVENTS || (SPACE_EVENTS = {}));
80
96
  export var MEETING_SIDEBAR;
81
97
  (function (MEETING_SIDEBAR) {
package/lib/utils.d.ts CHANGED
@@ -51,3 +51,5 @@ export declare function initBundleVersion(mpConfig: IMPConfig): Promise<void>;
51
51
  * @returns _bundleVersion Matterport showcase bundle version
52
52
  */
53
53
  export declare function getBundleVersion(): string;
54
+ export declare function getPolygonArea(vertices: Array<Vector3>): number;
55
+ export declare function extractUUID(partitionName: string): string;
package/lib/utils.js CHANGED
@@ -238,3 +238,19 @@ export function initBundleVersion(mpConfig) {
238
238
  export function getBundleVersion() {
239
239
  return _bundleVersion;
240
240
  }
241
+ export function getPolygonArea(vertices) {
242
+ if (vertices.length < 3 || !vertices)
243
+ return 0;
244
+ let area = 0;
245
+ for (let i = 0; i < vertices.length; i++) {
246
+ const current = vertices[i];
247
+ const next = vertices[(i + 1) % vertices.length];
248
+ area += (current.x * next.z) - (next.x * current.z);
249
+ }
250
+ return Math.abs(area) / 2;
251
+ }
252
+ export function extractUUID(partitionName) {
253
+ const uuidRegex = /[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/;
254
+ const match = partitionName.match(uuidRegex);
255
+ return match ? match[0] : null; // Return the UUID if found, otherwise return null
256
+ }
@@ -0,0 +1,18 @@
1
+ import type { IObserver, ISubscription, MpSdk, Pointer, Scene, Vector3 } from '../bundle/sdk';
2
+ export declare class VertexPlacer implements Scene.IComponentEventSpy, IObserver<Pointer.Intersection> {
3
+ mpSdk: MpSdk;
4
+ sceneObject: Scene.IObject;
5
+ tagDataId: string;
6
+ eventType: string;
7
+ tagPointer: ISubscription;
8
+ input: Scene.IComponent;
9
+ inputNode: Scene.INode;
10
+ callbackFunc: any;
11
+ vertexPoints: Array<Vector3>;
12
+ constructor(mpSdk: MpSdk, sceneObject: Scene.IObject);
13
+ onEvent(): Promise<void>;
14
+ onChanged(data: Pointer.Intersection): void;
15
+ setupInput(): Promise<void>;
16
+ moveTag(callback: any): Promise<void>;
17
+ cancelPlacer(): Promise<void>;
18
+ }
@@ -0,0 +1,69 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { dispatchSpaceEvent } from './architwin';
11
+ import { SPACE_EVENTS } from './types';
12
+ export class VertexPlacer {
13
+ constructor(mpSdk, sceneObject) {
14
+ this.mpSdk = mpSdk;
15
+ this.sceneObject = sceneObject;
16
+ }
17
+ onEvent() {
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ console.log('TagEvent onEvent()');
20
+ try {
21
+ dispatchSpaceEvent(SPACE_EVENTS.VERTEX_PLACED);
22
+ }
23
+ catch (error) {
24
+ console.error(`onChange: ${error}`);
25
+ }
26
+ });
27
+ }
28
+ onChanged(data) {
29
+ console.log('TagEvent onChanged()');
30
+ try {
31
+ }
32
+ catch (error) {
33
+ console.error(`onChange: ${error}`);
34
+ }
35
+ }
36
+ setupInput() {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ console.log('VertexEvent setupInput()');
39
+ this.inputNode = this.sceneObject.addNode();
40
+ this.input = this.inputNode.addComponent('mp.input');
41
+ this.inputNode.start();
42
+ this.input.spyOnEvent(this);
43
+ });
44
+ }
45
+ moveTag(callback) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ console.log('TagEvent moveTag()');
48
+ this.eventType = "INTERACTION.POINTER_BUTTON";
49
+ this.callbackFunc = callback;
50
+ yield this.setupInput();
51
+ this.input.inputs.userNavigationEnabled = false;
52
+ this.tagPointer = this.mpSdk.Pointer.intersection.subscribe(this);
53
+ const pointer = this.tagPointer;
54
+ const inputNode = this.inputNode;
55
+ dispatchSpaceEvent(SPACE_EVENTS.VERTEXPLACER_CREATED, {
56
+ pointer,
57
+ inputNode
58
+ });
59
+ });
60
+ }
61
+ cancelPlacer() {
62
+ var _a;
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ (_a = this.tagPointer) === null || _a === void 0 ? void 0 : _a.cancel();
65
+ setTimeout(() => this.input.inputs.userNavigationEnabled = true, 300);
66
+ this.inputNode.stop();
67
+ });
68
+ }
69
+ }
package/lib/zoom.d.ts CHANGED
@@ -179,4 +179,9 @@ declare function detachParticipantVideo(userId: number): Promise<boolean>;
179
179
  *****************************************************************************************/
180
180
  declare function sendCommand(command: ZOOM_COMMAND, userId?: number): Promise<ExecutedFailure | CommandChannelMsg>;
181
181
  declare function attachParticipantsVideo(): Promise<void>;
182
- export { roles, type Participant, type MediaDevice, initializeHTMLElements, createMeeting, createLocalAudioTrack, createLocalVideoTrack, startLocalVideo, stopLocalVideo, testLocalSpeaker, stopSpeakerTesting, muteLocalAudio, unMuteLocalAudio, generateJWTSignature, joinMeeting, setupMeetingSession, leaveMeeting, endMeeting, startVideo, stopVideo, unMuteAudio, muteAudio, getUserInfo, getAllParticipants, getDevices, getCameraList, getMicList, getSpeakerList, switchMicrophone, switchSpeaker, switchCamera, attachParticipantsVideo, attachParticipantVideo, detachParticipantVideo, sendCommand, };
182
+ /*****************************************************************************************
183
+ * This function will set the custom avatar zoom image to the current user *
184
+ * @param avatarSrc : string - Required a string avatar image source link *
185
+ *****************************************************************************************/
186
+ declare function setAvatarMeetingImage(payload: string): void;
187
+ export { roles, type Participant, type MediaDevice, initializeHTMLElements, createMeeting, createLocalAudioTrack, createLocalVideoTrack, startLocalVideo, stopLocalVideo, testLocalSpeaker, stopSpeakerTesting, muteLocalAudio, unMuteLocalAudio, generateJWTSignature, joinMeeting, setupMeetingSession, leaveMeeting, endMeeting, startVideo, stopVideo, unMuteAudio, muteAudio, getUserInfo, getAllParticipants, getDevices, getCameraList, getMicList, getSpeakerList, switchMicrophone, switchSpeaker, switchCamera, attachParticipantsVideo, attachParticipantVideo, detachParticipantVideo, sendCommand, setAvatarMeetingImage };
package/lib/zoom.js CHANGED
@@ -34,6 +34,7 @@ let mediaDevices;
34
34
  let isLocalVideoOn = false;
35
35
  let isLocalMuted = true;
36
36
  let spearkerReturn;
37
+ let selectedAvatarImage = "";
37
38
  let audioDecode = false;
38
39
  let audioEncode = false;
39
40
  let baseURL = new URL(window.location.href);
@@ -874,6 +875,7 @@ function setupMeetingSession() {
874
875
  currentParticipant.role = currentUserInfo.isHost
875
876
  ? 1 /* Meeting_Role.HOST */
876
877
  : 0 /* Meeting_Role.GUEST */;
878
+ currentUserInfo.avatar = selectedAvatarImage;
877
879
  yield atwin.dispatchSpaceEvent(SPACE_EVENTS.CURRENT_USER_LOADED, currentUserInfo);
878
880
  participants = (yield getAllParticipants()).filter((participant) => participant.userId !== currentUserInfo.userId);
879
881
  yield atwin.dispatchSpaceEvent(SPACE_EVENTS.PARTICIPANT_ADDED, participants);
@@ -1423,4 +1425,11 @@ function attachParticipantsVideo() {
1423
1425
  }));
1424
1426
  });
1425
1427
  }
1426
- export { roles, initializeHTMLElements, createMeeting, createLocalAudioTrack, createLocalVideoTrack, startLocalVideo, stopLocalVideo, testLocalSpeaker, stopSpeakerTesting, muteLocalAudio, unMuteLocalAudio, generateJWTSignature, joinMeeting, setupMeetingSession, leaveMeeting, endMeeting, startVideo, stopVideo, unMuteAudio, muteAudio, getUserInfo, getAllParticipants, getDevices, getCameraList, getMicList, getSpeakerList, switchMicrophone, switchSpeaker, switchCamera, attachParticipantsVideo, attachParticipantVideo, detachParticipantVideo, sendCommand, };
1428
+ /*****************************************************************************************
1429
+ * This function will set the custom avatar zoom image to the current user *
1430
+ * @param avatarSrc : string - Required a string avatar image source link *
1431
+ *****************************************************************************************/
1432
+ function setAvatarMeetingImage(payload) {
1433
+ selectedAvatarImage = payload;
1434
+ }
1435
+ export { roles, initializeHTMLElements, createMeeting, createLocalAudioTrack, createLocalVideoTrack, startLocalVideo, stopLocalVideo, testLocalSpeaker, stopSpeakerTesting, muteLocalAudio, unMuteLocalAudio, generateJWTSignature, joinMeeting, setupMeetingSession, leaveMeeting, endMeeting, startVideo, stopVideo, unMuteAudio, muteAudio, getUserInfo, getAllParticipants, getDevices, getCameraList, getMicList, getSpeakerList, switchMicrophone, switchSpeaker, switchCamera, attachParticipantsVideo, attachParticipantVideo, detachParticipantVideo, sendCommand, setAvatarMeetingImage };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",
@@ -49,10 +49,12 @@
49
49
  "pdfjs-dist": "^3.10.111",
50
50
  "short-unique-id": "^5.2.0",
51
51
  "socket.io-client": "^4.7.2",
52
- "ts-loader": "^9.4.3"
52
+ "ts-loader": "^9.4.3",
53
+ "tweakpane": "^4.0.5"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@tsconfig/node18": "^2.0.1",
57
+ "@tweakpane/core": "^2.0.5",
56
58
  "@types/jsrsasign": "^10.5.14",
57
59
  "@types/node": "^18.16.15",
58
60
  "@types/three": "^0.154.0",