architwin 1.14.8 → 1.14.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.
@@ -27,7 +27,7 @@ export declare function displayChildPartitions(partitions: PartitionNode[], pare
27
27
  * @param partitionItems - The details of the partition items to be rendered.
28
28
  * @returns {HTMLElement}
29
29
  */
30
- export declare function displayPartitionItems(partitionItems: any, partitionId?: string, object?: any): string;
30
+ export declare function displayPartitionItems(partitionItems: any, partitionId?: string, object?: any, parentUuid?: string): string;
31
31
  export declare function updateParentVisibility(isPartition: boolean, currentBtn: HTMLElement): void;
32
32
  /**
33
33
  * Retrieves the stored room data.
@@ -68,3 +68,9 @@ export declare function setFilteredDisplay(type: String): void;
68
68
  * @param isVisible - Visibility value
69
69
  */
70
70
  export declare function updateRoomVisibilityUI(parentId: string, isVisible: boolean): void;
71
+ /**
72
+ * Highlights the selected child element within a partition by toggling CSS classes.
73
+ * @param partitionId - The unique identifier of the partition containing the child elements
74
+ * @param name - The specific name/identifier of the child element to highlight
75
+ */
76
+ export declare function highlightSelectedPartitionChild(partitionId: string, name: string): void;
@@ -10,9 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { getBundleVersion, extractUUID } from "../../../../utils";
11
11
  import { batchAddEventListenerByClassName, handleDeletePartition, handlePartitionVisibility, handlePolygonVisibility, toggleDisplayPane } from "../../../events";
12
12
  import i18n from "../i18n";
13
- import { getCurrentPolygonData, setPartitionFormMode } from "./roomFormPane";
13
+ import { getCurrentPolygonData, handlePartitionRowEditBtnClickEvent, handlePartitionWallEditBtn, setPartitionFormMode } from "./roomFormPane";
14
14
  import { SPACE_EVENTS } from "../../../../types";
15
- import { _3DXObjects, dispatchSpaceEvent, getChildrenOfModel, goToModel, renderPolygon, setSelectedObject } from "../../../../architwin";
15
+ import { _3DXObjects, dispatchSpaceEvent, getChildrenOfModel, goToModel, goToPosition, renderPolygon, setSelectedObject } from "../../../../architwin";
16
16
  import log from 'loglevel';
17
17
  import { getShortcutTooltipHTML } from "../static/common";
18
18
  let roomDataArray = [];
@@ -167,13 +167,13 @@ export function displayChildPartitions(partitions, parentPartitionId, objectData
167
167
  // Render floor
168
168
  const floorObj = modelChildren.find(item => item.name.includes('floor'));
169
169
  log.info("modelChildren floorObj: ", floorObj);
170
- childHTML += displayPartitionItems(polygonJson.floor, partition.uuid, floorObj);
170
+ childHTML += displayPartitionItems(polygonJson.floor, partition.uuid, floorObj, partition.parent_uuid);
171
171
  // Render walls
172
172
  if (polygonJson.walls.length > 0) {
173
173
  // modelChildren.splice(index, 1); // Remove processed child
174
174
  const wallObjs = modelChildren.filter(item => !item.name.includes("floor"));
175
175
  log.info("modelChildren wallObjs: ", wallObjs);
176
- childHTML += displayPartitionItems(polygonJson.walls, partition.uuid, wallObjs);
176
+ childHTML += displayPartitionItems(polygonJson.walls, partition.uuid, wallObjs, partition.parent_uuid);
177
177
  }
178
178
  }
179
179
  // @ts-ignore
@@ -203,7 +203,7 @@ export function displayChildPartitions(partitions, parentPartitionId, objectData
203
203
  * @param partitionItems - The details of the partition items to be rendered.
204
204
  * @returns {HTMLElement}
205
205
  */
206
- export function displayPartitionItems(partitionItems, partitionId, object) {
206
+ export function displayPartitionItems(partitionItems, partitionId, object, parentUuid) {
207
207
  log.info("__@ displayPartitionItems: ", object === null || object === void 0 ? void 0 : object.name);
208
208
  let itemsHTML = '';
209
209
  // Check if item is an array, e.g.: walls
@@ -219,9 +219,14 @@ export function displayPartitionItems(partitionItems, partitionId, object) {
219
219
  const isVisible = item.options.is_visible;
220
220
  const objName = object[index].name.includes('_') ? object[index].name : `${partitionId}_${object[index].name}`;
221
221
  log.info("__@ objName: ", objName);
222
+ const wallCoords = JSON.stringify(item.edges);
223
+ const wallCoordsEncoded = btoa(wallCoords);
222
224
  itemsHTML += `
223
- <li class="at_toggle">${i18n.t(`Wall`)} ${wallNumber}
224
- <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>
225
+ <li wall-coords="${wallCoordsEncoded}" object-name="${objName}" partition-li-id="${partitionId}" id="partition-child-${objName}" class="at_toggle at_partition_wall_row_item">${i18n.t(`Wall`)} ${wallNumber}
226
+ <div>
227
+ <span id="${objName}" partition-id="${partitionId}" partition-parent-uuid="${parentUuid}" polygon-item-id="${item.uuid}" is-wall="true" class="mdi mdi-pencil at_child_edit_btn"></span>
228
+ <span id="${objName}" partition-id="${partitionId}" polygon-item-id="${item.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn"></span>
229
+ </div>
225
230
  </li>
226
231
  `;
227
232
  }
@@ -231,10 +236,15 @@ export function displayPartitionItems(partitionItems, partitionId, object) {
231
236
  else {
232
237
  // This is for the floor
233
238
  const isVisible = partitionItems.options.is_visible;
239
+ const floorCoords = JSON.stringify(partitionItems.edges);
240
+ const floorCoordsEncoded = btoa(floorCoords);
234
241
  if (!partitionItems.hide) {
235
242
  itemsHTML += `
236
- <li class="at_toggle"> ${i18n.t(`Floor`)}
237
- <span id="${object.name}" partition-id="${partitionId}" polygon-item-id="${partitionItems.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn at_pull_right"></span>
243
+ <li floor-coords="${floorCoordsEncoded}" id="partition-child-${object.name}" object-name="${object.name}" partition-li-id="${partitionId}" class="at_toggle at_partition_floor_row_item"> ${i18n.t(`Floor`)}
244
+ <div>
245
+ <span id="${object}" partition-id="${partitionId}" partition-parent-uuid="${parentUuid}" polygon-item-id="${partitionItems.uuid}" class="mdi mdi-pencil at_child_edit_btn"></span>
246
+ <span id="${object.name}" partition-id="${partitionId}" polygon-item-id="${partitionItems.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn"></span>
247
+ </div>
238
248
  </li>
239
249
  `;
240
250
  }
@@ -331,6 +341,80 @@ function toggleSelectedPartition() {
331
341
  const target = event.target;
332
342
  handlePolygonVisibility(target.id);
333
343
  }));
344
+ batchAddEventListenerByClassName('at_partition_wall_row_item', (event) => __awaiter(this, void 0, void 0, function* () {
345
+ event.stopPropagation();
346
+ const target = event.target;
347
+ const partitionId = target.getAttribute('partition-li-id');
348
+ const objectName = target.getAttribute('object-name');
349
+ const wallCoordsEncoded = target.getAttribute('wall-coords');
350
+ const wallCoordsJSON = atob(wallCoordsEncoded);
351
+ const wallCoords = JSON.parse(wallCoordsJSON);
352
+ const wallBottomMidPoint = {
353
+ x: ((wallCoords[0].start.x + wallCoords[1].start.x + wallCoords[2].start.x + wallCoords[3].start.x) / 4),
354
+ y: ((wallCoords[0].start.y + wallCoords[1].start.y + wallCoords[2].start.y + wallCoords[3].start.y) / 4),
355
+ z: ((wallCoords[0].start.z + wallCoords[1].start.z + wallCoords[2].start.z + wallCoords[3].start.z) / 4),
356
+ };
357
+ try {
358
+ yield goToPosition(wallBottomMidPoint);
359
+ highlightSelectedPartitionChild(partitionId, objectName);
360
+ }
361
+ catch (e) {
362
+ log.info('goToPosition failed: ', e);
363
+ }
364
+ }));
365
+ batchAddEventListenerByClassName('at_partition_floor_row_item', (event) => __awaiter(this, void 0, void 0, function* () {
366
+ event.stopPropagation();
367
+ const target = event.target;
368
+ const partitionId = target.getAttribute('partition-li-id');
369
+ const objectName = target.getAttribute('object-name');
370
+ const floorCoordsEncoded = target.getAttribute('floor-coords');
371
+ const floorCoordsJSON = atob(floorCoordsEncoded);
372
+ const floorCoords = JSON.parse(floorCoordsJSON);
373
+ const wallBottomMidPoint = {
374
+ x: ((floorCoords[0].start.x + floorCoords[1].start.x + floorCoords[2].start.x) / 3),
375
+ y: ((floorCoords[0].start.y + floorCoords[1].start.y + floorCoords[2].start.y) / 3),
376
+ z: ((floorCoords[0].start.z + floorCoords[1].start.z + floorCoords[2].start.z) / 3),
377
+ };
378
+ try {
379
+ yield goToPosition(wallBottomMidPoint);
380
+ highlightSelectedPartitionChild(partitionId, objectName);
381
+ }
382
+ catch (e) {
383
+ log.info('goToPosition failed: ', e);
384
+ }
385
+ }));
386
+ batchAddEventListenerByClassName('at_child_edit_btn', (event) => __awaiter(this, void 0, void 0, function* () {
387
+ var _a;
388
+ const target = event.target;
389
+ const isWall = ((_a = target.getAttribute('is-wall')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
390
+ const partitionId = target.getAttribute('partition-id');
391
+ const parentRoomUuid = target.getAttribute('partition-parent-uuid');
392
+ const parentRoom = document.getElementById(`at-room-edit-${parentRoomUuid}-btn`);
393
+ function openRoomEdit() {
394
+ highlightSelectedItem({ target: parentRoom });
395
+ setPartitionFormMode("EDIT" /* FORM_MODE.EDIT */);
396
+ setCurrentEditRoomData(`at-room-edit-${parentRoomUuid}-btn`);
397
+ toggleDisplayPane(`at-room-edit-${parentRoomUuid}-btn`);
398
+ }
399
+ if (parentRoom) {
400
+ openRoomEdit();
401
+ const partitionRowEdit = document.getElementById(`at-edit-partition-${partitionId}`);
402
+ if (partitionRowEdit) {
403
+ const currentEditRoomData = getCurrentEditRoomData();
404
+ handlePartitionRowEditBtnClickEvent(currentEditRoomData.children, partitionRowEdit);
405
+ if (isWall) {
406
+ const polygonId = target.getAttribute('polygon-item-id');
407
+ handlePartitionWallEditBtn(polygonId);
408
+ }
409
+ }
410
+ else {
411
+ log.warn('Partition row edit element not found');
412
+ }
413
+ }
414
+ else {
415
+ log.warn('Partition room element not found');
416
+ }
417
+ }));
334
418
  batchAddEventListenerByClassName('at_room_delete_btn', (event) => __awaiter(this, void 0, void 0, function* () {
335
419
  const target = event.target;
336
420
  handleDeletePartition(target.id);
@@ -581,3 +665,14 @@ export function updateRoomVisibilityUI(parentId, isVisible) {
581
665
  toggleVisibilityState(roomElement, true);
582
666
  }
583
667
  }
668
+ /**
669
+ * Highlights the selected child element within a partition by toggling CSS classes.
670
+ * @param partitionId - The unique identifier of the partition containing the child elements
671
+ * @param name - The specific name/identifier of the child element to highlight
672
+ */
673
+ export function highlightSelectedPartitionChild(partitionId, name) {
674
+ const partitionChildren = document.querySelectorAll(`li[partition-li-id="${partitionId}"]`);
675
+ partitionChildren.forEach(el => {
676
+ el.classList.toggle('selected', el.id === `partition-child-${name}`);
677
+ });
678
+ }
@@ -23,8 +23,8 @@ import { isValidUrl, debounce, isElementVisible, extractUUID, showLoader, isVec3
23
23
  import log from 'loglevel';
24
24
  import * as minimap from '../minimap';
25
25
  import { clearActiveThemeCard, getSelectedTheme } from "./components/toolbar/themePane";
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, getTempCurrentPolygon, clearTempCurrentPolygon } from "./components/toolbar/spacePartition/roomFormPane";
26
+ import { getCurrentEditRoomData, displayRoomTree, updatePartitionVisibilityUI, getSelectedPartitionId, updatePolygonVisibilityData, toggleVisibilityState, setFilteredDisplay, updateRoomVisibilityUI, highlightSelectedPartitionChild } from "./components/toolbar/spacePartition/roomTreePane";
27
+ import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setCurrentPartitionData, getCurrentPartitionData, getTempCurrentPolygon, clearTempCurrentPolygon, toggleDrawWindowButton, getDrawingMode } from "./components/toolbar/spacePartition/roomFormPane";
28
28
  import { actionSettingsSelectOption, getTempCoordinateSystem, getTempMeasurementUnit, getTempRotationUnit, setCoordinateSystem, setMeasurementUnit, setRotationUnit, initSettingsValues, setTempCoordinateSystem, setTempMeasurementUnit, setTempRotationUnit, toggleActionSettingsDropdown, toggleCalibrateBasepoint, setScaleFactor, getTempScaleFactor, setTempScaleFactor, setBasepoint, getTempBasepoint, setTempBasepoint, getBasepoint, toggleActionSettings, getBasepointObjectPayload, displayConvertedCoordinates, getCoordinateSystem, getScaleFactor, getMeasurementUnit, getRotationUnit, setBasepointObjectPayload } from "./components/toolbar/actionSettingsPane";
29
29
  import { getBasepointCalibrateBpCoordinateValues, getBasepointCalibrateMpCoordinateValues, initBsepointCalibratePane, toggleBasepointCalibratePane } from "./components/toolbar/basepointCalibratePane";
30
30
  import { toggleGeneralMapOptions, initGeneralSelectedMap, getSelectedMapOption } from './components/toolbar/generalSettingsMenuPane';
@@ -415,6 +415,7 @@ function setupIndividualEventListeners() {
415
415
  handleSaveTheme();
416
416
  handlePartitionDisplay();
417
417
  handleDrawPartition();
418
+ handleDrawWindow();
418
419
  handleSavePartition();
419
420
  // handleDeletePartition()
420
421
  handleCancelPartition();
@@ -1432,12 +1433,25 @@ function setupSpaceEventSubscriptions() {
1432
1433
  subscribeSpaceEvent(SPACE_EVENTS.DRAW_HISTORY, handleDrawHistory);
1433
1434
  subscribeSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_UPLOADED, handleCustomMapFloorImageUploaded);
1434
1435
  subscribeSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_UPLOAD_FAILED, handleCustomMapFloorUploadFailed);
1435
- subscribeSpaceEvent(SPACE_EVENTS.PATH_UPDATED, handlePathUpdated);
1436
- subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_USERS_UPDATE, handleScreenShareUsersUpdated);
1436
+ subscribeSpaceEvent(SPACE_EVENTS.PATH_UPDATED, handlePathUpdated),
1437
+ subscribeSpaceEvent(SPACE_EVENTS.PARTITION_COLLIDER_CLICKED, handlePartitionColiderClickSelected),
1438
+ subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_USERS_UPDATE, handleScreenShareUsersUpdated);
1437
1439
  subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_HOST_END_SESSION, handleScreenShareEndSessionEvent);
1438
1440
  subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_ACCEPT_REQUEST, handleScreenShareAcceptRequest);
1439
1441
  subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_BACK_USER_LIST_PANE, handleScreenShareBackUserListPane);
1440
1442
  }
1443
+ function handlePartitionColiderClickSelected(payload) {
1444
+ return __awaiter(this, void 0, void 0, function* () {
1445
+ const partitionId = payload.collider.name.split('_')[0];
1446
+ if ((activePane === null || activePane === void 0 ? void 0 : activePane.getAttribute('id')) !== 'at-room-tree-pane') {
1447
+ yield toggleDisplayPane('at-room-creation-btn');
1448
+ }
1449
+ else {
1450
+ yield new Promise(resolve => requestAnimationFrame(resolve));
1451
+ }
1452
+ highlightSelectedPartitionChild(partitionId, payload.collider.name);
1453
+ });
1454
+ }
1441
1455
  function handleDragEnd(payload) {
1442
1456
  console.log("handleDragEnd payload", payload);
1443
1457
  if (isToolbarFeatureEnabled('bim')) {
@@ -1513,9 +1527,14 @@ function handleDrawHistory(payload) {
1513
1527
  function handleVertexPlace(payload) {
1514
1528
  console.log("handleVertexPlace ==>", payload);
1515
1529
  if (isToolbarFeatureEnabled('roomCreation')) {
1530
+ log.info("getDrawingMode()", getDrawingMode());
1531
+ if (getDrawingMode() === 'window') {
1532
+ }
1533
+ if (getDrawingMode() === 'partition') {
1534
+ // setCurrentPartitionData()
1535
+ }
1516
1536
  const undoBtn = document.getElementById('at-draw-undo-btn');
1517
1537
  undoBtn.classList.remove('at_disabled');
1518
- setCurrentPartitionData();
1519
1538
  const redoBtn = document.getElementById('at-draw-redo-btn');
1520
1539
  redoBtn.classList.add('at_disabled');
1521
1540
  }
@@ -2019,6 +2038,18 @@ function handleDrawPartition() {
2019
2038
  toggleDrawPartitionButton();
2020
2039
  });
2021
2040
  }
2041
+ function handleDrawWindow() {
2042
+ log.info("__@ handleDrawWindow()");
2043
+ const addDoorButton = document.getElementById('at-add-window-door-btn');
2044
+ addDoorButton.addEventListener('click', () => {
2045
+ toggleDrawWindowButton();
2046
+ });
2047
+ }
2048
+ function handleSaveWindow() {
2049
+ log.info("handleSaveWindow()");
2050
+ const currentPartitionData = getCurrentPartitionData();
2051
+ dispatchSpaceEvent(SPACE_EVENTS.PARTITION_EDITED, { data: currentPartitionData });
2052
+ }
2022
2053
  function handleSavePartition() {
2023
2054
  log.info("__@ handleSavePartition()");
2024
2055
  const saveRoomBtn = document.getElementById('at-save-room-btn');
@@ -1,6 +1,6 @@
1
1
  import { MpSdk } from "../../bundle/sdk";
2
2
  import { Pane } from 'tweakpane';
3
- import { EdgePolyData, WallPolyData } from "../types";
3
+ import { EdgePolyData, PolygonData, WallPolyData, WindowPolyData } from "../types";
4
4
  export declare class TubeLine {
5
5
  mpSdk: MpSdk;
6
6
  mesh: THREE.Mesh;
@@ -39,7 +39,11 @@ export declare class TubeLine {
39
39
  scrollSpeed: number;
40
40
  collider: boolean;
41
41
  visible: boolean;
42
+ drawingMode: string;
43
+ targetIndex: any;
44
+ polygonData: any;
42
45
  renderPolygonOnAdd: boolean;
46
+ targetUUID: any;
43
47
  };
44
48
  outputs: Record<string, unknown> & MpSdk.Scene.PredefinedOutputs;
45
49
  context: MpSdk.Scene.IComponentContext;
@@ -119,6 +123,7 @@ export declare class BufferGeometry {
119
123
  floorName: string;
120
124
  floorColor: number;
121
125
  wallColor: number;
126
+ windowColor: number;
122
127
  floorOpacity: number;
123
128
  wallOpacity: number;
124
129
  visible: boolean;
@@ -128,6 +133,10 @@ export declare class BufferGeometry {
128
133
  excludeHiddenWallsFromCalculation: boolean;
129
134
  wallHeight: number;
130
135
  floorLevel: any;
136
+ drawingMode: string;
137
+ windowData: any;
138
+ targetIndex: any;
139
+ targetUUID: any;
131
140
  };
132
141
  outputs: Record<string, unknown> & MpSdk.Scene.PredefinedOutputs;
133
142
  context: MpSdk.Scene.IComponentContext;
@@ -147,9 +156,10 @@ export declare class BufferGeometry {
147
156
  onInit: () => void;
148
157
  onTick: (delta: any) => void;
149
158
  onDestroy(): void;
150
- renderWall(): void;
151
159
  createLabelCanvas(text: string): HTMLCanvasElement;
152
- renderWalls(WALL_HEIGHT: number): (WallPolyData[] | EdgePolyData[])[];
160
+ renderWindow(WALL_HEIGHT: number): void;
161
+ renderWalls(WALL_HEIGHT: number, metadata?: PolygonData): (WallPolyData[] | EdgePolyData[])[];
162
+ renderWindows(windows: WindowPolyData[]): void;
153
163
  renderPolygon: () => void;
154
164
  }
155
165
  export declare const bufferGeometryType = "bufferGeometry";