architwin 1.14.15 → 1.14.16

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.
@@ -114,14 +114,20 @@ export function renderRoomFormPane() {
114
114
  </div>
115
115
 
116
116
  <div class="at_edit_name" id="at-edit-wall-material" style="display: none;">
117
- <input class="at_edit_name_input" type="text" id="at-edit-wall-input" data-cy="at-edit-wall-material-input" placeholder="${i18n.t('EnterWallMaterial')}" disabled style="font-size: 0.75rem !important;">
117
+ <input class="at_edit_name_input at_text_xs" type="text" id="at-edit-wall-input" data-cy="at-edit-wall-material-input" placeholder="${i18n.t('EnterWallMaterial')}" disabled>
118
118
  <span class="mdi mdi-pencil" style="display: none; cursor: pointer;" id="at-wall-edit-material-btn"></span>
119
- <span class="mdi mdi-check" id="at-confirm-edit-wall-btn" style="display: none;"></span>
119
+ <!-- <span class="mdi mdi-check" id="at-confirm-edit-wall-btn" style="display: none;"></span> -->
120
+ <div class="at_save_button at_text_xs at_ghost" id="at-confirm-edit-wall-btn" data-cy="at-confirm-edit-wall-btn" style="display: none;">
121
+ ${i18n.t('Save')}
122
+ </div>
120
123
  </div>
121
124
 
122
125
  <div class="at_edit_name" id="at-edit-partition-name">
123
- <input class="at_edit_name_input" type="text" name="edit_partition_name" id="at-edit-partition-name-input" data-cy="at-edit-partition-name-input">
124
- <span class="mdi mdi-check" id="at-confirm-edit-partition-name"></span>
126
+ <input class="at_edit_name_input at_text_xs" type="text" name="edit_partition_name" id="at-edit-partition-name-input" data-cy="at-edit-partition-name-input">
127
+ <!-- <span class="mdi mdi-check" id="at-confirm-edit-partition-name"></span> -->
128
+ <div class="at_save_button at_text_xs at_ghost" id="at-confirm-edit-partition-name" data-cy="at-confirm-edit-partition-name">
129
+ ${i18n.t('Save')}
130
+ </div>
125
131
  </div>
126
132
 
127
133
  <!-- Partition Add Mode -->
@@ -751,7 +757,7 @@ function displayFaces(polygon) {
751
757
  const floorMaterialField = document.getElementById('at-edit-floor-material-input');
752
758
  floorMaterialField.disabled = false;
753
759
  floorMaterialEdit.style.display = "none";
754
- floorMaterialConfirm.style.display = "block";
760
+ floorMaterialConfirm.style.display = "inline-flex";
755
761
  }));
756
762
  addEventListenerById('at-confirm-edit-wall-btn', () => __awaiter(this, void 0, void 0, function* () {
757
763
  console.log('@caroline wall check', wallMaterial, currentWall.material, currentWall);
@@ -775,7 +781,7 @@ function displayFaces(polygon) {
775
781
  const wallMaterialInput = document.getElementById('at-edit-wall-input');
776
782
  wallMaterialInput.disabled = false;
777
783
  wallEditMaterial.style.display = "none";
778
- wallConfirmMaterial.style.display = "block";
784
+ wallConfirmMaterial.style.display = "inline-flex";
779
785
  });
780
786
  }
781
787
  function displayWall(wall) {
@@ -1118,9 +1124,12 @@ function displayFloor(floor, walls, floorModel) {
1118
1124
  </div>
1119
1125
 
1120
1126
  <div class="at_edit_name" id="at-edit-floor-material">
1121
- <input class="at_edit_name_input at_ml_1" type="text" id="at-edit-floor-material-input" data-cy="at-edit-floor-material-input" value="${floor.material ? floor.material : ''}" placeholder="${i18n.t('EnterFloorMaterial')}" style="font-size: 0.75rem !important;">
1127
+ <input class="at_edit_name_input at_ml_1 at_text_xs" type="text" id="at-edit-floor-material-input" data-cy="at-edit-floor-material-input" value="${floor.material ? floor.material : ''}" placeholder="${i18n.t('EnterFloorMaterial')}">
1122
1128
  <span class="mdi mdi-pencil at_mr-1" style="display: none; cursor: pointer;" id="at-floor-edit-material-btn"></span>
1123
- <span class="mdi mdi-check at_mr-1" id="at-confirm-edit-floor-name" style="display: none;"></span>
1129
+ <!-- <span class="mdi mdi-check at_mr-1" id="at-confirm-edit-floor-name" style="display: none;"></span> -->
1130
+ <div class="at_save_button at_text_xs at_ghost" id="at-confirm-edit-floor-name" data-cy="at-confirm-edit-floor-name" style="display: none;">
1131
+ ${i18n.t('Save')}
1132
+ </div>
1124
1133
  </div>
1125
1134
 
1126
1135
  <div class="at_dropdown_item_container" id="at-vertex-list-${floor.uuid}" data-cy="at-vertex-list-${floor.uuid}" style="display: flex;"></div>
@@ -1564,10 +1573,10 @@ function onModeDetectFloorInput(event) {
1564
1573
  const floorConfirmMaterial = document.getElementById('at-confirm-edit-floor-name');
1565
1574
  if (floorMaterialValue) {
1566
1575
  floorEditMaterial.style.display = "none";
1567
- floorConfirmMaterial.style.display = "block";
1576
+ floorConfirmMaterial.style.display = "inline-flex";
1568
1577
  }
1569
1578
  else {
1570
- floorEditMaterial.style.display = "block";
1579
+ floorEditMaterial.style.display = "inline-flex";
1571
1580
  floorConfirmMaterial.style.display = "none";
1572
1581
  }
1573
1582
  }
@@ -1584,10 +1593,10 @@ function onModeDetectWallInput(event) {
1584
1593
  setWallMaterial(wallMaterialValue);
1585
1594
  if (wallMaterialValue) {
1586
1595
  wallEditMaterial.style.display = "none";
1587
- wallConfirmMaterial.style.display = "block";
1596
+ wallConfirmMaterial.style.display = "inline-flex";
1588
1597
  }
1589
1598
  else {
1590
- wallEditMaterial.style.display = "block";
1599
+ wallEditMaterial.style.display = "inline-flex";
1591
1600
  wallConfirmMaterial.style.display = "none";
1592
1601
  }
1593
1602
  }
@@ -77,7 +77,6 @@ export declare function updateRoomVisibilityUI(parentId: string, isVisible: bool
77
77
  export declare function highlightSelectedPartitionChild(partitionId: string, name: string): void;
78
78
  export declare function toggeleExpandParitionWallChild(partitionId: string, name: string): void;
79
79
  export declare function highlightSelectedWallWindow(wallUuid: string, index: number | string): void;
80
- export declare function toggleHighlightedPartitionItem(): void;
81
80
  export declare function toggleHighlightedWindowItem(): void;
82
81
  export declare function calculateMidPoint(coords: Array<{
83
82
  start: Vector3;
@@ -351,14 +351,27 @@ function toggleSelectedPartition() {
351
351
  handlePartitionVisibility(target.id);
352
352
  }));
353
353
  batchAddEventListenerByClassName('at_child_visible_btn', (event) => __awaiter(this, void 0, void 0, function* () {
354
+ var _a;
354
355
  const target = event.target;
355
356
  const li = target.closest('li');
356
- if (li === null || li === void 0 ? void 0 : li.getAttribute('id').toLowerCase().includes('window')) {
357
+ if ((_a = li === null || li === void 0 ? void 0 : li.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('window')) {
357
358
  event.stopPropagation();
358
- handleWindowVisibility(target);
359
+ handleWindowVisibility(target, true);
359
360
  }
360
361
  else {
361
- handlePolygonVisibility(target.id);
362
+ const parentVisibleState = yield handlePolygonVisibility(target.id);
363
+ yield new Promise(resolve => setTimeout(resolve, 0));
364
+ yield new Promise(resolve => requestAnimationFrame(resolve));
365
+ const wallId = target.getAttribute('polygon-item-id');
366
+ const windowItems = document.querySelectorAll(`li.at_wall_window_row_item[wall-id="${wallId}"]`);
367
+ if (windowItems && windowItems.length > 0) {
368
+ windowItems.forEach((windowLi) => {
369
+ const visibilityBtn = windowLi.querySelector('.at_child_visible_btn');
370
+ if (visibilityBtn) {
371
+ handleWindowVisibility(visibilityBtn, false, parentVisibleState);
372
+ }
373
+ });
374
+ }
362
375
  }
363
376
  }));
364
377
  batchAddEventListenerByClassName('at_partition_wall_row_item', (event) => __awaiter(this, void 0, void 0, function* () {
@@ -398,10 +411,10 @@ function toggleSelectedPartition() {
398
411
  }
399
412
  }));
400
413
  batchAddEventListenerByClassName('at_child_edit_btn', (event) => __awaiter(this, void 0, void 0, function* () {
401
- var _a;
414
+ var _b;
402
415
  event.stopPropagation();
403
416
  const target = event.target;
404
- const isWall = ((_a = target.getAttribute('is-wall')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
417
+ const isWall = ((_b = target.getAttribute('is-wall')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'true';
405
418
  const partitionId = target.getAttribute('partition-id');
406
419
  const parentRoomUuid = target.getAttribute('partition-parent-uuid');
407
420
  const parentRoom = document.getElementById(`at-room-edit-${parentRoomUuid}-btn`);
@@ -600,6 +613,10 @@ export function updatePolygonVisibilityData(isVisible, currPartition, isFloor, p
600
613
  log.info("WALL!");
601
614
  // WALLS
602
615
  targetItem = polygonJson.walls.find(item => item.uuid === polygonItemId) || null;
616
+ // <START_COMMENT> TODO: 16032 - uncomment when polygon loader window visibility update is implemented
617
+ // const windows = targetItem?.windows || null
618
+ // windows?.forEach(w => w.options.is_visible = isVisible)
619
+ // <END_COMMENT> TODO: 16032 - uncomment when polygon loader window visibility update is implemented
603
620
  }
604
621
  log.info("targetItem:", targetItem);
605
622
  if (targetItem) {
@@ -743,13 +760,13 @@ function displayWindows(wall, partitionId, parentId) {
743
760
  const windowCoords = JSON.stringify(window.edges);
744
761
  const windowCoordsEncoded = btoa(windowCoords);
745
762
  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>
763
+ <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">
764
+ <div>${window.name}</div>
765
+ <div>
766
+ <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>
767
+ <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>
768
+ </div>
769
+ </li>
753
770
  `;
754
771
  }
755
772
  });
@@ -810,15 +827,15 @@ export function highlightSelectedWallWindow(wallUuid, index) {
810
827
  const wallWindow = document.querySelectorAll(`li[wall-id="${wallUuid}"]`);
811
828
  const targetId = `window-${wallUuid}-${index}`;
812
829
  wallWindow.forEach((windowElement) => {
830
+ if (windowElement.id === targetId) {
831
+ const parentWallItem = windowElement.closest('li.at_partition_wall_row_item');
832
+ const partitionId = parentWallItem.getAttribute('partition-li-id');
833
+ const objectName = parentWallItem.getAttribute('object-name');
834
+ toggeleExpandParitionWallChild(partitionId, objectName);
835
+ }
813
836
  windowElement.classList.toggle('selected', windowElement.id === targetId);
814
837
  });
815
838
  }
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
839
  export function toggleHighlightedWindowItem() {
823
840
  const windowItems = document.querySelectorAll('li.at_wall_window_row_item.selected');
824
841
  windowItems.forEach(el => {
@@ -37,12 +37,12 @@ declare function handlePartitionVisibility(targetId: string): Promise<void>;
37
37
  * Toggles the visibility of the child partitions within a partition tree. (FLOOR and WALLS)
38
38
  * @param {string} targetId - ID of the target partition element.
39
39
  */
40
- declare function handlePolygonVisibility(targetId: string): Promise<void>;
40
+ declare function handlePolygonVisibility(targetId: string): Promise<boolean>;
41
41
  declare function handleDeletePartition(targetId: string): void;
42
42
  /**
43
43
  * Handles the display logic for showing the custom minimap.
44
44
  */
45
45
  declare function handleShowCustomMinimap(): void;
46
- declare function handleWindowVisibility(visibilityBtn: HTMLElement): Promise<void>;
46
+ declare function handleWindowVisibility(visibilityBtn: HTMLElement, updateStateDB: boolean, fromParentVisibilityState?: boolean): Promise<void>;
47
47
  declare function clearActivePane(): void;
48
48
  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, clearActivePane };
@@ -1934,9 +1934,11 @@ function handlePolygonVisibility(targetId) {
1934
1934
  const parentId = thisPartition.parent_uuid;
1935
1935
  updateRoomVisibilityUI(parentId, true);
1936
1936
  }
1937
+ return isVisible;
1937
1938
  }
1938
1939
  catch (error) {
1939
1940
  console.error("Error partitionchild visibility: ", error);
1941
+ return null;
1940
1942
  }
1941
1943
  });
1942
1944
  }
@@ -3295,21 +3297,51 @@ function handleClickEventInObjectSortOption() {
3295
3297
  });
3296
3298
  }
3297
3299
  }
3298
- function handleWindowVisibility(visibilityBtn) {
3300
+ function handleWindowVisibility(visibilityBtn, updateStateDB, fromParentVisibilityState) {
3299
3301
  return __awaiter(this, void 0, void 0, function* () {
3300
3302
  try {
3301
3303
  const partitionId = visibilityBtn.getAttribute('partition-id');
3302
3304
  const windowIndex = visibilityBtn.closest('li').getAttribute('window-index');
3303
3305
  const wallId = visibilityBtn.closest('li').getAttribute('wall-id');
3304
3306
  const windowNameAsMeshChild = `${wallId}_window-${windowIndex}`;
3305
- const windowLabelNameAsMeshChild = `windowLabel-${windowIndex}`;
3306
3307
  const polygonObjs = get3DXObjects().filter(p => p.type === 'POLYGON');
3307
3308
  const targetObject = polygonObjs.find(obj => obj.object.object_data.uuid === partitionId);
3308
3309
  const { component } = targetObject;
3309
- const isVisible = visibilityBtn.classList.toggle('mdi-eye');
3310
+ const isVisible = fromParentVisibilityState !== undefined ? fromParentVisibilityState : visibilityBtn.classList.toggle('mdi-eye');
3310
3311
  toggleVisibilityState(visibilityBtn, isVisible);
3311
3312
  toggleMeshChildrenVisibility(component, windowNameAsMeshChild, isVisible);
3312
- toggleMeshChildrenVisibility(component, windowLabelNameAsMeshChild, isVisible);
3313
+ // <START_COMMENT> TODO: 16032 - uncomment when polygon loader window visibility update is implemented
3314
+ // if(updateStateDB) {
3315
+ // const thisPartition : PartitionNode = _partitionNodes.flatMap(item => item.children || []).find(child => child.uuid === partitionId)
3316
+ // if(!thisPartition) {
3317
+ // log.warn('Partition not found')
3318
+ // } else {
3319
+ // const polygonJson = JSON.parse(thisPartition.polygon_json)
3320
+ // const wall = polygonJson.walls.find(item => item.uuid === wallId) || null
3321
+ // const windows = wall?.windows || null
3322
+ // windows?.forEach(w => w.options.is_visible = isVisible)
3323
+ // // const payload: PartitionPayload = {
3324
+ // // uuid: thisPartition.uuid,
3325
+ // // space_uuid: thisPartition.space_uuid,
3326
+ // // name: thisPartition.name,
3327
+ // // parent_uuid: thisPartition.parent_uuid,
3328
+ // // polygon_json: polygonJson
3329
+ // // }
3330
+ // // renderPolygon(payload)
3331
+ // setTimeout(() => {
3332
+ // const updatedPolygonJson = getCurrentPolygonData()
3333
+ // if(updatedPolygonJson) {
3334
+ // thisPartition.polygon_json = JSON.stringify(updatedPolygonJson);
3335
+ // }
3336
+ // // Dispatch event: PARTITION_EDITED
3337
+ // dispatchSpaceEvent(SPACE_EVENTS.PARTITION_EDITED, {
3338
+ // data: thisPartition,
3339
+ // isUpdateTree: false
3340
+ // });
3341
+ // }, 1000); // 1000ms = 1 second
3342
+ // }
3343
+ // }
3344
+ // <END_COMMENT> TODO: 16032 - uncomment when polygon loader window visibility update is implemented
3313
3345
  }
3314
3346
  catch (e) {
3315
3347
  console.error("Error window visibility: ", e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.14.15",
3
+ "version": "1.14.16",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",
@@ -413,6 +413,19 @@
413
413
  text-align: center;
414
414
  }
415
415
 
416
+ /* Smaller version for inline use */
417
+ .at_button--small {
418
+ font-size: 0.8em;
419
+ padding: 2px 0.6em;
420
+ line-height: 1.2em;
421
+ max-height: 1.8em;
422
+ display: inline-flex;
423
+ align-items: center;
424
+ justify-content: center;
425
+ border-radius: 4px;
426
+
427
+ }
428
+
416
429
  .at_button_icon {
417
430
  padding: 2px 8px;
418
431
  cursor: pointer;
@@ -2442,4 +2455,24 @@ li.at_partition_wall_row_item {
2442
2455
 
2443
2456
  .at_wall_window_row_item.selected {
2444
2457
  padding-left: 5px;
2458
+ }
2459
+
2460
+ .at_save_button {
2461
+ display: inline-flex;
2462
+ align-items: center;
2463
+ justify-content: center;
2464
+ cursor: pointer;
2465
+ height: 20px; /* match input height */
2466
+ padding: 0 6px; /* enough for 保存 */
2467
+ font-size: 10px;
2468
+ line-height: 1; /* prevent vertical text overflow */
2469
+ white-space: nowrap; /* keep 保存 on one line */
2470
+ color: white;
2471
+ border: 1px solid white;
2472
+ border-radius: 4px;
2473
+ background: none;
2474
+ font-family: Arial, sans-serif;
2475
+ transition: all 0.2s ease;
2476
+ margin-left: 4px;
2477
+ box-sizing: border-box;
2445
2478
  }
@@ -304,7 +304,7 @@
304
304
  }
305
305
 
306
306
  .at_text_xs {
307
- font-size: 0.75rem;
307
+ font-size: 0.75rem !important;
308
308
  }
309
309
 
310
310
  .at_text_sm {