architwin 1.10.10 → 1.10.11

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.
@@ -2,7 +2,7 @@ import { AxiosInstance } from "axios";
2
2
  import { MpSdk, Scene, Vector3, Vector2, Renderer } from "../bundle/sdk";
3
3
  import { tubeLineType } from "./loaders";
4
4
  import { initToolbarUI, themeManager } from "./atwinui";
5
- import { type ITag, type IUser, type ISpace, type IShowcaseObject, type I3DObject, type IMPConfig, type ISweep, type ITagPublic, type NearbyPayload, type NearbyObjects, type IObjectData, TRANSFORM_TYPE, Object3DPosition, ObjectCoordinates, EulerCoordinates, State, FileUpload, ObjectConfig, IAtwinFloor, IAtwinLabel, SPACE_EVENTS, ComponentOptions, SpaceAvatar, IMapConfig, MEETING_SIDEBAR, IO_ROLE, IO_SPACE_EVENTS, IO_MEETING_EVENTS, SCREEN_POSITIONS, ITagCategory, TagMessage, ISdkConnections, PartitionNode, PartitionPayload } from "./types";
5
+ import { type ITag, type IUser, type ISpace, type IShowcaseObject, type I3DObject, type IMPConfig, type ISweep, type ITagPublic, type NearbyPayload, type NearbyObjects, type IObjectData, TRANSFORM_TYPE, Object3DPosition, ObjectCoordinates, EulerCoordinates, State, FileUpload, ObjectConfig, IAtwinFloor, IAtwinLabel, SPACE_EVENTS, ComponentOptions, SpaceAvatar, IMapConfig, MEETING_SIDEBAR, IO_ROLE, IO_SPACE_EVENTS, IO_MEETING_EVENTS, SCREEN_POSITIONS, ITagCategory, TagMessage, ISdkConnections, PartitionNode, PartitionPayload, ICurrentSpace } from "./types";
6
6
  import * as minimap from './minimap';
7
7
  import '../static/sidebar.css';
8
8
  import '../static/map.css';
@@ -80,6 +80,10 @@ declare function connectSpace(url: string, auth: {
80
80
  onPlay: Function;
81
81
  }): Promise<void>;
82
82
  declare function getAtwinSdk(): MpSdk | null;
83
+ /**
84
+ * Check if a specific toolbar feature is enabled or not
85
+ */
86
+ declare function isToolbarFeatureEnabled(key: string): boolean;
83
87
  declare function getFloors(): IAtwinFloor[];
84
88
  declare function getLabels(): IAtwinLabel[];
85
89
  /**
@@ -616,6 +620,7 @@ declare function setTagMessages(messages: Array<TagMessage>): void;
616
620
  declare function getTagMessages(): Array<TagMessage>;
617
621
  declare function setSelectedTagUuid(uuid: string): void;
618
622
  declare function getSelectedTagUuid(): string;
623
+ declare function setCurrentSpace(space: ICurrentSpace): void;
619
624
  declare function renderMeetingSidebar(template?: string, templateName?: MEETING_SIDEBAR): void;
620
625
  /**
621
626
  * Subscribes a method or an array of methods to a Matterport event.
@@ -687,4 +692,4 @@ declare function getPathBetweenSweeps(startSweepId: string, endSweepId: string,
687
692
  }[];
688
693
  }>;
689
694
  declare function moveAlongPath(path: any[], iframeId: any): Promise<void>;
690
- export { _atwin, _config, _mpConfig, tags, sweeps, selectedObject, previousObjTransform, currentObjTransform, actionHistory, state, _tags, _tagCategories, _tagMessageRecepients, _space, _spaceId, _api, _pointerCoord, _3DXObjects, _meetingParticipants, _generatedObjectIds, tagColors, domMousePosition, isFitScreenOccupied, isCdnMapDataAvailable, minimap, _modelDetails, _onMouseClickInstance, transformHistory, _partitionNodes, initAtwinApi, getAtwinSdk, connectSpace, disconnectSpace, clearActionHistory, getSweeps, getCurrentSweep, getCurrentSweepPosition, moveToSweep, getNearbySweeps, getAllSweeps, getCurrentCameraPose, getCurrentCameraZoom, getCameraPosition, getCurrentFloor, moveInDirection, cameraLookAt, cameraPan, cameraRotate, cameraSetRotation, getViewMode, setViewMode, captureSpaceScreenshot, captureScreenshotAndCameraDetails, getNearbyObjects, setTransformMode, setSelectedObject, clearSelectedObject, revertTransform, setTransformControls, removeTransformControls, setRenderDistance, addObject, getObject, addObjectToSpace, addMediaScreen, attachMediaScreenContent, updateObject, updateShowcaseObject, deleteObject, deleteShowcaseObject, copyObject, replaceObject, getTargetPosition, setObjectTransformation, setPointerCoordinates, addTextMarkupScreen, setTextMarkupScreenContent, goTo3dx, goToModel, hasTimeElapsed, getSelectedObject, renderAvatar, setSpaceAvatar, get3DXObjects, setLibrary, getLibrary, disposeModel, renderInSpaceMediaScreen, goToPosition, goToParticipant, getNearestSweepFromObject, cancelModelPlacement, renderViewpointMarker, toggleViewpointVisibility, convertDegRotationToEuler, pauseVideo, playVideo, setVideoPlayback, setAnimationState, showMinimap, hideMinimap, getMapConfig, addTag, getTags, gotoTag, renderTag, disposeTag, disposeTags, getMpTags, getMpTag, showTags, attachTagMedia, detachTagMedia, moveTag, editTagLabel, editTagDescription, editTagStem, editTagIcon, editTagColor, saveTag, rotateCameraToObject, setModelVisibility, tagStateSubscriber, setTagIcon, setTagCategories, setUserAssignedCategories, getUserAssignedCategories, setTagMessageRecepients, getTagMessageRecepients, setTagMessages, getTagMessages, setSelectedTagUuid, getSelectedTagUuid, toggleFitToScreen, getFloors, getLabels, renderMeetingSidebar, createMeetingTemplate, joinMeetingTemplate, meet, dispatchSpaceEvent, subscribeSpaceEvent, unsubscribeSpaceEvent, registerCustomSpaceEvent, initSocketIo, socketEmit, getParticipants, followParticipant, unFollowParticipant, enableHUD, disableHUD, getMediaScreenHUDs, canSetHud, saveMediaScreenHud, removeMediaScreenHud, enableFitScreen, disableFitScreen, initToolbarUI, themeManager, convertToEuler, disableSweeps, enableSweep, disableSweep, tubeLineType, _sceneObject, _tubes, drawPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, toggleMeshChildrenVisibility, toggleFloorVisibility, getChildrenOfModel, toggleVerticeRingVisibility, setPolygonFloorOffset, getPolygonFloorOffset, setFloorBaseHeight, clearFloorBaseHeight, enableVerticeControls, deleteEdge, disposePathLine, getFloorBaseHeight, setMeshChildrenMaterialProperty, undoDrawAction, redoDrawAction, addUndoDrawActions, setWallBaseHeight, getWallBaseHeight, clearWallBaseHeight, setSpacePartitionNodes, setCurrentPolygon, getSpaceId, getCurrentPolygon, getPathBetweenSweeps, moveAlongPath, _atwinConnections };
695
+ export { _atwin, _config, _mpConfig, tags, sweeps, selectedObject, previousObjTransform, currentObjTransform, actionHistory, state, _tags, _tagCategories, _tagMessageRecepients, _space, _spaceId, _api, _pointerCoord, _3DXObjects, _meetingParticipants, _generatedObjectIds, tagColors, domMousePosition, isFitScreenOccupied, isCdnMapDataAvailable, minimap, _modelDetails, _onMouseClickInstance, transformHistory, _partitionNodes, initAtwinApi, getAtwinSdk, connectSpace, disconnectSpace, clearActionHistory, getSweeps, getCurrentSweep, getCurrentSweepPosition, moveToSweep, getNearbySweeps, getAllSweeps, getCurrentCameraPose, getCurrentCameraZoom, getCameraPosition, getCurrentFloor, moveInDirection, cameraLookAt, cameraPan, cameraRotate, cameraSetRotation, getViewMode, setViewMode, captureSpaceScreenshot, captureScreenshotAndCameraDetails, getNearbyObjects, setTransformMode, setSelectedObject, clearSelectedObject, revertTransform, setTransformControls, removeTransformControls, setRenderDistance, addObject, getObject, addObjectToSpace, addMediaScreen, attachMediaScreenContent, updateObject, updateShowcaseObject, deleteObject, deleteShowcaseObject, copyObject, replaceObject, getTargetPosition, setObjectTransformation, setPointerCoordinates, addTextMarkupScreen, setTextMarkupScreenContent, goTo3dx, goToModel, hasTimeElapsed, getSelectedObject, renderAvatar, setSpaceAvatar, get3DXObjects, setLibrary, getLibrary, disposeModel, renderInSpaceMediaScreen, goToPosition, goToParticipant, getNearestSweepFromObject, cancelModelPlacement, renderViewpointMarker, toggleViewpointVisibility, convertDegRotationToEuler, isToolbarFeatureEnabled, pauseVideo, playVideo, setVideoPlayback, setAnimationState, showMinimap, hideMinimap, getMapConfig, addTag, getTags, gotoTag, renderTag, disposeTag, disposeTags, getMpTags, getMpTag, showTags, attachTagMedia, detachTagMedia, moveTag, editTagLabel, editTagDescription, editTagStem, editTagIcon, editTagColor, saveTag, rotateCameraToObject, setModelVisibility, tagStateSubscriber, setTagIcon, setTagCategories, setUserAssignedCategories, getUserAssignedCategories, setTagMessageRecepients, getTagMessageRecepients, setTagMessages, getTagMessages, setSelectedTagUuid, getSelectedTagUuid, setCurrentSpace, toggleFitToScreen, getFloors, getLabels, renderMeetingSidebar, createMeetingTemplate, joinMeetingTemplate, meet, dispatchSpaceEvent, subscribeSpaceEvent, unsubscribeSpaceEvent, registerCustomSpaceEvent, initSocketIo, socketEmit, getParticipants, followParticipant, unFollowParticipant, enableHUD, disableHUD, getMediaScreenHUDs, canSetHud, saveMediaScreenHud, removeMediaScreenHud, enableFitScreen, disableFitScreen, initToolbarUI, themeManager, convertToEuler, disableSweeps, enableSweep, disableSweep, tubeLineType, _sceneObject, _tubes, drawPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, toggleMeshChildrenVisibility, toggleFloorVisibility, getChildrenOfModel, toggleVerticeRingVisibility, setPolygonFloorOffset, getPolygonFloorOffset, setFloorBaseHeight, clearFloorBaseHeight, enableVerticeControls, deleteEdge, disposePathLine, getFloorBaseHeight, setMeshChildrenMaterialProperty, undoDrawAction, redoDrawAction, addUndoDrawActions, setWallBaseHeight, getWallBaseHeight, clearWallBaseHeight, setSpacePartitionNodes, setCurrentPolygon, getSpaceId, getCurrentPolygon, getPathBetweenSweeps, moveAlongPath, _atwinConnections };
package/lib/architwin.js CHANGED
@@ -13,7 +13,7 @@ import { planeType, planeFactory,
13
13
  planeImageFactory, planeVideoFactory, planePdfFactory, setHudState, gltfType, gltfFactory, boxType, boxFactory, textType, textFactory, css3DType, css3DFactory, planeTypeImage, planeTypeVideo, planeTypePdf, sweepPuckType, puckBackgroundFactory, viewpointType, viewpointFactory, tubeLineType, tubeLineFactory, verticeType, verticeFactory, bufferGeometryType, bufferGeometry, fbxType, fbxFactory } from "./loaders";
14
14
  import { meterToMillimeter, generateUUID, formatMatterportUrl, initBundleVersion, isEqual, useHexToRgb } from "./utils";
15
15
  import { initToolbarUI, themeManager, toggleActionBarButtons, setActiveActionBtn } from "./atwinui";
16
- import { SPACE_EVENTS, } from "./types";
16
+ import { SPACE_EVENTS, COORDINATE_SYSTEM, } from "./types";
17
17
  import * as JSZip from "jszip";
18
18
  import * as JSZipUtils from "jszip-utils";
19
19
  import * as superviz from './superviz';
@@ -38,6 +38,8 @@ import { getCurrentPolygonData, getDrawingMode, setCurrentPartitionData } from "
38
38
  import { Notyf } from 'notyf';
39
39
  import 'notyf/notyf.min.css';
40
40
  import i18n from "./atwinui/components/toolbar/i18n";
41
+ import { setBasepoint, setBasepointObjectPayload, setCoordinateSystem, setMeasurementUnit, setRotationUnit, setScaleFactor, setTempCoordinateSystem, setTempMeasurementUnit, setTempRotationUnit, setTempScaleFactor, getCoordinateSystem } from "./atwinui/components/toolbar/actionSettingsPane";
42
+ import { convertZupToYup } from "./worldConversion";
41
43
  const uid = new ShortUniqueId({
42
44
  dictionary: 'number'
43
45
  });
@@ -195,6 +197,7 @@ let _atwinConnections = {};
195
197
  let _onMouseClickInstance;
196
198
  let _modelDetails;
197
199
  let _currentRoom;
200
+ let _currentCoordinateSystem = '';
198
201
  const supportedMediaTypes = ["WMV", "MOV", "MP4", "JPG", "PNG", "JPEG", "image", "video", "FRAME", "PDF", "PDF"];
199
202
  const supportedModelTypes = ["GLB", "GLTF", "FBX"];
200
203
  const supportedFileTypes = ["ZIP", "PDF", ...supportedMediaTypes, ...supportedModelTypes];
@@ -231,6 +234,7 @@ let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500, ty
231
234
  icon: '<span class="mdi mdi-information-outline"></span>'
232
235
  }
233
236
  ] });
237
+ let _currentSpace;
234
238
  // end here
235
239
  // =========================================== INITIALIZATION ===========================================
236
240
  /**
@@ -398,9 +402,24 @@ function getAtwinSdk() {
398
402
  return _atwin;
399
403
  }
400
404
  /**
401
- * Set the custom sweep pucks
405
+ * Check if a specific toolbar feature is enabled or not
402
406
  */
403
- function setCustomSweepPucks() {
407
+ function isToolbarFeatureEnabled(key) {
408
+ log.info("isToolbarFeatureEnabled()");
409
+ if (!key) {
410
+ log.error("key is undefined");
411
+ return;
412
+ }
413
+ if (!_mpConfig.toolbarConfig) {
414
+ return false;
415
+ }
416
+ if (!_mpConfig.toolbarConfig.menuItems) {
417
+ return false;
418
+ }
419
+ if (_mpConfig.toolbarConfig.menuItems[key] == undefined) {
420
+ return false;
421
+ }
422
+ return _mpConfig.toolbarConfig.menuItems[key];
404
423
  }
405
424
  /*
406
425
  Note: no need iframe reload.
@@ -423,6 +442,7 @@ function loadDefaultMpSpace(url, config, showcase, callbacks = undefined) {
423
442
  _atwinConnections[showcase.id] = _atwin;
424
443
  log.info("Hello Bundle SDK", _atwin);
425
444
  _atwin.App.state.subscribe((appState) => __awaiter(this, void 0, void 0, function* () {
445
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
426
446
  log.info("appState", appState);
427
447
  if (appState.phase === _atwin.App.Phase.LOADING) {
428
448
  log.info("App is loading...");
@@ -737,6 +757,44 @@ function loadDefaultMpSpace(url, config, showcase, callbacks = undefined) {
737
757
  initToolbarUI({ objects: spaceObjects });
738
758
  themeManager(_mpConfig.toolbarConfig.themeConfig);
739
759
  }
760
+ if (_currentSpace.json_data) {
761
+ const spaceJsonData = JSON.parse(_currentSpace.json_data);
762
+ if ((_a = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _a === void 0 ? void 0 : _a.bim) {
763
+ // setCoordinateSystem()
764
+ console.log("spaceJsonData?.coordSystemCalibration?.bim", (_b = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _b === void 0 ? void 0 : _b.bim);
765
+ setCoordinateSystem((_c = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _c === void 0 ? void 0 : _c.bim.coord_system);
766
+ setScaleFactor((_d = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _d === void 0 ? void 0 : _d.bim.scale_factor);
767
+ setRotationUnit((_e = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _e === void 0 ? void 0 : _e.bim.rotation_unit);
768
+ setMeasurementUnit((_f = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _f === void 0 ? void 0 : _f.bim.measurement_unit);
769
+ setTempCoordinateSystem((_g = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _g === void 0 ? void 0 : _g.bim.coord_system);
770
+ setTempScaleFactor((_h = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _h === void 0 ? void 0 : _h.bim.scale_factor);
771
+ setTempRotationUnit((_j = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _j === void 0 ? void 0 : _j.bim.rotation_unit);
772
+ setTempMeasurementUnit((_k = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _k === void 0 ? void 0 : _k.bim.measurement_unit);
773
+ }
774
+ if ((_l = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _l === void 0 ? void 0 : _l.bim.project_basepoint) {
775
+ console.log("THERE IS A BASEPOINT");
776
+ const truncateToThreeDecimals = (num) => Math.floor(num * 1000) / 1000;
777
+ const truncatedCoordinate = {
778
+ x: truncateToThreeDecimals(spaceJsonData.coordSystemCalibration.bim.project_basepoint.object_position.x),
779
+ y: truncateToThreeDecimals(spaceJsonData.coordSystemCalibration.bim.project_basepoint.object_position.y),
780
+ z: truncateToThreeDecimals(spaceJsonData.coordSystemCalibration.bim.project_basepoint.object_position.z),
781
+ };
782
+ console.log("BASEPOINT COORDINATE_SYSTEM", (_m = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _m === void 0 ? void 0 : _m.bim.project_basepoint.coordinate_system);
783
+ if (((_o = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _o === void 0 ? void 0 : _o.bim.project_basepoint.coordinate_system) === COORDINATE_SYSTEM.MATTERPORT) {
784
+ setBasepoint(truncatedCoordinate);
785
+ }
786
+ else if (((_p = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _p === void 0 ? void 0 : _p.bim.project_basepoint.coordinate_system) === COORDINATE_SYSTEM.BIM) {
787
+ const basepointCoord = convertZupToYup(truncatedCoordinate);
788
+ setBasepoint(basepointCoord);
789
+ }
790
+ const index = _3DXObjects.findIndex(obj => obj.object.object_data.amazon_uri == "https://cdn.jsdelivr.net/npm/architwin@latest/static/images/basepointmarker.png");
791
+ console.log("_3DXObjects", _3DXObjects[index], index);
792
+ if (index != -1) {
793
+ _3DXObjects[index].type = "BASEPOINT";
794
+ }
795
+ setBasepointObjectPayload((_q = spaceJsonData === null || spaceJsonData === void 0 ? void 0 : spaceJsonData.coordSystemCalibration) === null || _q === void 0 ? void 0 : _q.bim.project_basepoint);
796
+ }
797
+ }
740
798
  }
741
799
  }));
742
800
  return _atwin;
@@ -3502,6 +3560,14 @@ function addObjectToSpace(mediaUrl, objectType, config = undefined, object_data)
3502
3560
  objId = config.id;
3503
3561
  }
3504
3562
  showcase_object = createIShowcaseObjectData(object, config.position, config.scale, config.rotation, objId);
3563
+ if (config) {
3564
+ if (config.json_data) {
3565
+ const jsonData = JSON.parse(config.json_data);
3566
+ showcase_object.json_data = config.json_data;
3567
+ if (jsonData.coordinate_system)
3568
+ showcase_object.coordinate_system = jsonData.coordinate_system;
3569
+ }
3570
+ }
3505
3571
  log.info("About to render object", showcase_object);
3506
3572
  // if (object.object_type == 'MP4') {
3507
3573
  // await showVideoObjects(showcase_object)
@@ -3844,7 +3910,7 @@ function createIShowcaseObjectData(object_data, position = undefined, scale = un
3844
3910
  showcase_object.position_unit = "m";
3845
3911
  showcase_object.object_data = object_data;
3846
3912
  showcase_object.showcase_object_name = object_data.name;
3847
- showcase_object.coordinate_system = 'yup';
3913
+ showcase_object.coordinate_system = getCoordinateSystem() == 'matterport' ? COORDINATE_SYSTEM.MATTERPORT : COORDINATE_SYSTEM.BIM;
3848
3914
  if (showcase_object.object_data) {
3849
3915
  showcase_object.object_data = newObj;
3850
3916
  }
@@ -6703,6 +6769,13 @@ function getSelectedTagUuid() {
6703
6769
  return _selectedTagUuid;
6704
6770
  }
6705
6771
  }
6772
+ function setCurrentSpace(space) {
6773
+ _currentSpace = space;
6774
+ console.log("_currentSpace", _currentSpace);
6775
+ }
6776
+ function getCurrentSpace() {
6777
+ return _currentSpace;
6778
+ }
6706
6779
  //===================== END TAGS =========================//
6707
6780
  //===================== START ZOOM MEETING =========================//
6708
6781
  function renderMeetingSidebar(template, templateName) {
@@ -7254,8 +7327,6 @@ class EmitSpy {
7254
7327
  };
7255
7328
  if (_mpConfig.toolbarConfig && _mpConfig.toolbarConfig.menuItems && _mpConfig.toolbarConfig.menuItems.models !== undefined) {
7256
7329
  if (_mpConfig.toolbarConfig.menuItems.models) {
7257
- //Emit event to application
7258
- this.callback('CLICK', { objectData: this.object_data, component: this.component });
7259
7330
  //clearActionHistory()
7260
7331
  setSelectedObject(this.object_data, this.node, this.component, '3DX');
7261
7332
  if (_viewMode === "interactive" /* VIEW_MODE.INTERACTIVE */ && !excludedColliders.includes(data.collider.name)) {
@@ -7264,11 +7335,11 @@ class EmitSpy {
7264
7335
  else {
7265
7336
  removeTransformControls();
7266
7337
  }
7338
+ //Emit event to application
7339
+ this.callback('CLICK', { objectData: this.object_data, component: this.component });
7267
7340
  }
7268
7341
  }
7269
7342
  else {
7270
- //Emit event to application
7271
- this.callback('CLICK', { objectData: this.object_data, component: this.component });
7272
7343
  //clearActionHistory()
7273
7344
  setSelectedObject(this.object_data, this.node, this.component, '3DX');
7274
7345
  if (_viewMode === "interactive" /* VIEW_MODE.INTERACTIVE */ && !excludedColliders.includes(data.collider.name)) {
@@ -7277,6 +7348,8 @@ class EmitSpy {
7277
7348
  else {
7278
7349
  removeTransformControls();
7279
7350
  }
7351
+ //Emit event to application
7352
+ this.callback('CLICK', { objectData: this.object_data, component: this.component });
7280
7353
  }
7281
7354
  }
7282
7355
  else if (data.input.type === 'drag_end') {
@@ -7339,13 +7412,13 @@ getNearbyObjects, setTransformMode, setSelectedObject, clearSelectedObject, reve
7339
7412
  // setBasePointPosition,
7340
7413
  // showObjectDimensions,
7341
7414
  // hideObjectDimensions,
7342
- copyObject, replaceObject, getTargetPosition, setObjectTransformation, setPointerCoordinates, addTextMarkupScreen, setTextMarkupScreenContent, goTo3dx, goToModel, hasTimeElapsed, getSelectedObject, renderAvatar, setSpaceAvatar, get3DXObjects, setLibrary, getLibrary, disposeModel, renderInSpaceMediaScreen, goToPosition, goToParticipant, getNearestSweepFromObject, cancelModelPlacement, renderViewpointMarker, toggleViewpointVisibility, convertDegRotationToEuler,
7415
+ copyObject, replaceObject, getTargetPosition, setObjectTransformation, setPointerCoordinates, addTextMarkupScreen, setTextMarkupScreenContent, goTo3dx, goToModel, hasTimeElapsed, getSelectedObject, renderAvatar, setSpaceAvatar, get3DXObjects, setLibrary, getLibrary, disposeModel, renderInSpaceMediaScreen, goToPosition, goToParticipant, getNearestSweepFromObject, cancelModelPlacement, renderViewpointMarker, toggleViewpointVisibility, convertDegRotationToEuler, isToolbarFeatureEnabled,
7343
7416
  // video
7344
7417
  pauseVideo, playVideo, setVideoPlayback, setAnimationState,
7345
7418
  // minimap
7346
7419
  showMinimap, hideMinimap, getMapConfig,
7347
7420
  // tags
7348
- addTag, getTags, gotoTag, renderTag, disposeTag, disposeTags, getMpTags, getMpTag, showTags, attachTagMedia, detachTagMedia, moveTag, editTagLabel, editTagDescription, editTagStem, editTagIcon, editTagColor, saveTag, rotateCameraToObject, setModelVisibility, tagStateSubscriber, setTagIcon, setTagCategories, setUserAssignedCategories, getUserAssignedCategories, setTagMessageRecepients, getTagMessageRecepients, setTagMessages, getTagMessages, setSelectedTagUuid, getSelectedTagUuid, toggleFitToScreen,
7421
+ addTag, getTags, gotoTag, renderTag, disposeTag, disposeTags, getMpTags, getMpTag, showTags, attachTagMedia, detachTagMedia, moveTag, editTagLabel, editTagDescription, editTagStem, editTagIcon, editTagColor, saveTag, rotateCameraToObject, setModelVisibility, tagStateSubscriber, setTagIcon, setTagCategories, setUserAssignedCategories, getUserAssignedCategories, setTagMessageRecepients, getTagMessageRecepients, setTagMessages, getTagMessages, setSelectedTagUuid, getSelectedTagUuid, setCurrentSpace, toggleFitToScreen,
7349
7422
  // floors
7350
7423
  getFloors, getLabels,
7351
7424
  // zoom meeting
@@ -1,10 +1,13 @@
1
- import { Vector3 } from "three";
1
+ import { IShowcaseObject } from "../../../types";
2
+ import { Vector3 } from "../../../../bundle/sdk";
3
+ export declare let isAdjust: boolean;
2
4
  export declare function renderActionSettingsPane(): HTMLDivElement;
3
5
  export declare function toggleActionSettings(visible?: boolean): void;
4
6
  export declare function toggleActionSettingsDropdown(id: string): void;
5
7
  export declare function actionSettingsSelectOption(element: HTMLElement, id: string): void;
6
8
  export declare function initSettingsValues(): void;
7
9
  export declare function toggleCalibrateBasepoint(): Promise<void>;
10
+ export declare function displayConvertedCoordinates(payload: any): void;
8
11
  export declare function getCoordinateSystem(): string;
9
12
  export declare function setCoordinateSystem(value: string): void;
10
13
  export declare function getScaleFactor(): string;
@@ -25,3 +28,5 @@ export declare function setBasepoint(value: Vector3): void;
25
28
  export declare function getBasepoint(): Vector3;
26
29
  export declare function setTempBasepoint(value: Vector3): void;
27
30
  export declare function getTempBasepoint(): Vector3;
31
+ export declare function getBasepointObjectPayload(): IShowcaseObject;
32
+ export declare function setBasepointObjectPayload(payload: IShowcaseObject): void;
@@ -7,24 +7,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { _3DXObjects, addObjectToSpace, cancelModelPlacement, clearSelectedObject, disposeModel, getTargetPosition, removeTransformControls, setSelectedObject, setTransformControls } from "../../../architwin";
10
+ import { _3DXObjects, addObjectToSpace, cancelModelPlacement, clearSelectedObject, disposeModel, getTargetPosition, removeTransformControls, setSelectedObject } from "../../../architwin";
11
11
  import { batchAddEventListenerByClassName } from "../../events";
12
12
  import i18n from "./i18n";
13
13
  import { toggleModelControl } from "./modelControlsPane";
14
14
  import { convertYupToZup } from "../../../worldConversion";
15
15
  import { getAssetUrl } from "../../../utils";
16
+ import { COORDINATE_SYSTEM } from "../../../types";
17
+ import { generateUUID } from "three/src/math/MathUtils";
16
18
  let actionSettingsPane;
17
- let coordinateSystem = "matterport";
19
+ let coordinateSystem = COORDINATE_SYSTEM.MATTERPORT;
18
20
  let scaleFactor = "1";
19
21
  let measurementUnit = "meter";
20
22
  let rotationUnit = "radian";
21
- let tempCoordinateSystem = "matterport";
23
+ let tempCoordinateSystem = COORDINATE_SYSTEM.MATTERPORT;
22
24
  let tempScaleFactor = "1";
23
25
  let tempMeasurementUnit = "meter";
24
26
  let tempRotationUnit = "radian";
25
27
  let tempBasepoint = undefined;
26
28
  let basepoint = undefined;
27
- let isSettingsSaved = false;
29
+ let basepointObjectPayload = undefined;
30
+ export let isAdjust = false;
28
31
  export function renderActionSettingsPane() {
29
32
  const element = document.createElement('div');
30
33
  element.classList.add('at_container');
@@ -135,7 +138,17 @@ export function actionSettingsSelectOption(element, id) {
135
138
  }
136
139
  export function initSettingsValues() {
137
140
  // set coordinate saystem
138
- const coordinateSystemvalue = coordinateSystem;
141
+ let coordinateSystemvalue;
142
+ console.log("coordinateSystemvalue", coordinateSystemvalue);
143
+ if (coordinateSystem == COORDINATE_SYSTEM.MATTERPORT) {
144
+ coordinateSystemvalue = "matterport";
145
+ }
146
+ else if (coordinateSystem == COORDINATE_SYSTEM.BIM) {
147
+ coordinateSystemvalue = "bim";
148
+ }
149
+ else {
150
+ console.error("Coordinate system not found");
151
+ }
139
152
  const radioButton = document.querySelector(`input[name="coordinate-system"][value="${coordinateSystemvalue}"]`);
140
153
  if (radioButton) {
141
154
  radioButton.checked = true;
@@ -154,20 +167,26 @@ export function initSettingsValues() {
154
167
  const rotationUnitElement = document.getElementById(`at-selected-rotation-unit-text`);
155
168
  const rotationUnitValue = rotationUnit.charAt(0).toUpperCase() + rotationUnit.substring(1).toLowerCase();
156
169
  rotationUnitElement.innerText = i18n.t(rotationUnitValue);
170
+ const element = document.getElementById(`at-calibrate-basepoint-btn`);
157
171
  if (basepoint) {
158
- const element = document.getElementById(`at-calibrate-basepoint-btn`);
159
172
  element.dataset.state = basepoint ? "adjust" : "calibrate";
160
173
  element.innerText = basepoint ? i18n.t("AdjustBasepoint") : i18n.t("CalibrateBasepoint");
161
174
  displayConvertedCoordinates(basepoint);
175
+ setTempBasepoint(basepoint);
176
+ // const index = _3DXObjects.findIndex(obj => obj.type = "BASEPOINT")
177
+ // const basepointPayload = _3DXObjects[index]
178
+ // setBasepointObjectPayload(basepointPayload.object)
162
179
  }
163
180
  else {
181
+ setBasepointObjectPayload(undefined);
164
182
  const convertedCoordinatesContainer = document.getElementById('at-converted-coordiantes-container');
165
183
  convertedCoordinatesContainer.style.display = 'none';
166
- const element = document.getElementById(`at-calibrate-basepoint-btn`);
167
- element.classList.remove('active');
168
184
  element.dataset.state = basepoint ? "adjust" : "calibrate";
169
185
  element.innerText = basepoint ? i18n.t("AdjustBasepoint") : i18n.t("CalibrateBasepoint");
170
186
  }
187
+ element.classList.remove("active");
188
+ clearSelectedObject();
189
+ removeTransformControls();
171
190
  }
172
191
  export function toggleCalibrateBasepoint() {
173
192
  return __awaiter(this, void 0, void 0, function* () {
@@ -176,6 +195,7 @@ export function toggleCalibrateBasepoint() {
176
195
  console.log("toggleCalibrateBasepoint()", element.innerText);
177
196
  console.log(element.innerText === i18n.t("CalibrateBasepoint"));
178
197
  console.log(typeof element.innerText, typeof i18n.t("CalibrateBasepoint"));
198
+ console.log("currentState", currentState);
179
199
  switch (currentState) {
180
200
  case "cancel":
181
201
  element.dataset.state = tempBasepoint || basepoint ? "adjust" : "calibrate";
@@ -197,16 +217,35 @@ export function toggleCalibrateBasepoint() {
197
217
  element.innerText = i18n.t("Cancel");
198
218
  yield getTargetPosition((coords) => __awaiter(this, void 0, void 0, function* () {
199
219
  console.log("coord", coords);
200
- coords.y = coords.y + 0.01;
201
- setTempBasepoint(coords);
220
+ const newCoords = Object.assign({}, coords);
221
+ newCoords.y = newCoords.y + 0.05;
222
+ setTempBasepoint(newCoords);
202
223
  const mediaUrl = getAssetUrl('images/basepointmarker.png');
203
224
  const objectType = '';
204
- yield addObjectToSpace(mediaUrl, objectType, {
205
- position: coords,
225
+ const objectPaylaod = {
226
+ mediaUrl: mediaUrl,
227
+ objectType: objectType,
228
+ };
229
+ basepointObjectPayload = yield addObjectToSpace(objectPaylaod.mediaUrl, objectPaylaod.objectType, {
230
+ position: newCoords,
206
231
  rotation: { x: 1.57079633, y: 0, z: 0 }
207
232
  });
233
+ basepointObjectPayload.object_data.uuid = generateUUID();
234
+ basepointObjectPayload.object_data.id = Number(basepointObjectPayload.object_data.uuid);
235
+ basepointObjectPayload.coordinate_system = COORDINATE_SYSTEM.MATTERPORT;
208
236
  _3DXObjects[_3DXObjects.length - 1].type = 'BASEPOINT';
209
- displayConvertedCoordinates(coords);
237
+ _3DXObjects[_3DXObjects.length - 1].object.coordinate_system = getCoordinateSystem() == 'matterport' ? 'yup' : 'zup';
238
+ // make it display 4 decimals only
239
+ const truncateToThreeDecimals = (num) => Math.floor(num * 1000) / 1000;
240
+ const truncatedCoordinate = {
241
+ x: truncateToThreeDecimals(newCoords.x),
242
+ y: truncateToThreeDecimals(newCoords.y),
243
+ z: truncateToThreeDecimals(newCoords.z),
244
+ };
245
+ displayConvertedCoordinates(truncatedCoordinate);
246
+ console.log("_3DXObject", _3DXObjects);
247
+ console.log("coords", coords);
248
+ console.log("newCoords", newCoords);
210
249
  element.dataset.state = "adjust";
211
250
  element.innerText = i18n.t("AdjustBasepoint");
212
251
  element.classList.remove("active");
@@ -217,13 +256,17 @@ export function toggleCalibrateBasepoint() {
217
256
  element.innerText = i18n.t("Cancel");
218
257
  const object = _3DXObjects.find(obj => obj.type == "BASEPOINT");
219
258
  console.log("object", object);
259
+ // setup coordinate system
260
+ object.object.coordinate_system = getCoordinateSystem() == 'matterport' ? 'yup' : 'zup';
261
+ // sets currentState that is needed for modenlControlsPane
262
+ isAdjust = currentState == "adjust" ? true : false;
220
263
  setSelectedObject(object.object, object.node, object.component, object.type);
221
264
  const selectedObj = {
222
265
  object: object.object,
223
266
  node: object.node,
224
267
  component: object.component
225
268
  };
226
- setTransformControls(selectedObj);
269
+ // setTransformControls(selectedObj)
227
270
  toggleModelControl(true, 'translate');
228
271
  break;
229
272
  default:
@@ -232,7 +275,8 @@ export function toggleCalibrateBasepoint() {
232
275
  element.classList.toggle("active");
233
276
  });
234
277
  }
235
- function displayConvertedCoordinates(payload) {
278
+ export function displayConvertedCoordinates(payload) {
279
+ console.log("displayConvertedCoordinates()", payload);
236
280
  const convertedCoordinatesContainer = document.getElementById('at-converted-coordiantes-container');
237
281
  convertedCoordinatesContainer.style.display = 'flex';
238
282
  convertedCoordinatesContainer.innerHTML = ``;
@@ -248,9 +292,9 @@ function displayConvertedCoordinates(payload) {
248
292
  const element = document.getElementById(`at-xyz-coordinate-${idName}`);
249
293
  const isHidden = element.style.display === 'block' || element.style.display === '';
250
294
  element.style.display = isHidden ? 'none' : 'block';
251
- // const chevronIcon = document.getElementById(`at-expand-btn-${faceId}`).querySelector(isHidden ? '.mdi-chevron-down' : '.mdi-chevron-up');
252
- // chevronIcon.classList.toggle('mdi-chevron-down');
253
- // chevronIcon.classList.toggle('mdi-chevron-up');
295
+ const chevronIcon = document.getElementById(`at-coordinate-title-${idName}`).querySelector(isHidden ? '.mdi-chevron-up' : '.mdi-chevron-down');
296
+ chevronIcon.classList.toggle('mdi-chevron-up');
297
+ chevronIcon.classList.toggle('mdi-chevron-down');
254
298
  });
255
299
  // displayCoordinateList()
256
300
  }
@@ -323,9 +367,9 @@ function displayCoordinatesItemTitle(title) {
323
367
  element.classList.add('at_coordinate_title_container');
324
368
  const idName = title.toLowerCase();
325
369
  element.innerHTML = `
326
- <div class="at_coordinate_title" id="at-coordinate-title-${idName}" data-cy="">
370
+ <div class="at_coordinate_title" id="at-coordinate-title-${idName}" data-cy="at-coordinate-title-${idName}">
327
371
  ${i18n.t(title)}
328
- <span class="mdi mdi-chevron-down" id="" data-cy=""></span>
372
+ <span class="mdi mdi-chevron-up" id="at-coordinate-title-icon-${idName}" data-cy="at-coordinate-title-icon-${idName}"></span>
329
373
  </div>
330
374
  `;
331
375
  return element;
@@ -422,3 +466,9 @@ export function setTempBasepoint(value) {
422
466
  export function getTempBasepoint() {
423
467
  return tempBasepoint;
424
468
  }
469
+ export function getBasepointObjectPayload() {
470
+ return basepointObjectPayload;
471
+ }
472
+ export function setBasepointObjectPayload(payload) {
473
+ basepointObjectPayload = payload;
474
+ }
@@ -146,7 +146,11 @@ i18n
146
146
  "UndoPlaceVertex": "Undo Place Vertex",
147
147
  "RedoPlaceVertex": "Redo Place Vertex",
148
148
  "HideShowAll": " Hide/Show All Rooms",
149
- "Navigate": "Navigate"
149
+ "Navigate": "Navigate",
150
+ "ScaleFactor": "Scale Factor",
151
+ "SuccessSettingsSaved": "Successfully saved settings",
152
+ "ConvertedCoordinates": "Converted Coordinates",
153
+ "Origin": "Origin",
150
154
  }
151
155
  },
152
156
  ja: {
@@ -285,7 +289,13 @@ i18n
285
289
  "UndoPlaceVertex": "頂点の配置を元に戻す",
286
290
  "RedoPlaceVertex": "頂点の配置をやり直す",
287
291
  "HideShowAll": "すべての部屋を非表示/表示",
288
- "Navigate": "ナビゲート"
292
+ "Navigate": "ナビゲート",
293
+ "CalibrateBasepoint": "基準ポイント設定",
294
+ "AdjustBasepoint": "基準ポイント調整",
295
+ "ScaleFactor": "スケール比",
296
+ "SuccessSettingsSaved": "設定を保存しました",
297
+ "ConvertedCoordinates": "位置変換",
298
+ "Origin": "起点",
289
299
  }
290
300
  }
291
301
  },
@@ -51,7 +51,7 @@ export function renderMenuBar(iFrame) {
51
51
  <div class="at_icon_tooltip" data-cy="at-tooltip-theme">${i18n.t('RoomCreation')}</div>
52
52
  </div>
53
53
  <div class="at_sidebar_button_icon" style="display:${isBIMEnabled ? 'block' : 'none'}">
54
- <img class="at_bim_settings_img" src="${bimImageIcon}" alt="bim" id="at-settings-btn" data-cy="at-settings-btn" target-pane="at-settings-pane"/>
54
+ <img class="mdi at_bim_settings_img" src="${bimImageIcon}" alt="bim" id="at-settings-btn" data-cy="at-settings-btn" target-pane="at-settings-pane"/>
55
55
  <div class="at_icon_tooltip" data-cy="at-tooltip-settings">${i18n.t('Settings')}</div>
56
56
  </div>
57
57
  `;
@@ -145,9 +145,6 @@ export function clearActiveMenu(id) {
145
145
  if (id != 'at-minimap-btn' && activeMenu) {
146
146
  // get child id
147
147
  let activeChildId = (_b = (_a = activeMenu.querySelector('.mdi')) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : undefined;
148
- if (id == 'at-settings-btn') {
149
- activeChildId = "at-settings-btn";
150
- }
151
148
  log.info("activeChildId: ", activeChildId);
152
149
  // check if active menu and target menu id are the same
153
150
  // if true do not set inactive otherwise, remove
@@ -1,4 +1,4 @@
1
- import type { IShowcaseObject, Object3DPosition } from "../../../types";
1
+ import { IShowcaseObject, Object3DPosition } from "../../../types";
2
2
  export declare let activeModelControlPane: boolean;
3
3
  export declare let modelControlPane: HTMLDivElement;
4
4
  export declare function renderModelControlPane(type?: string): HTMLDivElement;
@@ -8,3 +8,7 @@ export declare function getCoordinateValues(): Object3DPosition;
8
8
  export declare function clearCoordinateInputs(): void;
9
9
  export declare function showCurrentCoordinateValue(payload?: IShowcaseObject): void;
10
10
  export declare function handleModelControlInputs(): void;
11
+ export declare function updateDisplayedCoordinates(): void;
12
+ export declare function getSelectedObjectCoordinateSystem(): any;
13
+ export declare function setSelectedObjectCoordinateSystem(payload: string): void;
14
+ export declare function setCoordinateSystemType(): void;