architwin 1.8.7 → 1.8.9

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.
@@ -111,6 +111,7 @@ declare function getCurrentCameraPose(): MpSdk.Camera.Pose;
111
111
  declare function getCurrentCameraZoom(): MpSdk.Camera.ZoomData;
112
112
  declare function getCameraPosition(): MpSdk.Vector3;
113
113
  declare function getCurrentSweepPosition(): MpSdk.Vector3;
114
+ declare function getCurrentFloor(): MpSdk.Floor.FloorData;
114
115
  declare function getSweeps(): Promise<ISweep | null>;
115
116
  declare function getAllSweeps(): {
116
117
  id: string;
@@ -417,11 +418,13 @@ declare function getCurrentTubeLine(): IObjectData;
417
418
  * Renders a polygon from an array of coordinates
418
419
  * @param {Vector3} path - Array of coordinates
419
420
  * @returns {void}
421
+ * @deprecated - Use renderPolygon
420
422
  */
421
423
  declare function renderPolygonFromPath(path: Array<Vector3>): void;
422
424
  /**
423
425
  * Renders a polygon from an array of coordinates or an object containing an array of coordinates
424
426
  * @param {PartitionPayload|Array<Vector3>} payload
427
+ * @param {boolean} updatePolygon - Update an existing polygon instance. Defaults to false
425
428
  * @returns {void}
426
429
  */
427
430
  declare function renderPolygon(payload: PartitionPayload | Array<Vector3>, updatePolygon?: boolean): IShowcaseObject;
@@ -448,6 +451,32 @@ declare function toggleWallVisibility(component: MpSdk.Scene.IComponent, name: s
448
451
  * @returns
449
452
  */
450
453
  declare function getChildrenOfModel(component: MpSdk.Scene.IComponent): any;
454
+ /**
455
+ * Toggle the visibility of the vertice rings. This requires the rings to be rendered in the space to work
456
+ * @param visibility - Default is false
457
+ */
458
+ declare function toggleVerticeRingVisibility(visibility?: boolean): void;
459
+ /**
460
+ * Sets the global offset value of the y axis of a rendered polygon.
461
+ * @param {number} offset
462
+ * @returns
463
+ */
464
+ declare function setPolygonFloorOffset(offset: number): void;
465
+ /**
466
+ * Returns the value of the global floor offset
467
+ * @returns
468
+ */
469
+ declare function getPolygonFloorOffset(): number;
470
+ /**
471
+ * Set the value of the base height or y-axis of the vertex of a polygon
472
+ * @param baseHeight
473
+ * @returns
474
+ */
475
+ declare function setFloorBaseHeight(baseHeight: number): void;
476
+ /**
477
+ * Clear the value of the base height for floors of polygons
478
+ */
479
+ declare function clearFloorBaseHeight(): void;
451
480
  declare function setTagIcon(payload: {
452
481
  tag: MpSdk.Tag.TagData;
453
482
  iconName: string;
@@ -591,4 +620,4 @@ declare function unFollowParticipant(unFollowParticipant: any): void;
591
620
  * @param roomNodes Array of room nodes
592
621
  */
593
622
  declare function setSpaceRoomNodes(roomNodes: Array<RoomNode>): Promise<void>;
594
- 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, _roomNodes, initAtwinApi, getAtwinSdk, connectSpace, disconnectSpace, clearActionHistory, getSweeps, getCurrentSweep, getCurrentSweepPosition, moveToSweep, getNearbySweeps, getAllSweeps, getCurrentCameraPose, getCurrentCameraZoom, getCameraPosition, 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, drawLine, renderPolygonFromPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, getChildrenOfModel, setSpaceRoomNodes, getSpaceId, getCurrentPolygon };
623
+ 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, _roomNodes, 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, drawLine, renderPolygonFromPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, getChildrenOfModel, toggleVerticeRingVisibility, setPolygonFloorOffset, getPolygonFloorOffset, setFloorBaseHeight, clearFloorBaseHeight, setSpaceRoomNodes, getSpaceId, getCurrentPolygon };
package/lib/architwin.js CHANGED
@@ -202,7 +202,7 @@ let _visualize = true, _editPolygonMode = false, _drawPolygonMode = false, _tube
202
202
  // _thisVertexComponent:MpSdk.Scene.IComponent, // Current Vertex Component
203
203
  // _thisVerticeNode:MpSdk.Scene.INode, // Current VerticeNode
204
204
  // _thisVertexPath = new Array()
205
- let visualize = true, _activeVertex, editMode = false, drawMode = false, _thisVertexNode, _thisVertexComponent, _thisVerticesNode, _thisVertexPath = new Array(), _currentPolygon, _polygonShapePath;
205
+ let visualize = true, _activeVertex, editMode = false, drawMode = false, _thisVertexNode, _thisVertexComponent, _thisVerticesNode, _thisVertexPath = new Array(), _currentPolygon, _polygonShapePath, _verticeComponentsCollection = [], _highestYaxisPoint, _polygonFloorOffset = 0.15, _autoLevelFloorEnabled = true, _floorBaseHeight;
206
206
  let _intersectionData, _tubes, _verticeEmitPath, _verticeEditEmitPath;
207
207
  let _navigationInputNode;
208
208
  let _navigationComponent;
@@ -213,6 +213,8 @@ let _tubeLinePath;
213
213
  // let _iframeSrc = '/bundle/showcase.html?m=&applicationKey=a3ae8341bd8f44899eba16df86307d7d&newtags=1&play=1'
214
214
  // ROOM CREATION
215
215
  let _roomNodes = undefined;
216
+ //Keybindings flags
217
+ let isCtrlPressed = false, lastKeyPressed = null;
216
218
  // end here
217
219
  // =========================================== INITIALIZATION ===========================================
218
220
  /**
@@ -454,6 +456,7 @@ function loadDefaultMpSpace(url, config, showcase, callbacks = undefined) {
454
456
  yield handleParamValuesInSpaceUrl(url);
455
457
  createNavigationControlComponent();
456
458
  createVerticeClickSpy();
459
+ setupKeybindingEventListeners(showcase);
457
460
  let pointerTexturePath = '';
458
461
  if ('bundlePath' in config) {
459
462
  pointerTexturePath = 'https://cdn.jsdelivr.net/npm/architwin@latest/static/objective.png';
@@ -633,6 +636,15 @@ function loadDefaultMpSpace(url, config, showcase, callbacks = undefined) {
633
636
  }
634
637
  _atwin.Mode.current.subscribe((mode) => {
635
638
  _currentViewMode = mode;
639
+ if (mode == 'mode.floorplan') {
640
+ log.info("_verticeComponentsCollection ", _verticeComponentsCollection);
641
+ toggleVerticeRingVisibility(true);
642
+ }
643
+ else {
644
+ if (_verticeComponentsCollection && _verticeComponentsCollection.length > 0) {
645
+ toggleVerticeRingVisibility();
646
+ }
647
+ }
636
648
  });
637
649
  _atwin.Pointer.intersection.subscribe(function (intersection) {
638
650
  // log.info('intersection', intersection)
@@ -1815,6 +1827,9 @@ function getCameraPosition() {
1815
1827
  function getCurrentSweepPosition() {
1816
1828
  return _currentSweep.position;
1817
1829
  }
1830
+ function getCurrentFloor() {
1831
+ return _currentFloor;
1832
+ }
1818
1833
  // gets all Sweeps in loaded Space
1819
1834
  function getSweeps() {
1820
1835
  return __awaiter(this, void 0, void 0, function* () {
@@ -5073,6 +5088,7 @@ function getCurrentTubeLine() {
5073
5088
  * Renders a polygon from an array of coordinates
5074
5089
  * @param {Vector3} path - Array of coordinates
5075
5090
  * @returns {void}
5091
+ * @deprecated - Use renderPolygon
5076
5092
  */
5077
5093
  function renderPolygonFromPath(path) {
5078
5094
  if (!path || path.length <= 0) {
@@ -5129,6 +5145,7 @@ function renderPolygonFromPath(path) {
5129
5145
  /**
5130
5146
  * Renders a polygon from an array of coordinates or an object containing an array of coordinates
5131
5147
  * @param {PartitionPayload|Array<Vector3>} payload
5148
+ * @param {boolean} updatePolygon - Update an existing polygon instance. Defaults to false
5132
5149
  * @returns {void}
5133
5150
  */
5134
5151
  function renderPolygon(payload, updatePolygon = false) {
@@ -5162,6 +5179,7 @@ function renderPolygon(payload, updatePolygon = false) {
5162
5179
  polyNode.start();
5163
5180
  //Add an input path so that we can easily update the polygon component.
5164
5181
  _sceneObject.addInputPath(polyComponent, 'path', `path_${showcaseObj.id}`);
5182
+ _sceneObject.addInputPath(polyComponent, 'visible', `visible_${showcaseObj.id}`);
5165
5183
  const newObj = {
5166
5184
  object: showcaseObj,
5167
5185
  node: polyNode,
@@ -5178,20 +5196,22 @@ function renderPolygon(payload, updatePolygon = false) {
5178
5196
  log.error("Error renderPolygon ", error);
5179
5197
  }
5180
5198
  }
5181
- if (updatePolygon) {
5199
+ else {
5182
5200
  const index = _3DXObjects.findIndex(item => item.object.id == _currentPolygon.object.id);
5183
- _currentPolygon.node = polyNode;
5184
- _currentPolygon.component = polyComponent;
5201
+ // _currentPolygon.node = polyNode
5202
+ // _currentPolygon.component = polyComponent
5185
5203
  _currentPolygon.object.object_data.uuid = generateUUID();
5186
5204
  _currentPolygon.object.object_data.json_data = {
5187
5205
  vertexPath: payload
5188
5206
  };
5189
5207
  _3DXObjects[index] = _currentPolygon;
5190
- if (payload.length > 3) {
5208
+ if (payload.length >= 3) {
5191
5209
  console.log(" _3DXObjects[index] ", _3DXObjects[index]);
5192
5210
  setPolygonPath(_3DXObjects[index].object.id, payload);
5193
5211
  }
5194
5212
  }
5213
+ if (updatePolygon) {
5214
+ }
5195
5215
  }
5196
5216
  else {
5197
5217
  polyNode = _sceneObject.addNode();
@@ -5256,10 +5276,17 @@ function createVerticeClickPath() {
5256
5276
  });
5257
5277
  }
5258
5278
  function addVerticeControls(component, index) {
5279
+ const currentMode = getViewMode();
5280
+ let isFloorPlanMode = false;
5281
+ if (currentMode == _atwin.Mode.Mode.FLOORPLAN) {
5282
+ isFloorPlanMode = true;
5283
+ }
5259
5284
  const verticeComponent = _thisVerticesNode.addComponent('vertice', {
5260
5285
  index,
5261
5286
  position: Object.assign({}, component.inputs.path[index]),
5287
+ ringVisibility: isFloorPlanMode
5262
5288
  });
5289
+ _verticeComponentsCollection.push(verticeComponent);
5263
5290
  const editVertice = _sceneObject.addEmitPath(verticeComponent, "changed");
5264
5291
  _sceneObject.spyOnEvent({
5265
5292
  path: editVertice,
@@ -5288,7 +5315,7 @@ function addVerticeControls(component, index) {
5288
5315
  },
5289
5316
  });
5290
5317
  }
5291
- function createVerticeControls(component) {
5318
+ function createVerticeControls(component, isDeleting = false) {
5292
5319
  if (!component) {
5293
5320
  log.error("component is undefined");
5294
5321
  return;
@@ -5303,6 +5330,19 @@ function createVerticeControls(component) {
5303
5330
  for (let i = 0; i <= sections; i++) {
5304
5331
  addVerticeControls(component, i);
5305
5332
  }
5333
+ if (_currentPolygon) {
5334
+ //@ts-expect-error
5335
+ if (isDeleting && component.inputs.path.length <= 2) {
5336
+ //@ts-expect-error
5337
+ _currentPolygon.component.groupedMesh.visible = false;
5338
+ //@ts-expect-error
5339
+ }
5340
+ else if (isDeleting == false && component.inputs.path.length > 2) {
5341
+ log.info(" _currentPolygon.component ", _currentPolygon.component);
5342
+ //@ts-expect-error
5343
+ _currentPolygon.component.groupedMesh.visible = true;
5344
+ }
5345
+ }
5306
5346
  verticeNode.start();
5307
5347
  }
5308
5348
  function createVerticeClickSpy() {
@@ -5323,40 +5363,100 @@ function createVerticeClickSpy() {
5323
5363
  onEvent(event_data) {
5324
5364
  log.info("ClickSpy");
5325
5365
  // If user is in drawMode and has not yet clicked...
5326
- if (_drawPolygonMode) {
5327
- // If no node is active
5328
- if (_thisVertexNode === undefined) {
5329
- let start = Object.assign({}, _intersectionData.position);
5330
- start.y += 0.3;
5331
- // Generate Tag ID from position
5332
- const r = (x) => Math.round(x * 100) / 100;
5333
- let thisName = "x" + r(start.x) + "y" + r(start.y) + "z" + r(start.z);
5334
- //@ts-expect-error
5335
- [_thisVertexNode, _thisVertexComponent] = addVertex(thisName, [start]);
5336
- _thisVertexPath.push(start);
5337
- if (visualize) {
5338
- // In visualize mode we don't want the tube blocking raycasting
5339
- // as we're redrawing it whenever a user moves their cursor.
5340
- _activeVertex.inputs.collider = false;
5366
+ log.info("isCtrlPressed ", isCtrlPressed);
5367
+ if (isCtrlPressed) {
5368
+ if (_drawPolygonMode) {
5369
+ // If no node is active
5370
+ if (_thisVertexNode === undefined) {
5371
+ let start = Object.assign({}, _intersectionData.position);
5372
+ if (_floorBaseHeight !== undefined) {
5373
+ start.y += (_floorBaseHeight + _polygonFloorOffset);
5374
+ }
5375
+ if (_autoLevelFloorEnabled) {
5376
+ if (!_highestYaxisPoint) {
5377
+ _highestYaxisPoint = _intersectionData.position.y;
5378
+ }
5379
+ if (start.y > _highestYaxisPoint) {
5380
+ _highestYaxisPoint = _intersectionData.position.y;
5381
+ }
5382
+ start.y += (_highestYaxisPoint + _polygonFloorOffset);
5383
+ }
5384
+ // Generate Tag ID from position
5385
+ const r = (x) => Math.round(x * 100) / 100;
5386
+ let thisName = "x" + r(start.x) + "y" + r(start.y) + "z" + r(start.z);
5387
+ //@ts-expect-error
5388
+ [_thisVertexNode, _thisVertexComponent] = addVertex(thisName, [start]);
5389
+ _thisVertexPath.push(start);
5390
+ log.info("_thisVertexPath ", _thisVertexPath);
5391
+ if (visualize) {
5392
+ _activeVertex.inputs.collider = false;
5393
+ }
5394
+ createVerticeControls(_thisVertexComponent);
5341
5395
  }
5342
- // Return the tag id -- we'll use this for the component id too.
5343
- }
5344
- else {
5345
- _thisVertexPath.push(Object.assign({}, _intersectionData.position));
5346
- _thisVertexComponent.inputs.path = [..._thisVertexPath];
5347
- // Show Vertices
5348
- createVerticeControls(_thisVertexComponent);
5396
+ else {
5397
+ let yAxis;
5398
+ if (_floorBaseHeight !== undefined) {
5399
+ yAxis += (_floorBaseHeight + _polygonFloorOffset);
5400
+ }
5401
+ if (_autoLevelFloorEnabled) {
5402
+ if (!_highestYaxisPoint) {
5403
+ _highestYaxisPoint = _intersectionData.position.y;
5404
+ }
5405
+ if (_intersectionData.position.y > _highestYaxisPoint) {
5406
+ _highestYaxisPoint = _intersectionData.position.y;
5407
+ }
5408
+ }
5409
+ _intersectionData.position.y += (_highestYaxisPoint + _polygonFloorOffset);
5410
+ if (yAxis && yAxis > _intersectionData.position.y) {
5411
+ _intersectionData.position.y += (yAxis + _polygonFloorOffset);
5412
+ }
5413
+ _thisVertexPath.push(Object.assign({}, _intersectionData.position));
5414
+ _thisVertexComponent.inputs.path = [..._thisVertexPath];
5415
+ // Show Vertices
5416
+ createVerticeControls(_thisVertexComponent);
5417
+ }
5418
+ dispatchSpaceEvent(SPACE_EVENTS.VERTEX_PLACED, {
5419
+ position: _intersectionData.position,
5420
+ path: _thisVertexPath
5421
+ });
5349
5422
  }
5350
- dispatchSpaceEvent(SPACE_EVENTS.VERTEX_PLACED, {
5351
- position: _intersectionData.position,
5352
- path: _thisVertexPath
5353
- });
5354
5423
  }
5355
5424
  },
5356
5425
  };
5357
5426
  //_sceneObject.spyOnEvent(new VerticeClickSpy(_verticeEmitPath,dispatchSpaceEvent))
5358
5427
  _sceneObject.spyOnEvent(click_spy);
5359
5428
  }
5429
+ /**
5430
+ * Removes a vertex sphere from the space. If no argument is passed it will remove the last vertex that has been added
5431
+ * @param {number} index - (optional) Index of an element of vertex path
5432
+ * @returns
5433
+ */
5434
+ function deleteVertex(index) {
5435
+ log.info("deleteVertex()");
5436
+ if (!_thisVertexComponent) {
5437
+ log.error("An active vertex component is required");
5438
+ return;
5439
+ }
5440
+ if (!_thisVertexPath || _thisVertexPath.length <= 0) {
5441
+ log.error("Vertex path is empty or undefined");
5442
+ return;
5443
+ }
5444
+ if (index !== undefined) {
5445
+ _thisVertexPath = _thisVertexPath.slice(index, 1);
5446
+ _thisVertexComponent.inputs.path = [..._thisVertexPath];
5447
+ // Rerender Vertices
5448
+ createVerticeControls(_thisVertexComponent, true);
5449
+ }
5450
+ else {
5451
+ //const newPath = _thisVertexPath
5452
+ log.info("_thisVertexPath before ", _thisVertexPath);
5453
+ _thisVertexPath.pop();
5454
+ log.info("_thisVertexPath after ", _thisVertexPath);
5455
+ _thisVertexComponent.inputs.path = [..._thisVertexPath];
5456
+ // Rerender Vertices
5457
+ createVerticeControls(_thisVertexComponent, true);
5458
+ }
5459
+ }
5360
5460
  function startDraw() {
5361
5461
  //Disable certain features in space when drawing is active
5362
5462
  _atwin.Measurements.toggleMode(false);
@@ -5371,7 +5471,7 @@ function startDraw() {
5371
5471
  _thisVertexNode = undefined;
5372
5472
  _thisVertexComponent = undefined;
5373
5473
  _thisVertexPath = new Array();
5374
- toggleSpaceNavigation(false);
5474
+ //toggleSpaceNavigation(false)
5375
5475
  }
5376
5476
  function exitDraw() {
5377
5477
  //Enabled MP features when exiting draw mode
@@ -5390,6 +5490,7 @@ function exitDraw() {
5390
5490
  _drawPolygonMode = false;
5391
5491
  _currentPolygon = undefined;
5392
5492
  _polygonShapePath = undefined;
5493
+ _verticeComponentsCollection = [];
5393
5494
  _atwin.Pointer.resetTexture();
5394
5495
  }
5395
5496
  function cancelDraw() {
@@ -5424,6 +5525,7 @@ function addVertex(name, path) {
5424
5525
  path: _activeVertexPath,
5425
5526
  onEvent(eventData) {
5426
5527
  if (editMode) {
5528
+ log.info("_activeVertexPath event triggered");
5427
5529
  //@ts-expect-error
5428
5530
  if (_activeVertex != eventData.component) {
5429
5531
  // Set previously active tube to inactive
@@ -5520,7 +5622,105 @@ function getChildrenOfModel(component) {
5520
5622
  const children = component.mesh.children;
5521
5623
  return children;
5522
5624
  }
5625
+ /**
5626
+ * Toggle the visibility of the vertice rings. This requires the rings to be rendered in the space to work
5627
+ * @param visibility - Default is false
5628
+ */
5629
+ function toggleVerticeRingVisibility(visibility = false) {
5630
+ if (!_verticeComponentsCollection || _verticeComponentsCollection.length <= 0) {
5631
+ log.error("No actively visible vertices to invoke this function");
5632
+ return;
5633
+ }
5634
+ try {
5635
+ _verticeComponentsCollection.forEach((component) => {
5636
+ //@ts-expect-error
5637
+ if (component.mesh.children) {
5638
+ //@ts-expect-error
5639
+ component.mesh.children.forEach(comp => {
5640
+ if (comp.name == 'ring') {
5641
+ comp.visible = visibility;
5642
+ }
5643
+ });
5644
+ }
5645
+ });
5646
+ }
5647
+ catch (error) {
5648
+ log.error("Error toggling ring visibility ", error);
5649
+ }
5650
+ }
5651
+ /**
5652
+ * Sets the global offset value of the y axis of a rendered polygon.
5653
+ * @param {number} offset
5654
+ * @returns
5655
+ */
5656
+ function setPolygonFloorOffset(offset) {
5657
+ log.info("setPolygonFloorOffset()");
5658
+ if (offset == undefined) {
5659
+ log.error("Parameter offset is undefined");
5660
+ return;
5661
+ }
5662
+ if (typeof offset !== 'number') {
5663
+ log.error("Parameter offset is not a number");
5664
+ return;
5665
+ }
5666
+ _polygonFloorOffset = offset;
5667
+ }
5668
+ /**
5669
+ * Returns the value of the global floor offset
5670
+ * @returns
5671
+ */
5672
+ function getPolygonFloorOffset() {
5673
+ log.info("getPolygonFloorOffset()");
5674
+ return _polygonFloorOffset;
5675
+ }
5676
+ /**
5677
+ * Set the value of the base height or y-axis of the vertex of a polygon
5678
+ * @param baseHeight
5679
+ * @returns
5680
+ */
5681
+ function setFloorBaseHeight(baseHeight) {
5682
+ log.info("setFloorBaseHeight()");
5683
+ if (!baseHeight || isNaN(baseHeight)) {
5684
+ log.error("baseHeight is undefined or NaN");
5685
+ return;
5686
+ }
5687
+ _floorBaseHeight;
5688
+ }
5689
+ /**
5690
+ * Clear the value of the base height for floors of polygons
5691
+ */
5692
+ function clearFloorBaseHeight() {
5693
+ _floorBaseHeight = undefined;
5694
+ }
5523
5695
  //===================== END VERTEX DRAWING METHODS =========================//
5696
+ //===================== START KEYBINDINGS =========================//
5697
+ function handleKeyDown(event) {
5698
+ if (event.ctrlKey) {
5699
+ log.info("Ctrl key down");
5700
+ isCtrlPressed = true;
5701
+ toggleSpaceNavigation(false);
5702
+ }
5703
+ if (isCtrlPressed && event.key === 'z' && lastKeyPressed === 'Control') {
5704
+ log.info("Ctrl + Z works");
5705
+ deleteVertex();
5706
+ }
5707
+ lastKeyPressed = event.key;
5708
+ }
5709
+ function handleKeyUp(event) {
5710
+ if (event.key === "Control") {
5711
+ log.info("Ctrl key down");
5712
+ isCtrlPressed = false;
5713
+ toggleSpaceNavigation(true);
5714
+ }
5715
+ }
5716
+ function setupKeybindingEventListeners(iframe) {
5717
+ log.info("setupKeybindingEventListeners()");
5718
+ iframe.contentDocument.body.addEventListener('keydown', handleKeyDown);
5719
+ iframe.contentDocument.body.addEventListener('keyup', handleKeyUp);
5720
+ window.addEventListener('keydown', handleKeyDown);
5721
+ window.addEventListener('keyup', handleKeyUp);
5722
+ }
5723
+ //===================== END KEYBINDING =========================//
5524
5724
  //===================== START TAGS =========================//
5525
5725
  // set tag icon
5526
5726
  function setTagIcon(payload) {
@@ -6507,7 +6707,7 @@ _roomNodes, initAtwinApi, getAtwinSdk, connectSpace, disconnectSpace, clearActio
6507
6707
  //sweeps
6508
6708
  getSweeps, getCurrentSweep, getCurrentSweepPosition, moveToSweep, getNearbySweeps, getAllSweeps,
6509
6709
  // camera
6510
- getCurrentCameraPose, getCurrentCameraZoom, getCameraPosition, moveInDirection, cameraLookAt, cameraPan, cameraRotate, cameraSetRotation, getViewMode, setViewMode, captureSpaceScreenshot, captureScreenshotAndCameraDetails,
6710
+ getCurrentCameraPose, getCurrentCameraZoom, getCameraPosition, getCurrentFloor, moveInDirection, cameraLookAt, cameraPan, cameraRotate, cameraSetRotation, getViewMode, setViewMode, captureSpaceScreenshot, captureScreenshotAndCameraDetails,
6511
6711
  // objects
6512
6712
  getNearbyObjects, setTransformMode, setSelectedObject, clearSelectedObject, revertTransform, setTransformControls, removeTransformControls, setRenderDistance, addObject, getObject, addObjectToSpace, addMediaScreen, attachMediaScreenContent, updateObject, updateShowcaseObject, deleteObject, deleteShowcaseObject,
6513
6713
  // deleteObjectFromSpace,
@@ -6556,7 +6756,7 @@ initToolbarUI, themeManager,
6556
6756
  //utils
6557
6757
  convertToEuler, disableSweeps, enableSweep, disableSweep,
6558
6758
  //Draw polygon
6559
- tubeLineType, _sceneObject, _tubes, drawLine, renderPolygonFromPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, getChildrenOfModel,
6759
+ tubeLineType, _sceneObject, _tubes, drawLine, renderPolygonFromPath, toggleSpaceNavigation, startDraw, exitDraw, cancelDraw, setPolygonPath, setTubeLinePath, getCurrentTubeLine, renderPolygon, toggleWallVisibility, getChildrenOfModel, toggleVerticeRingVisibility, setPolygonFloorOffset, getPolygonFloorOffset, setFloorBaseHeight, clearFloorBaseHeight,
6560
6760
  // Room creation
6561
6761
  setSpaceRoomNodes,
6562
6762
  // others
@@ -100,11 +100,22 @@ i18n
100
100
  "RoomTree": "Room Tree",
101
101
  "Report": "Report",
102
102
  "ALL": "ALL",
103
- "FloorLevel": "Floor Level",
103
+ "FloorLevel": "Floor Offset",
104
+ "AutoLevel": "Auto Level",
104
105
  "Line": "Line",
105
106
  "Name": "Name",
106
- "NoRoomSave": "No Room Saved",
107
- "NothingToReport": "Nothing to report. Please create a partition."
107
+ "NoRoomSaved": "No room to save",
108
+ "NothingToReport": "Nothing to report. Please create a partition.",
109
+ "ConfirmDeletePartition": "Are you sure you want to delete this partition? This action cannot be reversed.",
110
+ "ConfirmDeleteRoom": "Are you sure you want to delete this room? This action cannot be reversed.",
111
+ "SuccessRoomSaved": "Successfully saved room",
112
+ "SuccessRoomDeleted": "Successfully deleted room",
113
+ "NoRoomDeleted": "No room to delete",
114
+ "SuccessPartitionAddSpace": "Successfully added a partition to the space",
115
+ "SuccessPartitionDelete": "Successfully deleted partition",
116
+ "NoPartitionDeleted": "No partition to delete",
117
+ "SuccessBaseHeight": "Successfully set floor base height",
118
+ "MarkBaseHeight": "Click to mark an area as your desired base height"
108
119
  }
109
120
  },
110
121
  ja: {
@@ -199,10 +210,13 @@ i18n
199
210
  "Floor": "床",
200
211
  "Wall": "壁",
201
212
  "ClickEditName": "クリック",
202
- "FloorLevel": "床の基本高",
213
+ "FloorLevel": "フロアオフセット",
214
+ "AutoLevel": "自動レベル",
203
215
  "Line": "線",
204
216
  "Name": "名前",
205
- "NothingToReport": "Nothing to report. Please create a partition."
217
+ "NothingToReport": "Nothing to report. Please create a partition.",
218
+ "SuccessBaseHeight": "床ベースの高さの設定に成功しました",
219
+ "MarkBaseHeight": "クリックして、希望するベース高さとして領域をマークします"
206
220
  }
207
221
  }
208
222
  },
@@ -1,12 +1,68 @@
1
1
  import { FORM_MODE, RoomNode, PolygonData } from "../../../../types";
2
2
  export declare function renderRoomFormPane(): HTMLDivElement;
3
- export declare function toggleDrawPartionButton(): void;
4
- export declare function renderRoomFormMode(): void;
5
- export declare function clearRoomForm(): void;
6
- export declare function getRoomFormData(): RoomNode;
7
- export declare function getPartitionFormData(): Array<RoomNode>;
8
- export declare function setPartitionSavingMode(mode: boolean): void;
3
+ /**
4
+ * Toggles the state of the partition drawing functionality.
5
+ * If drawing is not active, it starts the drawing process.
6
+ * Otherwise, it cancels the current drawing, updates partition data,
7
+ * and displays the relevant UI elements for partitions.
8
+ */
9
+ export declare function toggleDrawPartitionButton(): void;
10
+ /**
11
+ * Displays the partition form based on the current form mode.
12
+ * Handles different UI behaviors for edit and add modes.
13
+ */
14
+ export declare function displayPartitionFormMode(): void;
15
+ /**
16
+ * Clears the partition form by resetting UI elements and internal data.
17
+ * - Navigates back to the partition list view.
18
+ * - Cancels any ongoing drawing actions.
19
+ * - Hides relevant UI elements like wall height, delete button, and partition container.
20
+ * - Resets the form and clears data related to the current partition, room, and polygon.
21
+ */
22
+ export declare function clearPartitionForm(): void;
23
+ /**
24
+ * Retrieves the form data for creating or editing a room partition.
25
+ * - Collects values from form inputs (name, floor level, memo).
26
+ * - Constructs a payload object containing the room data, including the space UUID and polygon data.
27
+ * - Updates the polygon data for each partition in the currentPartitionDataArray to reflect the new floor level.
28
+ * - If there is existing room data (currentEditRoomData), it returns that data with updated values.
29
+ *
30
+ * @returns {RoomNode} The room data object with partition and floor details.
31
+ */
32
+ export declare function getPartitionFormData(): RoomNode;
33
+ /**
34
+ * Sets the saving mode for the partition form.
35
+ * - If saving is enabled, `isSaving` is set to true, indicating that the form is in saving mode.
36
+ * - If saving is disabled, `isSaving` is set to false.
37
+ *
38
+ * @param {boolean} savingEnabled - True to enable saving mode, false to disable.
39
+ */
40
+ export declare function setPartitionSavingMode(savingEnabled: boolean): void;
41
+ /**
42
+ * Gets the current saving mode for the partition form.
43
+ *
44
+ * @returns {boolean} - Returns true if saving mode is enabled, false otherwise.
45
+ */
9
46
  export declare function getPartitionSavingMode(): boolean;
10
- export declare function setRoomFormMode(formType: FORM_MODE): void;
11
- export declare function getRoomFormMode(): FORM_MODE;
47
+ /**
48
+ * Sets the form mode for the partition form.
49
+ * - The form mode can be one of the predefined FORM_MODE values (e.g., CREATE, EDIT, etc.).
50
+ *
51
+ * @param {FORM_MODE} formType - The type of form mode to set.
52
+ */
53
+ export declare function setPartitionFormMode(formType: FORM_MODE): void;
54
+ /**
55
+ * Gets the current form mode for the partition form.
56
+ *
57
+ * @returns {FORM_MODE} - The current form mode.
58
+ */
59
+ export declare function getPartitionFormMode(): FORM_MODE;
60
+ /**
61
+ * Sets the polygon data for the current partition, including rounding numeric values
62
+ * to two decimal places and assigning UUIDs to the floor and walls.
63
+ *
64
+ * @param {PolygonData} payload - The polygon data to set, including floor and walls.
65
+ */
12
66
  export declare function setPolygonData(payload: PolygonData): void;
67
+ export declare function getNewlyAddedPartition(): Array<RoomNode>;
68
+ export declare function getDeletedSavedPartitionArray(): Array<RoomNode>;