architwin 1.10.0 → 1.10.2

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.
@@ -10,6 +10,7 @@ import '../static/media_screen.css';
10
10
  import { createMeetingTemplate, joinMeetingTemplate } from "./meeting/templates";
11
11
  import { ActionHistory } from "./actionHistory";
12
12
  import * as meet from './zoom';
13
+ import 'notyf/notyf.min.css';
13
14
  declare const transformHistory: ActionHistory;
14
15
  declare const _config: {
15
16
  mp: {
@@ -532,6 +533,7 @@ declare function getWallBaseHeight(): number;
532
533
  declare function clearWallBaseHeight(): void;
533
534
  declare function undoDrawAction(): void;
534
535
  declare function redoDrawAction(): void;
536
+ declare function addUndoDrawActions(action: any): void;
535
537
  declare function setTagIcon(payload: {
536
538
  tag: MpSdk.Tag.TagData;
537
539
  iconName: string;
@@ -684,4 +686,4 @@ declare function getPathBetweenSweeps(startSweepId: string, endSweepId: string,
684
686
  }[];
685
687
  }>;
686
688
  declare function moveAlongPath(path: any[], iframeId: any): Promise<void>;
687
- 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, setWallBaseHeight, getWallBaseHeight, clearWallBaseHeight, setSpacePartitionNodes, setCurrentPolygon, getSpaceId, getCurrentPolygon, getPathBetweenSweeps, moveAlongPath, };
689
+ 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, };
package/lib/architwin.js CHANGED
@@ -34,7 +34,10 @@ import log from 'loglevel';
34
34
  import * as meet from './zoom';
35
35
  import ShortUniqueId from 'short-unique-id';
36
36
  import { setPreferredLanguage } from "./atwinui/components/toolbar";
37
- import { getDrawingMode } from "./atwinui/components/toolbar/spacePartition/roomFormPane";
37
+ import { getCurrentPolygonData, getDrawingMode, setCurrentPartitionData } from "./atwinui/components/toolbar/spacePartition/roomFormPane";
38
+ import { Notyf } from 'notyf';
39
+ import 'notyf/notyf.min.css';
40
+ import i18n from "./atwinui/components/toolbar/i18n";
38
41
  const uid = new ShortUniqueId({
39
42
  dictionary: 'number'
40
43
  });
@@ -207,7 +210,7 @@ _vertexPathDeleteUndoHistory = new Array(); // history of deleted vertex (undo)
207
210
  // _thisVertexComponent:MpSdk.Scene.IComponent, // Current Vertex Component
208
211
  // _thisVerticeNode:MpSdk.Scene.INode, // Current VerticeNode
209
212
  // _thisVertexPath = new Array()
210
- let visualize = true, _activeVertex, editMode = false, drawMode = false, _thisVertexNode, _thisVertexComponent, _thisVerticesNode, _thisVertexPath = new Array(), _currentPolygon, _polygonShapePath, _polygonWallDataPath, _polygonDataPath, _polygonWallHeightPath, _verticeComponentsCollection = [], _vertexConnectiveComponentCollection = [], _vertexConnectiveNodeCollection = [], _highestYaxisPoint, _polygonFloorOffset = 0.1, _autoLevelFloorEnabled = true, _floorBaseHeight, _offsetedBaseHeight = _floorBaseHeight ? _floorBaseHeight + _polygonFloorOffset : undefined, _wallBaseHeight;
213
+ let visualize = true, _activeVertex, editMode = false, drawMode = false, _thisVertexNode, _thisVertexComponent, _thisVerticesNode, _thisVertexPath = new Array(), _currentPolygon, _polygonShapePath, _polygonWallDataPath, _polygonDataPath, _polygonWallHeightPath, _verticeComponentsCollection = [], _vertexConnectiveComponentCollection = [], _vertexConnectiveNodeCollection = [], _polygonFloorOffset = 0.1, _floorBaseHeight, _offsetedBaseHeight = _floorBaseHeight ? _floorBaseHeight + _polygonFloorOffset : undefined, _wallBaseHeight;
211
214
  let _intersectionData, _tubes, _verticeEmitPath, _verticeEditEmitPath;
212
215
  let _navigationInputNode;
213
216
  let _navigationComponent;
@@ -221,6 +224,13 @@ let _tubeLinePath;
221
224
  let _partitionNodes = undefined;
222
225
  //Keybindings flags
223
226
  let isCtrlPressed = false, isShiftPressed = false, lastKeyPressed = null;
227
+ let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500, types: [
228
+ {
229
+ type: 'info',
230
+ background: 'blue',
231
+ icon: '<span class="mdi mdi-information-outline"></span>'
232
+ }
233
+ ] });
224
234
  // end here
225
235
  // =========================================== INITIALIZATION ===========================================
226
236
  /**
@@ -5173,6 +5183,10 @@ function renderPolygon(payload, options) {
5173
5183
  path: payload
5174
5184
  };
5175
5185
  }
5186
+ options.excludeHiddenWallsFromCalculation = false;
5187
+ if (_wallBaseHeight) {
5188
+ options.wallHeight = _wallBaseHeight;
5189
+ }
5176
5190
  if (!_currentPolygon) {
5177
5191
  try {
5178
5192
  polyNode = _sceneObject.addNode();
@@ -5227,6 +5241,7 @@ function renderPolygon(payload, options) {
5227
5241
  if (!options) {
5228
5242
  options = {};
5229
5243
  }
5244
+ options.excludeHiddenWallsFromCalculation = false;
5230
5245
  const targetPolygon = _3DXObjects.find(obj => obj.object.object_data.uuid == payload.uuid);
5231
5246
  if (!targetPolygon) {
5232
5247
  log.info("Creating new partition");
@@ -5477,6 +5492,10 @@ function createVertexPoints(position, redrawing = false) {
5477
5492
  log.error("Position is undefined");
5478
5493
  return;
5479
5494
  }
5495
+ if (_floorBaseHeight == undefined && Math.sign(position.y) == -1) {
5496
+ notyf.error(`${i18n.t('CannotPlaceInArea')}`);
5497
+ return;
5498
+ }
5480
5499
  // If no node is active
5481
5500
  if (_thisVertexNode === undefined) {
5482
5501
  log.info("_thisVertexNode is undefined. Adding vertex...");
@@ -5590,11 +5609,12 @@ function createVerticeClickSpy() {
5590
5609
  // // Show Vertices
5591
5610
  // createVerticeControls(_thisVertexComponent);
5592
5611
  // }
5593
- _undoDrawActions.push('addVertex');
5612
+ _undoDrawActions.push({ action: "addVertex" });
5594
5613
  dispatchSpaceEvent(SPACE_EVENTS.VERTEX_PLACED, {
5595
5614
  position: _intersectionData.position,
5596
5615
  path: _thisVertexPath
5597
5616
  });
5617
+ _redoDrawActions = [];
5598
5618
  }
5599
5619
  }
5600
5620
  },
@@ -5703,7 +5723,8 @@ function deleteEdge(component, endPoint) {
5703
5723
  const index = component.inputs.path.findIndex(path => isEqual(path, endPoint));
5704
5724
  if (index != undefined) {
5705
5725
  //@ts-expect-error
5706
- const newArr = component.inputs.path.slice(index, 1);
5726
+ const newArr = component.inputs.path.filter((_, i) => i !== index);
5727
+ console.log("newArr", newArr);
5707
5728
  component.inputs.path = [...newArr];
5708
5729
  return;
5709
5730
  }
@@ -6090,10 +6111,42 @@ function clearWallBaseHeight() {
6090
6111
  }
6091
6112
  function undoDrawAction() {
6092
6113
  console.log("undoDrawAction()");
6093
- const action = _undoDrawActions.pop();
6094
- if (action === 'addVertex') {
6114
+ const undo = _undoDrawActions.pop();
6115
+ if (undo && undo.action === 'addVertex') {
6095
6116
  deleteVertex();
6096
- _redoDrawActions.push('deleteVertex');
6117
+ _redoDrawActions.push({ action: 'deleteVertex' });
6118
+ if (_currentPolygon && (_currentPolygon.object.object_data.json_data.path).length <= 3) {
6119
+ _currentPolygon = undefined;
6120
+ _polygonShapePath = undefined;
6121
+ _undoDrawActions = _undoDrawActions.filter(undo => undo.action != "deleteWall");
6122
+ _redoDrawActions = _redoDrawActions.filter(redo => redo.action != "addWall");
6123
+ }
6124
+ setCurrentPartitionData();
6125
+ }
6126
+ else if (undo && undo.action == 'deleteWall') {
6127
+ console.log("undo", undo);
6128
+ const polygon = getCurrentPolygonData();
6129
+ polygon.walls = polygon.walls.map(wall => {
6130
+ if (wall.uuid === undo.wallId) {
6131
+ return Object.assign(Object.assign({}, wall), { options: Object.assign(Object.assign({}, wall.options), { is_visible: true, is_deleted: false }) });
6132
+ }
6133
+ return wall;
6134
+ });
6135
+ let payload;
6136
+ payload = {
6137
+ uuid: undo.payload.uuid,
6138
+ space_uuid: undo.payload.space_uuid,
6139
+ name: undo.payload.name,
6140
+ parent_uuid: undo.payload.parent_uuid,
6141
+ polygon_json: polygon
6142
+ };
6143
+ console.log("payload", payload, _currentPolygon);
6144
+ renderPolygon(payload);
6145
+ _redoDrawActions.push({
6146
+ action: 'addWall',
6147
+ wallId: undo.wallId,
6148
+ payload: payload
6149
+ });
6097
6150
  }
6098
6151
  const drawHistory = {
6099
6152
  redoDrawActions: _redoDrawActions,
@@ -6104,23 +6157,46 @@ function undoDrawAction() {
6104
6157
  function redoDrawAction() {
6105
6158
  console.log("redoDrawAction()");
6106
6159
  if (Array.isArray(_redoDrawActions) && _redoDrawActions.length > 0) {
6107
- const action = _redoDrawActions.pop();
6108
- console.log("Redoing action:", action);
6109
- if (action === "deleteVertex") {
6160
+ const redo = _redoDrawActions.pop();
6161
+ console.log("Redoing action:", redo.action);
6162
+ if (redo && redo.action === "deleteVertex") {
6110
6163
  if (Array.isArray(_vertexPathDeleteUndoHistory) && _vertexPathDeleteUndoHistory.length > 0) {
6111
6164
  if (!_thisVertexPath)
6112
6165
  _thisVertexPath = [];
6113
- _thisVertexPath.push(_vertexPathDeleteUndoHistory.pop());
6114
- if (_thisVertexComponent && _thisVertexComponent.inputs) {
6115
- _thisVertexComponent.inputs.path = [..._thisVertexPath];
6116
- createVerticeControls(_thisVertexComponent, true);
6117
- }
6166
+ let point = _vertexPathDeleteUndoHistory.pop();
6167
+ _thisVertexPath.push(Object.assign({}, point));
6168
+ _thisVertexComponent.inputs.path = [..._thisVertexPath];
6169
+ createVerticeControls(_thisVertexComponent);
6118
6170
  console.info("_thisVertexComponent", _thisVertexComponent);
6119
6171
  if (!_undoDrawActions)
6120
6172
  _undoDrawActions = [];
6121
- _undoDrawActions.push("addVertex");
6173
+ _undoDrawActions.push({ action: "addVertex" });
6174
+ setCurrentPartitionData();
6122
6175
  }
6123
6176
  }
6177
+ else if (redo && redo.action === "addWall") {
6178
+ let partition;
6179
+ let polygon = getCurrentPolygonData();
6180
+ polygon.walls = polygon.walls.map(wall => {
6181
+ if (wall.uuid === redo.wallId) {
6182
+ return Object.assign(Object.assign({}, wall), { options: Object.assign(Object.assign({}, wall.options), { is_visible: false, is_deleted: true }) });
6183
+ }
6184
+ return wall;
6185
+ });
6186
+ partition = {
6187
+ uuid: redo.payload.uuid,
6188
+ space_uuid: redo.payload.space_uuid,
6189
+ name: redo.payload.name,
6190
+ parent_uuid: redo.payload.parent_uuid,
6191
+ polygon_json: polygon
6192
+ };
6193
+ renderPolygon(partition);
6194
+ _undoDrawActions.push({
6195
+ action: 'deleteWall',
6196
+ wallId: redo.wallId,
6197
+ payload: partition
6198
+ });
6199
+ }
6124
6200
  }
6125
6201
  const drawHistory = {
6126
6202
  redoDrawActions: _redoDrawActions || [],
@@ -6129,6 +6205,15 @@ function redoDrawAction() {
6129
6205
  console.log("Updated draw history:", drawHistory);
6130
6206
  dispatchSpaceEvent(SPACE_EVENTS.DRAW_HISTORY, drawHistory);
6131
6207
  }
6208
+ function addUndoDrawActions(action) {
6209
+ _undoDrawActions.push(action);
6210
+ const drawHistory = {
6211
+ redoDrawActions: _redoDrawActions || [],
6212
+ undoDrawActions: _undoDrawActions || [],
6213
+ };
6214
+ console.log("Updated draw history:", drawHistory);
6215
+ dispatchSpaceEvent(SPACE_EVENTS.DRAW_HISTORY, drawHistory);
6216
+ }
6132
6217
  function clearDrawActionHistory() {
6133
6218
  log.info("clearDrawActionHistory()");
6134
6219
  _redoDrawActions = [];
@@ -7257,7 +7342,7 @@ initToolbarUI, themeManager,
7257
7342
  //utils
7258
7343
  convertToEuler, disableSweeps, enableSweep, disableSweep,
7259
7344
  //Draw polygon
7260
- 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, setWallBaseHeight, getWallBaseHeight, clearWallBaseHeight,
7345
+ 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,
7261
7346
  // Space partition
7262
7347
  setSpacePartitionNodes, setCurrentPolygon,
7263
7348
  // others
@@ -108,6 +108,7 @@ i18n
108
108
  "NothingToReport": "Nothing to report. Please create a partition.",
109
109
  "ConfirmDeletePartition": "Are you sure you want to delete this partition? This action cannot be reversed.",
110
110
  "ConfirmDeleteRoom": "Are you sure you want to delete this room? This action cannot be reversed.",
111
+ "ConfirmDeleteWall": "Are you sure you want to delete this wall?",
111
112
  "SuccessRoomSaved": "Successfully saved room",
112
113
  "SuccessRoomDeleted": "Successfully deleted room",
113
114
  "NoRoomDeleted": "No room to delete",
@@ -120,7 +121,10 @@ i18n
120
121
  "ModifyPartition": "Modify Partition",
121
122
  "InvalidNaN": "Invalid input. Please enter a valid number",
122
123
  "CannotPlaceInArea": "Cannot place point at selected area. Please try again",
123
- "SuccessWallHeight": "Successfully updated wall height"
124
+ "SuccessWallHeight": "Successfully updated wall height",
125
+ "Edge": "Edge",
126
+ "Area": "Area",
127
+ "DeleteWall": "Delete Wall"
124
128
  }
125
129
  },
126
130
  ja: {
@@ -225,6 +229,7 @@ i18n
225
229
  "NoRoomSaved": "保存する部屋がありません",
226
230
  "ConfirmDeletePartition": "本当に区画を削除しますか?(戻せません)",
227
231
  "ConfirmDeleteRoom": "本当にルームを削除しますか?(戻せません)",
232
+ "ConfirmDeleteWall": "本当に壁を削除しますか?(戻せません) ",
228
233
  "SuccessRoomSaved": "保存しました",
229
234
  "SuccessRoomDeleted": "削除しました",
230
235
  "NoRoomDeleted": "削除できるルームがありません",
@@ -235,7 +240,10 @@ i18n
235
240
  "ModifyPartition": "パーティションの変更",
236
241
  "InvalidNaN": "値が不正です。正しい数値を入力してくさい。",
237
242
  "CannotPlaceInArea": "ここには設定できません。位置を変えて試してください。",
238
- "SuccessWallHeight": "壁の高さが正常に更新されました"
243
+ "SuccessWallHeight": "壁の高さが正常に更新されました",
244
+ "Edge": "辺長",
245
+ "Area": "面積",
246
+ "DeleteWall": "ウォール削除",
239
247
  }
240
248
  }
241
249
  },
@@ -1,4 +1,4 @@
1
- import { FORM_MODE, PartitionNode, PolygonData } from "../../../../types";
1
+ import { FORM_MODE, PartitionNode, PolygonData, IObjectData } from "../../../../types";
2
2
  export declare function renderRoomFormPane(): HTMLDivElement;
3
3
  /**
4
4
  * Toggles the state of the partition drawing functionality.
@@ -57,6 +57,17 @@ export declare function setPartitionFormMode(formType: FORM_MODE): void;
57
57
  * @returns {FORM_MODE} - The current form mode.
58
58
  */
59
59
  export declare function getPartitionFormMode(): FORM_MODE;
60
+ /**
61
+ * Returns a temporary copy of the current polygon.
62
+ *
63
+ * @returns
64
+ */
65
+ export declare function getTempCurrentPolygon(): IObjectData;
66
+ /**
67
+ *Clears the temporary current polygon
68
+ *
69
+ */
70
+ export declare function clearTempCurrentPolygon(): void;
60
71
  /**
61
72
  * Sets the polygon data for the current partition, including rounding numeric values
62
73
  * to two decimal places and assigning UUIDs to the floor and walls.
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import i18n from '../i18n';
11
11
  import { SPACE_EVENTS } from "../../../../types";
12
12
  import { batchAddEventListenerByClassName } from "../../../events";
13
- import { startDraw, cancelDraw, disposeModel, _3DXObjects, getCurrentPolygon, dispatchSpaceEvent, enableVerticeControls, setCurrentPolygon, setMeshChildrenMaterialProperty, get3DXObjects, getChildrenOfModel, clearSelectedObject } from '../../../../architwin';
13
+ import { startDraw, cancelDraw, disposeModel, _3DXObjects, getCurrentPolygon, dispatchSpaceEvent, enableVerticeControls, setCurrentPolygon, setMeshChildrenMaterialProperty, get3DXObjects, getChildrenOfModel, clearSelectedObject, renderPolygon, addUndoDrawActions, setWallBaseHeight, clearWallBaseHeight } from '../../../../architwin';
14
14
  import { generateUUID, extractUUID } from '../../../../utils';
15
15
  import { getCurrentEditRoomData } from './roomTreePane';
16
16
  import { toggleModal, setModalAction } from "../modal";
@@ -31,6 +31,7 @@ let newlyAddedPartition = [];
31
31
  let deletedSavedPartitionArray = [];
32
32
  let currentHighlightedFace = null;
33
33
  let previousPartitionData = null;
34
+ let tempCurrentPolygon = undefined;
34
35
  export function renderRoomFormPane() {
35
36
  console.info("__@ renderRoomFormPane");
36
37
  const element = document.createElement('div');
@@ -167,6 +168,10 @@ export function toggleDrawPartitionButton() {
167
168
  const redoBtn = document.getElementById('at-draw-redo-btn');
168
169
  undoBtn.classList.add('at_disabled');
169
170
  redoBtn.classList.add('at_disabled');
171
+ const formMode = getPartitionFormMode();
172
+ if (formMode == "ADD" /* FORM_MODE.ADD */) {
173
+ tempCurrentPolygon = getCurrentPolygon();
174
+ }
170
175
  cancelDrawing();
171
176
  goBackToPartitionList();
172
177
  if (currentPartitionDataArray.length !== 0) {
@@ -455,7 +460,7 @@ function displayFaces(polygon) {
455
460
  // Display the floor details
456
461
  if (polygon.floor) {
457
462
  const floorModel = modelChildren.find(model => model.name.includes(polygon.floor.name));
458
- faceVertexContainer.appendChild(displayFloor(polygon.floor, floorModel));
463
+ faceVertexContainer.appendChild(displayFloor(polygon.floor, polygon.walls, floorModel));
459
464
  }
460
465
  /* Do not erase
461
466
  // Display each wall's details
@@ -528,6 +533,57 @@ function displayFaces(polygon) {
528
533
  };
529
534
  }
530
535
  });
536
+ batchAddEventListenerByClassName('at_delete_wall_btn', (event) => {
537
+ const targetElement = event.target;
538
+ console.log("targetElement", targetElement);
539
+ const wallId = extractUUID(targetElement.id);
540
+ console.log("wallId", wallId);
541
+ toggleModal();
542
+ setModalAction({
543
+ title: `${i18n.t('DeleteWall')}`,
544
+ description: `${i18n.t('ConfirmDeleteWall')}`,
545
+ buttonLabel: `${i18n.t('YesDelete')}`
546
+ }, () => __awaiter(this, void 0, void 0, function* () {
547
+ currentPolygonData.walls = currentPolygonData.walls.map(wall => {
548
+ if (wall.uuid === wallId) {
549
+ return Object.assign(Object.assign({}, wall), { options: Object.assign(Object.assign({}, wall.options), { is_visible: false, is_deleted: true }) });
550
+ }
551
+ return wall;
552
+ });
553
+ let payload;
554
+ if (currentEditPartitionData) {
555
+ payload = {
556
+ uuid: currentEditPartitionData.uuid,
557
+ space_uuid: currentEditPartitionData.space_uuid,
558
+ name: currentEditPartitionData.name,
559
+ parent_uuid: currentEditPartitionData.parent_uuid,
560
+ polygon_json: currentPolygonData
561
+ };
562
+ }
563
+ else if (currentPartitionData) {
564
+ payload = {
565
+ uuid: currentPartitionData.uuid,
566
+ space_uuid: currentPartitionData.space_uuid,
567
+ name: currentPartitionData.name,
568
+ parent_uuid: currentPartitionData.parent_uuid,
569
+ polygon_json: currentPolygonData
570
+ };
571
+ }
572
+ console.log("renderPolygon:", payload);
573
+ // Re-render polygon
574
+ renderPolygon(payload);
575
+ const undoPaylaod = {
576
+ action: "deleteWall",
577
+ wallId: wallId,
578
+ payload: payload
579
+ };
580
+ addUndoDrawActions(undoPaylaod);
581
+ const redoBtn = document.getElementById('at-draw-redo-btn');
582
+ redoBtn.classList.add('at_disabled');
583
+ toggleModal(false);
584
+ notify.success(`${i18n.t('SuccessWallDelete')}`);
585
+ }));
586
+ });
531
587
  }
532
588
  /**
533
589
  * Handles the transition back to the partition list view by updating the visibility of relevant UI elements.
@@ -554,7 +610,7 @@ function goBackToPartitionList() {
554
610
  * @param floor - The floor data to display.
555
611
  * @returns The created HTML element representing the floor and its associated data.
556
612
  */
557
- function displayFloor(floor, floorModel) {
613
+ function displayFloor(floor, walls, floorModel) {
558
614
  const floorModelUUID = floorModel ? floorModel.name : null;
559
615
  const element = document.createElement('div');
560
616
  element.classList.add('at_face_vertex_item');
@@ -587,8 +643,10 @@ function displayFloor(floor, floorModel) {
587
643
  const vertexListContainer = element.querySelector(`#at-vertex-list-${floor.uuid}`);
588
644
  // Append lines to the at_vertex_list container
589
645
  floor.edges.forEach((vertex, index) => {
590
- const row = displayLines(vertex, index + 1, 'floor');
591
- vertexListContainer.appendChild(row); // Append to the correct container
646
+ if (!walls[index].options.is_deleted) {
647
+ const row = displayWalls(vertex, walls[index], index + 1, 'floor');
648
+ vertexListContainer.appendChild(row); // Append to the correct container
649
+ }
592
650
  });
593
651
  return element;
594
652
  }
@@ -596,18 +654,22 @@ function displayFloor(floor, floorModel) {
596
654
  * Displays the wall information in the UI, including the wall name, edit options, and associated vertices.
597
655
  * @param wall - The wall data to display.
598
656
  * @returns The created HTML element representing the wall and its associated data.
599
- */
600
- function displayWalls(wall, wallModel) {
657
+ *\/
658
+ function displayWalls(wall: WallPolyData, wallModel): HTMLElement {
601
659
  const wallModelUUID = wallModel ? wallModel.name : null;
660
+
602
661
  // Extract the wall name from the format "_wall-{number}" using regex
603
662
  const match = wall.name.match(/wall-(\d+)$/);
604
663
  let wallName = '';
664
+
605
665
  if (match) {
606
666
  const wallNumber = parseInt(match[1]) + 1;
607
667
  wallName = `${i18n.t('Wall')} ${wallNumber}`;
608
668
  }
669
+
609
670
  const element = document.createElement('div');
610
671
  element.classList.add('at_face_vertex_item');
672
+
611
673
  element.innerHTML = `
612
674
  <div class="at_face_item">
613
675
  <div class="at_icon_left">
@@ -634,15 +696,19 @@ function displayWalls(wall, wallModel) {
634
696
  <div class="at_vertex_list" id="at-vertex-list-${wall.uuid}" data-cy="at-vertex-list-${wall.uuid}">
635
697
  </div>
636
698
  `;
699
+
637
700
  // Get the at_vertex_list container for this wall
638
701
  const vertexListContainer = element.querySelector(`#at-vertex-list-${wall.uuid}`);
702
+
639
703
  // Append lines to the at_vertex_list container
640
704
  wall.edges.forEach((vertex, index) => {
641
- const row = displayLines(vertex, index + 1, 'wall');
705
+ const row = displayWalls(vertex, index + 1, 'wall');
642
706
  vertexListContainer.appendChild(row); // Append to the correct container
643
707
  });
708
+
644
709
  return element;
645
710
  }
711
+ */
646
712
  /**
647
713
  * Displays the line information for a given vertex, including its name, distance, and delete icon.
648
714
  * The delete icon visibility depends on whether the face type is 'floor'.
@@ -651,14 +717,21 @@ function displayWalls(wall, wallModel) {
651
717
  * @param faceType - The type of face ('floor' or 'wall').
652
718
  * @returns The created HTML element representing the line and its associated data.
653
719
  */
654
- function displayLines(vertex, index, faceType) {
655
- console.log('displayLines()', vertex);
720
+ function displayWalls(vertex, wall, index, faceType) {
721
+ console.log('displayWalls()', vertex);
722
+ // Extract the wall name from the format "_wall-{number}" using regex
723
+ const match = wall.name.match(/wall-(\d+)$/);
724
+ let wallName = '';
725
+ if (match) {
726
+ const wallNumber = parseInt(match[1]) + 1;
727
+ wallName = `${i18n.t('Wall')} ${wallNumber}`;
728
+ }
656
729
  const element = document.createElement('div');
657
730
  element.classList.add('at_vertex_item');
658
731
  // Determine whether to display the delete icon based on faceType ('floor' only)
659
732
  const deleteIconHtml = faceType === 'floor' ?
660
- `<div class="at_vertex_icon_right">
661
- <span class="mdi mdi-delete-outline"></span>
733
+ `<div class="at_vertex_icon_right at_delete_wall_btn" id="at-delete-wall-btn_${wall.uuid}">
734
+ <span class="mdi mdi-delete-outline" id="at-delete-wall-btn_${wall.uuid}"></span>
662
735
  </div>` :
663
736
  `<div class="at_vertex_icon_right at_invisible">
664
737
  <span class="mdi mdi-delete-outline"></span>
@@ -669,7 +742,7 @@ function displayLines(vertex, index, faceType) {
669
742
  </div>
670
743
  <div class="at_vertex_center">
671
744
  <div class="at_vertex_name">
672
- ${i18n.t('Line') + " " + index}
745
+ ${wallName}
673
746
  </div>
674
747
  <div class="at_vertex_distance">
675
748
  ${vertex.length + " m"}
@@ -727,6 +800,7 @@ export function clearPartitionForm() {
727
800
  */
728
801
  function cancelDrawing() {
729
802
  console.log('cancelDrawing()');
803
+ clearWallBaseHeight();
730
804
  if (currentHighlightedFace) {
731
805
  const object = getCurrentPolygon();
732
806
  const modelChildren = getChildrenOfModel(object.component).filter((model) => model.name !== '' && !model.name.includes('wallLabel') && !model.name.includes('edgeLabel'));
@@ -761,6 +835,13 @@ function cancelDrawing() {
761
835
  */
762
836
  function startDrawing() {
763
837
  console.log('startDrawing()');
838
+ const wallHeightInput = document.getElementById('at-room-wall-height-input');
839
+ if (wallHeightInput.value && wallHeightInput.value != '') {
840
+ const newWallHeight = Number.parseFloat(wallHeightInput.value);
841
+ if (newWallHeight > 0) {
842
+ setWallBaseHeight(Number.parseFloat(wallHeightInput.value));
843
+ }
844
+ }
764
845
  startDraw();
765
846
  isDrawing = true;
766
847
  const drawRoomBtn = document.getElementById('at-draw-partition-form-btn');
@@ -809,6 +890,7 @@ export function getPartitionFormData() {
809
890
  partition.polygon_json = JSON.stringify(polygonJson);
810
891
  });
811
892
  if (currentEditRoomData) {
893
+ currentEditRoomData.children = currentPartitionDataArray;
812
894
  payload = currentEditRoomData;
813
895
  payload.name = name;
814
896
  payload.polygon_json = JSON.stringify({ memo: memo });
@@ -850,6 +932,21 @@ export function setPartitionFormMode(formType) {
850
932
  export function getPartitionFormMode() {
851
933
  return roomFormMode;
852
934
  }
935
+ /**
936
+ * Returns a temporary copy of the current polygon.
937
+ *
938
+ * @returns
939
+ */
940
+ export function getTempCurrentPolygon() {
941
+ return tempCurrentPolygon;
942
+ }
943
+ /**
944
+ *Clears the temporary current polygon
945
+ *
946
+ */
947
+ export function clearTempCurrentPolygon() {
948
+ tempCurrentPolygon = undefined;
949
+ }
853
950
  /**
854
951
  * Sets the polygon data for the current partition, including rounding numeric values
855
952
  * to two decimal places and assigning UUIDs to the floor and walls.
@@ -895,7 +992,7 @@ export function setPolygonData(payload) {
895
992
  }
896
993
  currentPolygonData = payload;
897
994
  console.log("setPolygonData() currentPolygonData:", currentPolygonData);
898
- // setCurrentPartitionData()
995
+ setCurrentPartitionData();
899
996
  }
900
997
  /**
901
998
  * Returns current polygon data
@@ -954,14 +1051,6 @@ export function setCurrentPartitionData() {
954
1051
  dispatchSpaceEvent(SPACE_EVENTS.PARTITION_DISPOSED, currentEditPartitionData);
955
1052
  currentEditPartitionData.uuid = newPayload.uuid;
956
1053
  }
957
- if (previousPartitionData) {
958
- const target = _3DXObjects.find(obj => obj.object.object_data.uuid === previousPartitionData.uuid);
959
- disposeModel(target);
960
- console.log("_3DXObjects", _3DXObjects);
961
- currentPartitionDataArray = currentPartitionDataArray.map(partition => partition.uuid === previousPartitionData.uuid
962
- ? Object.assign(Object.assign({}, partition), { uuid: newPayload.uuid }) : partition);
963
- dispatchSpaceEvent(SPACE_EVENTS.PARTITION_DISPOSED, previousPartitionData);
964
- }
965
1054
  if (currentHighlightedFace) {
966
1055
  setMeshChildrenMaterialProperty(currentHighlightedFace.component, currentHighlightedFace.name, currentHighlightedFace.type, currentHighlightedFace.value);
967
1056
  }
@@ -973,6 +1062,8 @@ export function setCurrentPartitionData() {
973
1062
  const faceVertexContainer = document.getElementById('at-face-vertex-container');
974
1063
  faceVertexContainer.innerHTML = '';
975
1064
  if (currentPartitionData) {
1065
+ const target = _3DXObjects.find(obj => obj.object.object_data.uuid === currentPartitionData.uuid);
1066
+ disposeModel(target);
976
1067
  currentPartitionDataArray = currentPartitionDataArray.filter(partition => partition.uuid != currentPartitionData.uuid);
977
1068
  dispatchSpaceEvent(SPACE_EVENTS.PARTITION_DISPOSED, currentPartitionData);
978
1069
  currentPartitionData = null;
@@ -1,4 +1,4 @@
1
- import { IObjectData, PartitionNode, PolygonData } from "../../../../types";
1
+ import { IObjectData, PartitionNode } from "../../../../types";
2
2
  /**
3
3
  * Renders and returns the HTML element for the room tree pane.
4
4
  * @returns {HTMLElement} The HTML element representing the room tree pane.
@@ -47,7 +47,6 @@ export declare function getSelectedPartitionId(): String;
47
47
  * @param isParentPartition - Indicates if the current partition is a parent (true) or a child (false).
48
48
  */
49
49
  export declare function updatePartitionVisibilityUI(isVisible: boolean, currPartition: PartitionNode, isParentPartition: boolean, isUpdateAllChildren: boolean): Promise<void>;
50
- export declare function calculatePolygonDimensions(payload: PolygonData): PolygonData;
51
50
  /**
52
51
  * Updates the visibility of a specific polygon (floor or wall) within a partition.
53
52
  * @param isVisible - The visibility state to set (true/false).
@@ -207,18 +207,20 @@ export function displayPartitionItems(partitionItems, partitionId, object) {
207
207
  // This is for the walls
208
208
  partitionItems.forEach((item, index) => {
209
209
  console.log("__@ partition item: ", item);
210
- if (!item.hide) {
211
- // Split wall name to localize
212
- const match = item.name.match(/wall-(\d+)$/);
213
- const wallNumber = parseInt(match[1]) + 1;
214
- const isVisible = item.options.is_visible;
215
- const objName = object[index].name.includes('_') ? object[index].name : `${partitionId}_${object[index].name}`;
216
- console.log("__@ objName: ", objName);
217
- itemsHTML += `
218
- <li class="at_toggle">${i18n.t(`Wall`)} ${wallNumber}
219
- <span id="${objName}" partition-id="${partitionId}" polygon-item-id="${item.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn at_pull_right"></span>
220
- </li>
221
- `;
210
+ if (!item.options.is_deleted) {
211
+ if (!item.hide) {
212
+ // Split wall name to localize
213
+ const match = item.name.match(/wall-(\d+)$/);
214
+ const wallNumber = parseInt(match[1]) + 1;
215
+ const isVisible = item.options.is_visible;
216
+ const objName = object[index].name.includes('_') ? object[index].name : `${partitionId}_${object[index].name}`;
217
+ console.log("__@ objName: ", objName);
218
+ itemsHTML += `
219
+ <li class="at_toggle">${i18n.t(`Wall`)} ${wallNumber}
220
+ <span id="${objName}" partition-id="${partitionId}" polygon-item-id="${item.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn at_pull_right"></span>
221
+ </li>
222
+ `;
223
+ }
222
224
  }
223
225
  });
224
226
  }
@@ -458,24 +460,6 @@ export function updatePartitionVisibilityUI(isVisible, currPartition, isParentPa
458
460
  }
459
461
  });
460
462
  }
461
- export function calculatePolygonDimensions(payload) {
462
- console.log("calculatePolygonDimensions: ", payload);
463
- let totalWallArea = 0;
464
- let totalWallLength = 0;
465
- for (let index = 0; index < payload.walls.length; index++) {
466
- if (payload.walls[index].options && payload.walls[index].options.is_visible == false) {
467
- continue;
468
- }
469
- totalWallArea += payload.walls[index].area;
470
- totalWallLength += payload.walls[index].width;
471
- }
472
- const totalWallPerimeter = totalWallLength + (payload.walls[0].wall_height * 2);
473
- payload.totalWallArea = totalWallArea;
474
- payload.totalWallPerimeter = totalWallPerimeter;
475
- payload.floor.area = payload.floor.options.is_visible ? payload.floor.area : 0;
476
- payload.floor.perimeter = payload.floor.options.is_visible ? payload.floor.perimeter : 0;
477
- return payload;
478
- }
479
463
  /**
480
464
  * Updates the visibility of a specific polygon (floor or wall) within a partition.
481
465
  * @param isVisible - The visibility state to set (true/false).
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { actionBar, renderObjectCards, renderLibraryCards, renderTags, renderTagRow, getTagFormData, addClickEventToTagRow, setActiveCard, setActiveMenu, removeObjectCard, setTagCategoriesOption, toggleDropdown, tagFormMode, selectedTag, renderRecepientOptions, renderTagMessages, createTagMessage, setTagLink, setTagMessagingDetails, renderCategoryDropdownOptions, clearTagFormDropdown, clearActiveActionBtn, clearActiveCard, toggleActionBarButtons, selectedCategoryFilterId, selectedSubCategoryFilterId, filterTagList, toggleModal, setModalAction } from "./components/toolbar";
11
- import { getTargetPosition, addMediaScreen, _3DXObjects, selectedObject, setTransformControls, copyObject, revertTransform, clearSelectedObject, removeTransformControls, getLibrary, getMpTags, renderTag, captureSpaceScreenshot, moveTag, subscribeSpaceEvent, setModelVisibility, disposeModel, disposeTag, _tags, _tagCategories, dispatchSpaceEvent, editTagLabel, editTagDescription, setTagMessageRecepients, setTagMessages, setSelectedTagUuid, renderMeetingSidebar, setTagIcon, setObjectTransformation, getSelectedObject, _atwin, isCdnMapDataAvailable, captureScreenshotAndCameraDetails, _mpConfig, cancelModelPlacement, actionHistory, get3DXObjects, transformHistory, goToModel, themeManager, _partitionNodes, setSpacePartitionNodes, getSpaceId, setFloorBaseHeight, toggleWallVisibility, getChildrenOfModel, toggleFloorVisibility, renderPolygon, getCurrentPolygon, getFloorBaseHeight, setSelectedObject, redoDrawAction, undoDrawAction, setCurrentPolygon, setWallBaseHeight, clearWallBaseHeight, } from "../architwin";
11
+ import { getTargetPosition, addMediaScreen, _3DXObjects, selectedObject, setTransformControls, copyObject, revertTransform, clearSelectedObject, removeTransformControls, getLibrary, getMpTags, renderTag, captureSpaceScreenshot, moveTag, subscribeSpaceEvent, setModelVisibility, disposeModel, disposeTag, _tags, _tagCategories, dispatchSpaceEvent, editTagLabel, editTagDescription, setTagMessageRecepients, setTagMessages, setSelectedTagUuid, renderMeetingSidebar, setTagIcon, setObjectTransformation, getSelectedObject, _atwin, isCdnMapDataAvailable, captureScreenshotAndCameraDetails, _mpConfig, cancelModelPlacement, actionHistory, get3DXObjects, transformHistory, goToModel, themeManager, _partitionNodes, setSpacePartitionNodes, getSpaceId, setFloorBaseHeight, toggleWallVisibility, getChildrenOfModel, toggleFloorVisibility, renderPolygon, getCurrentPolygon, getFloorBaseHeight, setSelectedObject, redoDrawAction, undoDrawAction, setWallBaseHeight, clearWallBaseHeight, } from "../architwin";
12
12
  import { Notyf } from 'notyf';
13
13
  import 'notyf/notyf.min.css';
14
14
  import { SPACE_EVENTS } from "../types";
@@ -24,7 +24,7 @@ import log from 'loglevel';
24
24
  import * as minimap from '../minimap';
25
25
  import { clearActiveThemeCard, getSelectedTheme } from "./components/toolbar/themePane";
26
26
  import { getCurrentEditRoomData, displayRoomTree, updatePartitionVisibilityUI, getSelectedPartitionId, updatePolygonVisibilityData, toggleVisibilityState, setFilteredDisplay, updateRoomVisibilityUI } from "./components/toolbar/spacePartition/roomTreePane";
27
- import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setCurrentPartitionData, getCurrentPartitionData, setPreviousPartitionData } from "./components/toolbar/spacePartition/roomFormPane";
27
+ import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setCurrentPartitionData, getTempCurrentPolygon, clearTempCurrentPolygon } from "./components/toolbar/spacePartition/roomFormPane";
28
28
  let activeToolbarItem, activeActionItem, activePane, activeActionPane, cancelTagPlacementPrompt, cancelModelPlacementPrompt;
29
29
  let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500, types: [
30
30
  {
@@ -1109,7 +1109,7 @@ function handleDrawHistory(payload) {
1109
1109
  const undoBtn = document.getElementById('at-draw-undo-btn');
1110
1110
  undoBtn.classList.add('at_disabled');
1111
1111
  }
1112
- else if (redoCount > 0) {
1112
+ else {
1113
1113
  const undoBtn = document.getElementById('at-draw-undo-btn');
1114
1114
  undoBtn.classList.remove('at_disabled');
1115
1115
  }
@@ -1117,7 +1117,7 @@ function handleDrawHistory(payload) {
1117
1117
  const redoBtn = document.getElementById('at-draw-redo-btn');
1118
1118
  redoBtn.classList.add('at_disabled');
1119
1119
  }
1120
- else if (redoCount > 0) {
1120
+ else {
1121
1121
  const redoBtn = document.getElementById('at-draw-redo-btn');
1122
1122
  redoBtn.classList.remove('at_disabled');
1123
1123
  }
@@ -1126,6 +1126,8 @@ function handleVertexPlace() {
1126
1126
  const undoBtn = document.getElementById('at-draw-undo-btn');
1127
1127
  undoBtn.classList.remove('at_disabled');
1128
1128
  setCurrentPartitionData();
1129
+ const redoBtn = document.getElementById('at-draw-redo-btn');
1130
+ redoBtn.classList.add('at_disabled');
1129
1131
  }
1130
1132
  function handleMouseClickObject(object) {
1131
1133
  log.info("handleMouseClickObject()", object);
@@ -1343,7 +1345,7 @@ function handlePartitionVisibility(targetId) {
1343
1345
  getChildrenOfModel(component)
1344
1346
  .filter(model => model.name !== "")
1345
1347
  .map(child => {
1346
- if (child.visible !== isVisible) {
1348
+ if (child.visible !== isVisible && child.deleted !== true) {
1347
1349
  if (child.name.includes('wall')) {
1348
1350
  toggleWallVisibility(component, child.name);
1349
1351
  }
@@ -1594,6 +1596,7 @@ function handleSavePartition() {
1594
1596
  dispatchSpaceEvent(SPACE_EVENTS.PARTITION_EDITED, { data: partitionEditPayload });
1595
1597
  break;
1596
1598
  }
1599
+ clearTempCurrentPolygon();
1597
1600
  clearSelectedObject();
1598
1601
  notyf.success(`${i18n.t('SuccessRoomSaved')}`);
1599
1602
  });
@@ -1660,7 +1663,6 @@ function handleCancelPartition() {
1660
1663
  target
1661
1664
  });
1662
1665
  if (target) {
1663
- setSelectedObject(target.object, target.node, target.component, target.type);
1664
1666
  if (currentPartitionData) {
1665
1667
  const currentPartition = currentPartitionData.children.find(child => child.uuid == target.object.object_data.uuid);
1666
1668
  const polyJson = typeof currentPartition.polygon_json === 'string' ? JSON.parse(currentPartition.polygon_json) : currentPartition.polygon_json;
@@ -1677,6 +1679,7 @@ function handleCancelPartition() {
1677
1679
  else {
1678
1680
  log.warn('currentPartitionData is undefined');
1679
1681
  }
1682
+ clearTempCurrentPolygon();
1680
1683
  clearPartitionForm();
1681
1684
  clearSelectedObject();
1682
1685
  toggleDisplayPane('at-cancel-room-form-btn');
@@ -1761,10 +1764,12 @@ function handleWallHeightInputChange() {
1761
1764
  if (!isNaN(newWallHeight) && Math.sign(newWallHeight) == 1) {
1762
1765
  setWallBaseHeight(newWallHeight);
1763
1766
  const objects = get3DXObjects();
1764
- const latestObj = objects[objects.length - 1];
1765
1767
  const currentPartitionData = getCurrentEditRoomData();
1766
- const currentPolygon = getCurrentPolygon();
1767
- log.info("latestObj ", latestObj);
1768
+ let currentPolygon = getCurrentPolygon();
1769
+ if (!currentPolygon && !currentPartitionData) {
1770
+ currentPolygon = getTempCurrentPolygon();
1771
+ }
1772
+ log.info("currentPolygon ", currentPolygon);
1768
1773
  log.info("wallHeight currentPartitionData ", currentPartitionData);
1769
1774
  log.info("wallHeight _3DXObjects ", _3DXObjects);
1770
1775
  if (currentPartitionData) {
@@ -1774,7 +1779,13 @@ function handleWallHeightInputChange() {
1774
1779
  log.info("target ", target);
1775
1780
  if (target) {
1776
1781
  setSelectedObject(target.object, target.node, target.component, target.type);
1777
- const polyJson = target.object.object_data.json_data;
1782
+ let polyJson = typeof target.object.object_data.json_data == 'string' ? JSON.parse(target.object.object_data.json_data) : target.object.object_data.json_data;
1783
+ if (!polyJson.walls || polyJson.walls.length <= 0) {
1784
+ const partition = currentPartitionData.children.find(child => child.uuid == target.object.object_data.uuid);
1785
+ if (partition) {
1786
+ polyJson = typeof partition.polygon_json == 'string' ? JSON.parse(partition.polygon_json) : partition.polygon_json;
1787
+ }
1788
+ }
1778
1789
  if (polyJson) {
1779
1790
  polyJson.walls[0].wall_height = newWallHeight;
1780
1791
  const payload = {
@@ -1800,7 +1811,7 @@ function handleWallHeightInputChange() {
1800
1811
  if (polyJson.walls && polyJson.walls.length > 0) {
1801
1812
  polyJson.walls[0].wall_height = newWallHeight;
1802
1813
  const payload = {
1803
- uuid: latestObj.object.object_data.uuid,
1814
+ uuid: currentPolygon.object.object_data.uuid,
1804
1815
  polygon_json: polyJson
1805
1816
  };
1806
1817
  renderPolygon(payload);
@@ -1813,7 +1824,7 @@ function handleWallHeightInputChange() {
1813
1824
  notyf.success(`${i18n.t('SuccessWallHeight')}`);
1814
1825
  }
1815
1826
  else {
1816
- log.warn("currentPartitionData and latestObj value is undefined or its type is not valid");
1827
+ log.warn("currentPartitionData and currentPolygon value is undefined or its type is not valid");
1817
1828
  }
1818
1829
  }
1819
1830
  else {
@@ -1887,13 +1898,11 @@ function handleMarkFloor() {
1887
1898
  });
1888
1899
  yield getTargetPosition((coord) => {
1889
1900
  const objects = get3DXObjects();
1890
- const latestObj = objects[objects.length - 1];
1891
1901
  const currentPartitionData = getCurrentEditRoomData();
1892
1902
  const currentPolygon = getCurrentPolygon();
1893
1903
  if (Math.sign(coord.y) == 1) {
1894
1904
  setFloorBaseHeight(coord.y);
1895
1905
  const adjustedHeight = getFloorBaseHeight();
1896
- log.info("latestObj ", latestObj);
1897
1906
  if (currentPartitionData) {
1898
1907
  let partitionsUUIDs = [];
1899
1908
  partitionsUUIDs = currentPartitionData.children.map(child => child.uuid);
@@ -1913,7 +1922,7 @@ function handleMarkFloor() {
1913
1922
  }
1914
1923
  else if (currentPolygon) {
1915
1924
  //setSelectedObject(currentPolygon.object,currentPolygon.node,currentPolygon.component,currentPolygon.type)
1916
- const polyJson = latestObj.object.object_data.json_data;
1925
+ const polyJson = currentPolygon.object.object_data.json_data;
1917
1926
  const updatedPath = polyJson.path.map(path => {
1918
1927
  path.y = adjustedHeight;
1919
1928
  return path;
@@ -1974,21 +1983,12 @@ function handleUndoDrawAction() {
1974
1983
  const undoBtn = document.getElementById('at-draw-undo-btn');
1975
1984
  undoBtn.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
1976
1985
  undoDrawAction();
1977
- setCurrentPartitionData();
1978
- const currentPolygon = getCurrentPolygon();
1979
- if (currentPolygon) {
1980
- if ((currentPolygon.object.object_data.json_data.path).length <= 3) {
1981
- setPreviousPartitionData(getCurrentPartitionData());
1982
- setCurrentPolygon(undefined);
1983
- }
1984
- }
1985
1986
  }));
1986
1987
  }
1987
1988
  function handleRedoDrawAction() {
1988
1989
  const redooBtn = document.getElementById('at-draw-redo-btn');
1989
1990
  redooBtn.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
1990
1991
  redoDrawAction();
1991
- setCurrentPartitionData();
1992
1992
  }));
1993
1993
  }
1994
1994
  export {
@@ -3,6 +3,7 @@ import { dispatchSpaceEvent, renderPolygon, getPolygonFloorOffset, getCurrentFlo
3
3
  import { SPACE_EVENTS } from "../types";
4
4
  import { getPolygonArea } from "../utils";
5
5
  import { PolygonCalculator, WallCalculator } from "../math";
6
+ import i18n from "../atwinui/components/toolbar/i18n";
6
7
  export class TubeLine {
7
8
  constructor(mpSdk) {
8
9
  this.time = 0;
@@ -533,10 +534,10 @@ export class BufferGeometry {
533
534
  const floorDimension = PolygonCalculator.calculatePolygonProperties(this.inputs.path);
534
535
  if (floorConfig && floorConfig.options) {
535
536
  floorMesh.visible = floorConfig.options.is_visible;
536
- if (floorConfig.options.is_visible == false) {
537
- floorDimension.area = 0;
538
- floorDimension.perimeter = 0;
539
- }
537
+ // if (floorConfig.options.is_visible == false) {
538
+ // floorDimension.area = 0
539
+ // floorDimension.perimeter = 0
540
+ // }
540
541
  }
541
542
  this.groupedMesh.add(floorMesh);
542
543
  const floorArea = getPolygonArea(this.inputs.path);
@@ -561,6 +562,9 @@ export class BufferGeometry {
561
562
  let totalWallArea = 0;
562
563
  let totalWallLength = 0;
563
564
  for (let index = 0; index < wallDataArray.length; index++) {
565
+ if (wallDataArray[index].options && wallDataArray[index].options.is_deleted) {
566
+ continue;
567
+ }
564
568
  if (this.inputs.excludeHiddenWallsFromCalculation && wallDataArray[index].options && wallDataArray[index].options.is_visible == false) {
565
569
  continue;
566
570
  }
@@ -670,9 +674,9 @@ export class BufferGeometry {
670
674
  const wallLength = new THREE.Vector3(endPoint.x - startPoint.x, endPoint.y - startPoint.y, endPoint.z - startPoint.z).length();
671
675
  const wallArea = wallLength * WALL_HEIGHT;
672
676
  // Create wall label
673
- const wallCanvas = this.createLabelCanvas(`Wall ${i + 1}: ${wallArea.toFixed(2)}m²`);
677
+ const wallCanvas = this.createLabelCanvas(`${i18n.t('Wall')} ${i + 1} (${i18n.t('Area')}): ${wallArea.toFixed(2)}m²`);
674
678
  // Create floor edge label
675
- const floorCanvas = this.createLabelCanvas(`Edge ${i + 1}: ${wallLength.toFixed(2)}m`);
679
+ const floorCanvas = this.createLabelCanvas(`${i18n.t('Wall')} ${i + 1} (${i18n.t('Edge')}): ${wallLength.toFixed(2)}m`);
676
680
  const midPoint = {
677
681
  x: (startPoint.x + endPoint.x) / 2,
678
682
  y: (startPoint.y + endPoint.y) / 2,
@@ -709,11 +713,23 @@ export class BufferGeometry {
709
713
  floorLabelMesh.name = this.inputs.uuid != '' ? `${this.inputs.uuid}_edgeLabel-${i}` : `edgeLabel-${i}`;
710
714
  const polyData = this.inputs.polygonData;
711
715
  const walls = polyData ? polyData.walls : this.inputs.wallData;
716
+ let wallDeleted;
712
717
  if (walls && walls.length > 0) {
713
718
  const wallData = walls.find((w) => w.index == i);
714
719
  if (wallData && wallData.options) {
715
- wallMesh.visible = wallData.options.is_visible;
716
- wallLabelMesh.visible = wallData.options.is_visible;
720
+ wallDeleted = wallData.options.is_deleted;
721
+ if (wallDeleted) {
722
+ wallMesh.visible = false;
723
+ wallLabelMesh.visible = false;
724
+ // @ts-ignore
725
+ wallMesh.deleted = true;
726
+ }
727
+ else {
728
+ wallMesh.visible = wallData.options.is_visible;
729
+ wallLabelMesh.visible = wallData.options.is_visible;
730
+ // @ts-ignore
731
+ wallMesh.deleted = false;
732
+ }
717
733
  }
718
734
  }
719
735
  const floorConfig = polyData ? polyData.floor : this.inputs.floorData;
@@ -744,7 +760,8 @@ export class BufferGeometry {
744
760
  options: {
745
761
  color: this.inputs.wallColor,
746
762
  opacity: this.inputs.wallOpacity,
747
- is_visible: wallMesh.visible
763
+ is_visible: wallMesh.visible,
764
+ is_deleted: wallDeleted
748
765
  },
749
766
  index: i,
750
767
  area: wallDimensions.area,
package/lib/types.d.ts CHANGED
@@ -1011,6 +1011,7 @@ export interface WallPolyData {
1011
1011
  color?: number | undefined;
1012
1012
  opacity?: number | undefined;
1013
1013
  is_visible?: boolean | undefined;
1014
+ is_deleted?: boolean | undefined;
1014
1015
  };
1015
1016
  area: number;
1016
1017
  perimeter: number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.10.0",
3
+ "version": "1.10.2",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",
@@ -109,6 +109,7 @@
109
109
  gap: var(--container-gap);
110
110
  flex-direction: column;
111
111
  margin: 2px;
112
+ pointer-events: auto;
112
113
  }
113
114
 
114
115
  .at_toolbar_sidebar_container {
@@ -120,6 +121,7 @@
120
121
  flex-direction: row;
121
122
  justify-content: flex-end;
122
123
  align-items: stretch;
124
+ pointer-events: none;
123
125
  }
124
126
 
125
127
  .at_toolbar_container {
@@ -134,6 +136,7 @@
134
136
  flex-direction: column;
135
137
  gap: var(--container-gap);
136
138
  margin: 2px;
139
+ pointer-events: auto;
137
140
  }
138
141
 
139
142
  .at_scrollable_container {
@@ -1283,7 +1286,7 @@
1283
1286
  }
1284
1287
 
1285
1288
  .at_vertex_list {
1286
- display: none;
1289
+ display: var(--container-display);
1287
1290
  flex-direction: column;
1288
1291
  border-radius: 4px;
1289
1292
  margin-bottom: 6px;