architwin 1.14.12 → 1.14.14

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.
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { getBundleVersion, extractUUID } from "../../../../utils";
11
- import { batchAddEventListenerByClassName, handleDeletePartition, handlePartitionVisibility, handlePolygonVisibility, toggleDisplayPane } from "../../../events";
11
+ import { batchAddEventListenerByClassName, handleDeletePartition, handlePartitionVisibility, handlePolygonVisibility, handleWindowVisibility, toggleDisplayPane } from "../../../events";
12
12
  import i18n from "../i18n";
13
13
  import { getCurrentPolygonData, handlePartitionRowEditBtnClickEvent, handlePartitionWallEditBtn, setPartitionFormMode } from "./roomFormPane";
14
14
  import { SPACE_EVENTS } from "../../../../types";
@@ -209,23 +209,33 @@ export function displayPartitionItems(partitionItems, partitionId, object, paren
209
209
  // Check if item is an array, e.g.: walls
210
210
  if (Array.isArray(partitionItems)) {
211
211
  // This is for the walls
212
- partitionItems.forEach((item, index) => {
213
- log.info("__@ partition item: ", item);
214
- if (!item.options.is_deleted) {
215
- if (!item.hide) {
212
+ partitionItems.forEach((wall, index) => {
213
+ log.info("__@ partition item: ", wall);
214
+ if (!wall.options.is_deleted) {
215
+ if (!wall.hide) {
216
216
  // Split wall name to localize
217
- const match = item.name.match(/wall-(\d+)$/);
217
+ const match = wall.name.match(/wall-(\d+)$/);
218
218
  const wallNumber = parseInt(match[1]) + 1;
219
- const isVisible = item.options.is_visible;
219
+ const isVisible = wall.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);
222
+ const wallCoords = JSON.stringify(wall.edges);
223
223
  const wallCoordsEncoded = btoa(wallCoords);
224
+ const childHTML = displayWindows(wall, partitionId, parentUuid);
225
+ const haveWindows = Array.isArray(wall === null || wall === void 0 ? void 0 : wall.windows) && (wall === null || wall === void 0 ? void 0 : wall.windows.length) > 0;
224
226
  itemsHTML += `
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>
227
+ <li wall-coords="${wallCoordsEncoded}" object-id="${wall.uuid}" object-name="${objName}" partition-li-id="${partitionId}" id="partition-child-${objName}" class="at_partition_wall_row_item">
228
+ <div class="at_partition_child_header">
229
+ <div class="at_partition_child_title">
230
+ <span class="at_partition_child_expand_icon">${haveWindows ? '' : ''} </span> ${i18n.t(`Wall`)} ${wallNumber}
231
+ </div>
232
+ <div>
233
+ <span partition-id="${partitionId}" partition-parent-uuid="${parentUuid}" polygon-item-id="${wall.uuid}" is-wall="true" class="mdi mdi-pencil at_child_edit_btn"></span>
234
+ <span id="${objName}" partition-parent-uuid partition-id="${partitionId}" polygon-item-id="${wall.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn"></span>
235
+ </div>
236
+ </div>
237
+ <div class="at_wall_children_container at_hidden">
238
+ ${childHTML}
229
239
  </div>
230
240
  </li>
231
241
  `;
@@ -240,10 +250,13 @@ export function displayPartitionItems(partitionItems, partitionId, object, paren
240
250
  const floorCoordsEncoded = btoa(floorCoords);
241
251
  if (!partitionItems.hide) {
242
252
  itemsHTML += `
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>
253
+ <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">
254
+ <div class="at_partition_child_header">
255
+ <div>${i18n.t(`Floor`)}</div>
256
+ <div>
257
+ <span partition-id="${partitionId}" partition-parent-uuid="${parentUuid}" polygon-item-id="${partitionItems.uuid}" class="mdi mdi-pencil at_child_edit_btn"></span>
258
+ <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>
259
+ </div>
247
260
  </div>
248
261
  </li>
249
262
  `;
@@ -339,24 +352,29 @@ function toggleSelectedPartition() {
339
352
  }));
340
353
  batchAddEventListenerByClassName('at_child_visible_btn', (event) => __awaiter(this, void 0, void 0, function* () {
341
354
  const target = event.target;
342
- handlePolygonVisibility(target.id);
355
+ const li = target.closest('li');
356
+ if (li === null || li === void 0 ? void 0 : li.getAttribute('id').toLowerCase().includes('window')) {
357
+ event.stopPropagation();
358
+ handleWindowVisibility(target);
359
+ }
360
+ else {
361
+ handlePolygonVisibility(target.id);
362
+ }
343
363
  }));
344
364
  batchAddEventListenerByClassName('at_partition_wall_row_item', (event) => __awaiter(this, void 0, void 0, function* () {
345
365
  event.stopPropagation();
346
- const target = event.target;
366
+ const target = event.currentTarget;
347
367
  const partitionId = target.getAttribute('partition-li-id');
348
368
  const objectName = target.getAttribute('object-name');
349
369
  const wallCoordsEncoded = target.getAttribute('wall-coords');
350
370
  const wallCoordsJSON = atob(wallCoordsEncoded);
351
371
  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
372
  try {
373
+ const wallBottomMidPoint = calculateMidPoint(wallCoords);
358
374
  yield goToPosition(wallBottomMidPoint);
359
375
  highlightSelectedPartitionChild(partitionId, objectName);
376
+ toggleHighlightedWindowItem();
377
+ toggeleExpandParitionWallChild(partitionId, objectName);
360
378
  }
361
379
  catch (e) {
362
380
  log.info('goToPosition failed: ', e);
@@ -364,19 +382,15 @@ function toggleSelectedPartition() {
364
382
  }));
365
383
  batchAddEventListenerByClassName('at_partition_floor_row_item', (event) => __awaiter(this, void 0, void 0, function* () {
366
384
  event.stopPropagation();
367
- const target = event.target;
385
+ const target = event.currentTarget;
368
386
  const partitionId = target.getAttribute('partition-li-id');
369
387
  const objectName = target.getAttribute('object-name');
370
388
  const floorCoordsEncoded = target.getAttribute('floor-coords');
371
389
  const floorCoordsJSON = atob(floorCoordsEncoded);
372
390
  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
391
  try {
379
- yield goToPosition(wallBottomMidPoint);
392
+ const floorMidPoint = calculateMidPoint(floorCoords);
393
+ yield goToPosition(floorMidPoint);
380
394
  highlightSelectedPartitionChild(partitionId, objectName);
381
395
  }
382
396
  catch (e) {
@@ -385,40 +399,53 @@ function toggleSelectedPartition() {
385
399
  }));
386
400
  batchAddEventListenerByClassName('at_child_edit_btn', (event) => __awaiter(this, void 0, void 0, function* () {
387
401
  var _a;
402
+ event.stopPropagation();
388
403
  const target = event.target;
389
404
  const isWall = ((_a = target.getAttribute('is-wall')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
390
405
  const partitionId = target.getAttribute('partition-id');
391
406
  const parentRoomUuid = target.getAttribute('partition-parent-uuid');
392
407
  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
- yield 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
- }
408
+ yield openPartitionChildEdit(target, parentRoom, parentRoomUuid, partitionId, isWall);
417
409
  }));
418
410
  batchAddEventListenerByClassName('at_room_delete_btn', (event) => __awaiter(this, void 0, void 0, function* () {
419
411
  const target = event.target;
420
412
  handleDeletePartition(target.id);
421
413
  }));
414
+ batchAddEventListenerByClassName('at_window_edit_btn', (event) => __awaiter(this, void 0, void 0, function* () {
415
+ event.stopPropagation();
416
+ const targetElement = event.target;
417
+ const partitionId = targetElement.getAttribute('partition-id');
418
+ const parentRoomUuid = targetElement.getAttribute('partition-parent-uuid');
419
+ const parentRoom = document.getElementById(`at-room-edit-${parentRoomUuid}-btn`);
420
+ const windowCoordsEncoded = targetElement.getAttribute('window-coords');
421
+ const windowCoordsJSON = atob(windowCoordsEncoded);
422
+ const windowCoords = JSON.parse(windowCoordsJSON);
423
+ try {
424
+ const windowBottomMidPoint = calculateMidPoint(windowCoords);
425
+ yield goToPosition(windowBottomMidPoint);
426
+ yield openWindowEdit(targetElement, parentRoom, parentRoomUuid, partitionId);
427
+ }
428
+ catch (e) {
429
+ log.info('goToPosition failed: ', e);
430
+ }
431
+ }));
432
+ batchAddEventListenerByClassName('at_wall_window_row_item', (event) => __awaiter(this, void 0, void 0, function* () {
433
+ event.stopPropagation();
434
+ const targetElement = event.currentTarget;
435
+ const wallUuid = targetElement.getAttribute('wall-id');
436
+ const windowIndex = targetElement.getAttribute('window-index');
437
+ const windowCoordsEncoded = targetElement.getAttribute('window-coords');
438
+ const windowCoordsJSON = atob(windowCoordsEncoded);
439
+ const windowCoords = JSON.parse(windowCoordsJSON);
440
+ try {
441
+ const windowBottomMidPoint = calculateMidPoint(windowCoords);
442
+ yield goToPosition(windowBottomMidPoint);
443
+ highlightSelectedWallWindow(wallUuid, windowIndex);
444
+ }
445
+ catch (e) {
446
+ log.info('goToPosition failed: ', e);
447
+ }
448
+ }));
422
449
  }
423
450
  /**
424
451
  * Highlights the selected item based on the triggered event.
@@ -666,13 +693,148 @@ export function updateRoomVisibilityUI(parentId, isVisible) {
666
693
  }
667
694
  }
668
695
  /**
669
- * Highlights the selected child element within a partition by toggling CSS classes.
696
+ * Highlights the selected child element and toggle expand indicator within a partition by toggling CSS classes.
670
697
  * @param partitionId - The unique identifier of the partition containing the child elements
671
698
  * @param name - The specific name/identifier of the child element to highlight
672
699
  */
673
700
  export function highlightSelectedPartitionChild(partitionId, name) {
674
701
  const partitionChildren = document.querySelectorAll(`li[partition-li-id="${partitionId}"]`);
675
- partitionChildren.forEach(el => {
676
- el.classList.toggle('selected', el.id === `partition-child-${name}`);
702
+ const targetId = `partition-child-${name}`;
703
+ partitionChildren.forEach((partitionChild) => {
704
+ const isSelected = partitionChild.id === targetId;
705
+ const header = partitionChild.querySelector('.at_partition_child_header');
706
+ if (header) {
707
+ header.classList.toggle('selected', isSelected);
708
+ const arrow = header.querySelector('.at_partition_child_expand_icon');
709
+ if (arrow && arrow.textContent) {
710
+ // Use replace to only affect elements that have arrows
711
+ if (isSelected) {
712
+ arrow.textContent = arrow.textContent.replace('▶', '▼');
713
+ }
714
+ else {
715
+ arrow.textContent = arrow.textContent.replace('▼', '▶');
716
+ }
717
+ }
718
+ }
677
719
  });
678
720
  }
721
+ export function toggeleExpandParitionWallChild(partitionId, name) {
722
+ const partitionChildren = document.querySelectorAll(`li[partition-li-id="${partitionId}"]`);
723
+ const targetId = `partition-child-${name}`;
724
+ partitionChildren.forEach((partitionChild) => {
725
+ const isSelected = partitionChild.id === targetId;
726
+ const listContainer = partitionChild.querySelector('.at_wall_children_container');
727
+ if (listContainer) {
728
+ if (isSelected) {
729
+ listContainer.classList.toggle('at_hidden');
730
+ }
731
+ else {
732
+ listContainer.classList.add('at_hidden');
733
+ }
734
+ }
735
+ });
736
+ }
737
+ function displayWindows(wall, partitionId, parentId) {
738
+ const windows = wall.windows;
739
+ let itemsHTML = '';
740
+ if (Array.isArray(windows)) {
741
+ windows.forEach((window) => {
742
+ if (!window.options.is_deleted) {
743
+ const windowCoords = JSON.stringify(window.edges);
744
+ const windowCoordsEncoded = btoa(windowCoords);
745
+ itemsHTML += `
746
+ <li window-coords="${windowCoordsEncoded}" id="window-${wall.uuid}-${window.index}" wall-id="${wall.uuid}" window-name="${window.name}" window-index="${window.index}" class="at_wall_window_row_item">
747
+ <div>${window.name}</div>
748
+ <div>
749
+ <span window-coords="${windowCoordsEncoded}" partition-id="${partitionId}" partition-parent-uuid="${parentId}" polygon-item-id="${wall.uuid}" index="${window.index}" class="mdi mdi-pencil at_window_edit_btn"></span>
750
+ <span id="${window.name}" partition-id="${partitionId}" partition-parent-uuid="${parentId}" polygon-item-id="${wall.uuid}" class="mdi ${window.options.is_visible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn"></span>
751
+ </div>
752
+ </li>
753
+ `;
754
+ }
755
+ });
756
+ }
757
+ return itemsHTML;
758
+ }
759
+ function openRoomEdit(parentRoomElement, parentRoomUuid) {
760
+ highlightSelectedItem({ target: parentRoomElement });
761
+ setPartitionFormMode("EDIT" /* FORM_MODE.EDIT */);
762
+ setCurrentEditRoomData(`at-room-edit-${parentRoomUuid}-btn`);
763
+ toggleDisplayPane(`at-room-edit-${parentRoomUuid}-btn`);
764
+ }
765
+ function openPartitionChildEdit(targetElement, parentRoomElement, parentRoomUuid, partitionId, isWall) {
766
+ return __awaiter(this, void 0, void 0, function* () {
767
+ if (parentRoomElement) {
768
+ openRoomEdit(parentRoomElement, parentRoomUuid);
769
+ const partitionRowEdit = document.getElementById(`at-edit-partition-${partitionId}`);
770
+ if (partitionRowEdit) {
771
+ const currentEditRoomData = getCurrentEditRoomData();
772
+ handlePartitionRowEditBtnClickEvent(currentEditRoomData.children, partitionRowEdit);
773
+ if (isWall) {
774
+ const polygonId = targetElement.getAttribute('polygon-item-id');
775
+ yield handlePartitionWallEditBtn(polygonId);
776
+ }
777
+ }
778
+ else {
779
+ log.warn('Partition row edit element not found');
780
+ }
781
+ }
782
+ else {
783
+ log.warn('Partition room element not found');
784
+ }
785
+ });
786
+ }
787
+ function openWindowEdit(targetElement, parentRoomElement, parentRoomUuid, partitionId) {
788
+ return __awaiter(this, void 0, void 0, function* () {
789
+ const index = targetElement.getAttribute('index');
790
+ yield openPartitionChildEdit(targetElement, parentRoomElement, parentRoomUuid, partitionId, true);
791
+ yield new Promise(resolve => requestAnimationFrame(resolve));
792
+ const editBtn = document.querySelector(`#at-edit-window-btn-${index}`);
793
+ const editNameContainer = document.querySelector(`.at_edit_name#at-edit-window-name-${index}`);
794
+ const inputName = document.querySelector(`#at-edit-window-name-input-${index}`);
795
+ const editMaterialContainer = document.querySelector(`.at_edit_material#at-edit-window-material-${index}`);
796
+ const confirmBtn = document.querySelector(`#at-confirm-edit-window-${index}`);
797
+ if (!editBtn || !editNameContainer || !inputName || !editMaterialContainer) {
798
+ log.warn('Elements for Window edit not found');
799
+ }
800
+ else {
801
+ editNameContainer.style.display = "flex";
802
+ editMaterialContainer.style.display = "flex";
803
+ editBtn.style.display = "none";
804
+ confirmBtn.style.display = "flex";
805
+ inputName.focus();
806
+ }
807
+ });
808
+ }
809
+ export function highlightSelectedWallWindow(wallUuid, index) {
810
+ const wallWindow = document.querySelectorAll(`li[wall-id="${wallUuid}"]`);
811
+ const targetId = `window-${wallUuid}-${index}`;
812
+ wallWindow.forEach((windowElement) => {
813
+ windowElement.classList.toggle('selected', windowElement.id === targetId);
814
+ });
815
+ }
816
+ export function toggleHighlightedPartitionItem() {
817
+ const windowItems = document.querySelectorAll('li.at_wall_window_row_item.selected');
818
+ windowItems.forEach(el => {
819
+ el.classList.remove('selected');
820
+ });
821
+ }
822
+ export function toggleHighlightedWindowItem() {
823
+ const windowItems = document.querySelectorAll('li.at_wall_window_row_item.selected');
824
+ windowItems.forEach(el => {
825
+ el.classList.remove('selected');
826
+ });
827
+ }
828
+ export function calculateMidPoint(coords) {
829
+ const count = coords.length;
830
+ const sum = coords.reduce((acc, coord) => ({
831
+ x: acc.x + coord.start.x,
832
+ y: acc.y + coord.start.y,
833
+ z: acc.z + coord.start.z
834
+ }), { x: 0, y: 0, z: 0 });
835
+ return {
836
+ x: sum.x / count,
837
+ y: sum.y / count,
838
+ z: sum.z / count
839
+ };
840
+ }
@@ -43,4 +43,5 @@ declare function handleDeletePartition(targetId: string): void;
43
43
  * Handles the display logic for showing the custom minimap.
44
44
  */
45
45
  declare function handleShowCustomMinimap(): void;
46
- export { activeToolbarItem, activeActionItem, cancelModelPlacementPrompt, isCustomMapControlsVisible, pipeColor, batchAddEventListenerById, batchAddEventListenerByClassName, batchAddEventListenerByClassNames, batchAddEventListenerByDataAttribute, setActiveToolbarItem, toggleDisplayPane, toggleActionBar, setupIndividualEventListeners, setupSpaceEventSubscriptions, handleModelVisibility, handleDeleteModel, handleShowMinimap, handleScrollToView, handleRenderMeetingUI, handleShowCustomMinimap, handlePartitionVisibility, handlePolygonVisibility, handleDeletePartition, };
46
+ declare function handleWindowVisibility(visibilityBtn: HTMLElement): Promise<void>;
47
+ export { activeToolbarItem, activeActionItem, cancelModelPlacementPrompt, isCustomMapControlsVisible, pipeColor, batchAddEventListenerById, batchAddEventListenerByClassName, batchAddEventListenerByClassNames, batchAddEventListenerByDataAttribute, setActiveToolbarItem, toggleDisplayPane, toggleActionBar, setupIndividualEventListeners, setupSpaceEventSubscriptions, handleModelVisibility, handleDeleteModel, handleShowMinimap, handleScrollToView, handleRenderMeetingUI, handleShowCustomMinimap, handlePartitionVisibility, handlePolygonVisibility, handleDeletePartition, handleWindowVisibility, };
@@ -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, clearActiveMenu, 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, _modelDetails, actionHistory, get3DXObjects, transformHistory, goToModel, themeManager, _partitionNodes, setSpacePartitionNodes, getSpaceId, setFloorBaseHeight, toggleWallVisibility, getChildrenOfModel, toggleFloorVisibility, renderPolygon, getCurrentPolygon, getFloorBaseHeight, setSelectedObject, redoDrawAction, undoDrawAction, setWallBaseHeight, clearWallBaseHeight, clearFloorBaseHeight, isToolbarFeatureEnabled, captureCurrentView, getCurrentFloor, _spaceUsers, setPipeCategories, setPipes, detachTagMedia, getTagDataCollection, setVertexPath, _screenSharingHostUser } 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, _modelDetails, actionHistory, get3DXObjects, transformHistory, goToModel, themeManager, _partitionNodes, setSpacePartitionNodes, getSpaceId, setFloorBaseHeight, toggleWallVisibility, getChildrenOfModel, toggleFloorVisibility, renderPolygon, getCurrentPolygon, getFloorBaseHeight, setSelectedObject, redoDrawAction, undoDrawAction, setWallBaseHeight, clearWallBaseHeight, clearFloorBaseHeight, isToolbarFeatureEnabled, captureCurrentView, getCurrentFloor, _spaceUsers, setPipeCategories, setPipes, detachTagMedia, getTagDataCollection, setVertexPath, _screenSharingHostUser, toggleMeshChildrenVisibility } from "../architwin";
12
12
  import { Notyf } from 'notyf';
13
13
  import 'notyf/notyf.min.css';
14
14
  import { SPACE_EVENTS, COORDINATE_SYSTEM, UNITS, DEGREE, MAP_OPTIONS, sortTagOptions, sortObjectOptions, CUSTOM_MAP_MODE } from "../types";
@@ -23,7 +23,7 @@ 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, highlightSelectedPartitionChild } from "./components/toolbar/spacePartition/roomTreePane";
26
+ import { getCurrentEditRoomData, displayRoomTree, updatePartitionVisibilityUI, getSelectedPartitionId, updatePolygonVisibilityData, toggleVisibilityState, setFilteredDisplay, updateRoomVisibilityUI, highlightSelectedPartitionChild, highlightSelectedWallWindow } from "./components/toolbar/spacePartition/roomTreePane";
27
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";
@@ -1443,14 +1443,21 @@ function setupSpaceEventSubscriptions() {
1443
1443
  }
1444
1444
  function handlePartitionColiderClickSelected(payload) {
1445
1445
  return __awaiter(this, void 0, void 0, function* () {
1446
- const partitionId = payload.collider.name.split('_')[0];
1446
+ const polygonId = extractUUID(payload.collider.name);
1447
+ const polygonName = payload.collider.name.toLowerCase();
1447
1448
  if ((activePane === null || activePane === void 0 ? void 0 : activePane.getAttribute('id')) !== 'at-room-tree-pane') {
1448
1449
  yield toggleDisplayPane('at-room-creation-btn');
1449
1450
  }
1450
1451
  else {
1451
1452
  yield new Promise(resolve => requestAnimationFrame(resolve));
1452
1453
  }
1453
- highlightSelectedPartitionChild(partitionId, payload.collider.name);
1454
+ if (polygonName.includes('window')) {
1455
+ const index = polygonName.split('_')[1].split('-')[1];
1456
+ highlightSelectedWallWindow(polygonId, index);
1457
+ }
1458
+ if (polygonName.includes('wall') || polygonName.includes('floor')) {
1459
+ highlightSelectedPartitionChild(polygonId, payload.collider.name);
1460
+ }
1454
1461
  });
1455
1462
  }
1456
1463
  function handleDragEnd(payload) {
@@ -2140,9 +2147,9 @@ function handleDeletePartition(targetId) {
2140
2147
  function handleCancelPartition() {
2141
2148
  const cancelRoomBtn = document.getElementById('at-cancel-room-form-btn');
2142
2149
  cancelRoomBtn.addEventListener('click', () => {
2143
- getNewlyAddedPartition().map(partition => {
2150
+ getNewlyAddedPartition().map((partition) => __awaiter(this, void 0, void 0, function* () {
2144
2151
  const target = _3DXObjects.find(obj => obj.object.object_data.uuid === partition.uuid);
2145
- disposeModel(target);
2152
+ yield disposeModel(target);
2146
2153
  dispatchSpaceEvent(SPACE_EVENTS.PARTITION_DISPOSED, partition);
2147
2154
  const filteredRoomNodes = _partitionNodes.map((roomNode) => {
2148
2155
  // Filter children based on partitionUuid if children exist
@@ -2151,7 +2158,7 @@ function handleCancelPartition() {
2151
2158
  }
2152
2159
  });
2153
2160
  setSpacePartitionNodes(filteredRoomNodes);
2154
- });
2161
+ }));
2155
2162
  clearWallBaseHeight();
2156
2163
  const objects = get3DXObjects();
2157
2164
  const currentPartitionData = getCurrentEditRoomData();
@@ -2167,6 +2174,23 @@ function handleCancelPartition() {
2167
2174
  if (currentPartitionData) {
2168
2175
  const currentPartition = currentPartitionData.children.find(child => child.uuid == target.object.object_data.uuid);
2169
2176
  const polyJson = typeof currentPartition.polygon_json === 'string' ? JSON.parse(currentPartition.polygon_json) : currentPartition.polygon_json;
2177
+ log.info("JAMES polyJson", polyJson);
2178
+ // delete newly added windows
2179
+ _3DXObjects.map(object => {
2180
+ if (object.children) {
2181
+ object.children.map((win) => __awaiter(this, void 0, void 0, function* () {
2182
+ log.info("JAMES window", win);
2183
+ yield disposeModel(win);
2184
+ // Find the wall that owns this window
2185
+ const wall = polyJson.walls.find(wall => wall.uuid === win.wallUUID);
2186
+ if (wall && wall.windows) {
2187
+ // Remove this specific window (by its index) from that wall
2188
+ wall.windows = wall.windows.filter(w => w.index !== win.index);
2189
+ log.info(`Removed window ${win.index} from wall ${wall.uuid}`);
2190
+ }
2191
+ }));
2192
+ }
2193
+ });
2170
2194
  if (polyJson && polyJson.path) {
2171
2195
  const payload = {
2172
2196
  uuid: target.object.object_data.uuid,
@@ -3272,10 +3296,31 @@ function handleClickEventInObjectSortOption() {
3272
3296
  });
3273
3297
  }
3274
3298
  }
3299
+ function handleWindowVisibility(visibilityBtn) {
3300
+ return __awaiter(this, void 0, void 0, function* () {
3301
+ try {
3302
+ const partitionId = visibilityBtn.getAttribute('partition-id');
3303
+ const windowIndex = visibilityBtn.closest('li').getAttribute('window-index');
3304
+ const wallId = visibilityBtn.closest('li').getAttribute('wall-id');
3305
+ const windowNameAsMeshChild = `${wallId}_window-${windowIndex}`;
3306
+ const windowLabelNameAsMeshChild = `windowLabel-${windowIndex}`;
3307
+ const polygonObjs = get3DXObjects().filter(p => p.type === 'POLYGON');
3308
+ const targetObject = polygonObjs.find(obj => obj.object.object_data.uuid === partitionId);
3309
+ const { component } = targetObject;
3310
+ const isVisible = visibilityBtn.classList.toggle('mdi-eye');
3311
+ toggleVisibilityState(visibilityBtn, isVisible);
3312
+ toggleMeshChildrenVisibility(component, windowNameAsMeshChild, isVisible);
3313
+ toggleMeshChildrenVisibility(component, windowLabelNameAsMeshChild, isVisible);
3314
+ }
3315
+ catch (e) {
3316
+ console.error("Error window visibility: ", e);
3317
+ }
3318
+ });
3319
+ }
3275
3320
  export {
3276
3321
  //state
3277
3322
  activeToolbarItem, activeActionItem, cancelModelPlacementPrompt, isCustomMapControlsVisible, pipeColor,
3278
3323
  //methods
3279
3324
  batchAddEventListenerById, batchAddEventListenerByClassName, batchAddEventListenerByClassNames, batchAddEventListenerByDataAttribute, setActiveToolbarItem, toggleDisplayPane, toggleActionBar, setupIndividualEventListeners, setupSpaceEventSubscriptions, handleModelVisibility, handleDeleteModel, handleShowMinimap, handleScrollToView, handleRenderMeetingUI, handleShowCustomMinimap,
3280
3325
  // partition
3281
- handlePartitionVisibility, handlePolygonVisibility, handleDeletePartition, };
3326
+ handlePartitionVisibility, handlePolygonVisibility, handleDeletePartition, handleWindowVisibility, };
@@ -44,6 +44,8 @@ export declare class TubeLine {
44
44
  polygonData: any;
45
45
  renderPolygonOnAdd: boolean;
46
46
  targetUUID: any;
47
+ isWindowEditing: boolean;
48
+ objectIndex: any;
47
49
  };
48
50
  outputs: Record<string, unknown> & MpSdk.Scene.PredefinedOutputs;
49
51
  context: MpSdk.Scene.IComponentContext;
@@ -139,6 +141,7 @@ export declare class BufferGeometry {
139
141
  targetUUID: any;
140
142
  deductWindowFromWallArea: boolean;
141
143
  windowOutlineColor: number;
144
+ isWindowEditing: boolean;
142
145
  };
143
146
  outputs: Record<string, unknown> & MpSdk.Scene.PredefinedOutputs;
144
147
  context: MpSdk.Scene.IComponentContext;