architwin 1.16.5 → 1.16.6

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,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, notyf } from "../../../events";
13
- import { startDraw, cancelDraw, disposeModel, _3DXObjects, getCurrentPolygon, dispatchSpaceEvent, enableVerticeControls, setCurrentPolygon, setMeshChildrenMaterialProperty, get3DXObjects, getChildrenOfModel, clearSelectedObject, renderPolygon, setWallBaseHeight, clearWallBaseHeight, setDrawingConfig, resetDrawingConfig, goToPosition, partitionHistory } from '../../../../architwin';
13
+ import { startDraw, cancelDraw, disposeModel, _3DXObjects, getCurrentPolygon, dispatchSpaceEvent, enableVerticeControls, setCurrentPolygon, setMeshChildrenMaterialProperty, get3DXObjects, getChildrenOfModel, clearSelectedObject, renderPolygon, setWallBaseHeight, clearWallBaseHeight, setDrawingConfig, resetDrawingConfig, goToPosition, partitionHistory, hasTimeElapsed } from '../../../../architwin';
14
14
  import { generateUUID, extractUUID } from '../../../../utils';
15
15
  import { getCurrentEditRoomData } from './roomTreePane';
16
16
  import { toggleModal, setModalAction } from "../modal";
@@ -440,7 +440,9 @@ function displayPartitions(partitions) {
440
440
  const roomChildren = currentEditRoomData.children;
441
441
  const nameFound = roomChildren.find(child => child.name === newPartitionName && child.uuid != currentPartitionData.uuid);
442
442
  if (nameFound != undefined) {
443
- notyf.error(`${i18n.t('DuplicatePartitionName')}`);
443
+ if (hasTimeElapsed(300)) {
444
+ notyf.error(`${i18n.t('DuplicatePartitionName')}`);
445
+ }
444
446
  }
445
447
  else {
446
448
  const partitionIndex = currentPartitionDataArray.findIndex(partition => partition.uuid === currentPartitionData.uuid);
@@ -12,7 +12,7 @@ import { batchAddEventListenerByClassName, handleDeletePartition, handlePartitio
12
12
  import i18n from "../i18n";
13
13
  import { getCurrentPolygonData, handlePartitionRowEditBtnClickEvent, handlePartitionWallEditBtn, setCurrentEditWindowIndex, setDrawConfig, setDrawingMode, setIsEditWindow, setPartitionFormMode } from "./roomFormPane";
14
14
  import { SPACE_EVENTS } from "../../../../types";
15
- import { _3DXObjects, dispatchSpaceEvent, enableVerticeControls, getChildrenOfModel, goToModel, goToPosition, renderPolygon, setSelectedObject } from "../../../../architwin";
15
+ import { _3DXObjects, dispatchSpaceEvent, enableVerticeControls, getChildrenOfModel, goToModel, goToPosition, hasTimeElapsed, renderPolygon, setSelectedObject } from "../../../../architwin";
16
16
  import log from 'loglevel';
17
17
  import { getShortcutTooltipHTML } from "../static/common";
18
18
  let roomDataArray = [];
@@ -352,30 +352,29 @@ function toggleSelectedPartition() {
352
352
  }));
353
353
  batchAddEventListenerByClassName('at_child_visible_btn', (event) => __awaiter(this, void 0, void 0, function* () {
354
354
  var _a;
355
- const btn = event.target;
356
- const li = btn.closest('li');
357
- const isWindow = (_a = li === null || li === void 0 ? void 0 : li.id) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('window');
358
- const polygonId = btn.id;
359
- const wallId = btn.getAttribute('polygon-item-id');
360
- event.stopPropagation();
361
- if (isWindow) {
362
- handleWindowVisibility(btn, true);
363
- return;
364
- }
365
- const parentVisibleState = yield handlePolygonVisibility(polygonId);
366
- // no DOM reads after this point that depend on btn/li meaning
367
- yield new Promise(resolve => {
368
- requestAnimationFrame(() => resolve());
369
- });
370
- if (!wallId)
371
- return;
372
- const windowItems = document.querySelectorAll(`li.at_window_row_item[wall-id="${wallId}"]`);
373
- windowItems.forEach((windowLi) => {
374
- const visibilityBtn = windowLi.querySelector('.at_child_visible_btn');
375
- if (visibilityBtn) {
376
- handleWindowVisibility(visibilityBtn, false, parentVisibleState);
355
+ if (hasTimeElapsed(350)) {
356
+ const target = event.currentTarget;
357
+ const li = target.closest('li');
358
+ if ((_a = li === null || li === void 0 ? void 0 : li.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('window')) {
359
+ event.stopPropagation();
360
+ handleWindowVisibility(target, true);
377
361
  }
378
- });
362
+ else {
363
+ const wallId = target.getAttribute('polygon-item-id');
364
+ const windowItems = document.querySelectorAll(`li.at_window_row_item[wall-id="${wallId}"]`);
365
+ yield new Promise(resolve => setTimeout(resolve, 1));
366
+ yield new Promise(resolve => requestAnimationFrame(resolve));
367
+ const parentVisibleState = yield handlePolygonVisibility(target.id);
368
+ if (windowItems && windowItems.length > 0) {
369
+ windowItems.forEach((windowLi) => {
370
+ const visibilityBtn = windowLi.querySelector('.at_child_visible_btn');
371
+ if (visibilityBtn) {
372
+ handleWindowVisibility(visibilityBtn, false, parentVisibleState);
373
+ }
374
+ });
375
+ }
376
+ }
377
+ }
379
378
  }));
380
379
  batchAddEventListenerByClassName('at_partition_wall_row_item', (event) => __awaiter(this, void 0, void 0, function* () {
381
380
  event.stopPropagation();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.16.5",
3
+ "version": "1.16.6",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",