architwin 1.15.5 → 1.15.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.
@@ -1,5 +1,7 @@
1
- import { FORM_MODE, PartitionNode, PolygonData, WallPolyData, IObjectData } from "../../../../types";
1
+ import { FORM_MODE, PartitionNode, PolygonData, WallPolyData, IObjectData, WindowPolyData } from "../../../../types";
2
2
  export declare let isEditWindow: boolean;
3
+ export declare let currentEditWindowIndex: number;
4
+ export declare let currentWindow: WindowPolyData;
3
5
  export declare function renderRoomFormPane(): HTMLDivElement;
4
6
  /**
5
7
  * Toggles the state of the partition drawing functionality.
@@ -105,6 +107,7 @@ export declare function getCurrentPolygonData(): PolygonData;
105
107
  */
106
108
  export declare function setCurrentPartitionData(): Promise<void>;
107
109
  export declare function removeWindow(index?: number): void;
110
+ export declare function toggleUndoRedoButtons(undo: boolean, redo: boolean): void;
108
111
  export declare function getCurrentPartitionData(): PartitionNode;
109
112
  export declare function getNewlyAddedPartition(): Array<PartitionNode>;
110
113
  export declare function getDeletedSavedPartitionArray(): Array<PartitionNode>;
@@ -121,3 +124,4 @@ export declare function setPreviousPartitionData(payload: PartitionNode): void;
121
124
  export declare function handlePartitionWallEditBtn(wallUuid: string): Promise<void>;
122
125
  export declare function getTempCurrentRoomEditData(): Array<PartitionNode>;
123
126
  export declare function setTempCurrentRoomEditData(roomEditData: Array<PartitionNode>): void;
127
+ export declare function getCurrentWall(): WallPolyData;
@@ -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, renderPolygon, addUndoDrawActions, setWallBaseHeight, clearWallBaseHeight, setDrawingConfig, resetDrawingConfig, goToPosition, clearFloorBaseHeight, clearDrawActionHistory } from '../../../../architwin';
13
+ import { startDraw, cancelDraw, disposeModel, _3DXObjects, getCurrentPolygon, dispatchSpaceEvent, enableVerticeControls, setCurrentPolygon, setMeshChildrenMaterialProperty, get3DXObjects, getChildrenOfModel, clearSelectedObject, renderPolygon, setWallBaseHeight, clearWallBaseHeight, setDrawingConfig, resetDrawingConfig, goToPosition, partitionHistory } from '../../../../architwin';
14
14
  import { generateUUID, extractUUID } from '../../../../utils';
15
15
  import { getCurrentEditRoomData } from './roomTreePane';
16
16
  import { toggleModal, setModalAction } from "../modal";
@@ -42,7 +42,8 @@ let floorMaterial = '';
42
42
  let inputWallMaterial;
43
43
  let wallMaterial = '';
44
44
  export let isEditWindow = false;
45
- let currentEditWindowIndex = null;
45
+ export let currentEditWindowIndex = null;
46
+ export let currentWindow = null;
46
47
  let tempCurrentEditRoom = null;
47
48
  export function renderRoomFormPane() {
48
49
  log.info("__@ renderRoomFormPane: ", roomFormMode);
@@ -211,10 +212,6 @@ export function toggleDrawPartitionButton() {
211
212
  const vertexList = document.getElementById('at-face-vertex-container');
212
213
  const partitionNameInput = document.getElementById('at-edit-partition-name-input');
213
214
  partitionNameInput.value = '';
214
- const undoBtn = document.getElementById('at-draw-undo-btn');
215
- const redoBtn = document.getElementById('at-draw-redo-btn');
216
- undoBtn.classList.add('at_disabled');
217
- redoBtn.classList.add('at_disabled');
218
215
  const formMode = getPartitionFormMode();
219
216
  if (formMode == "ADD" /* FORM_MODE.ADD */) {
220
217
  tempCurrentPolygon = getCurrentPolygon();
@@ -231,6 +228,7 @@ export function toggleDrawPartitionButton() {
231
228
  isEditPartition = false;
232
229
  previousPartitionData = null;
233
230
  }
231
+ // toggleUndoRedoButtons(false, false)
234
232
  }
235
233
  export function toggleDrawWindowButton() {
236
234
  var _a, _b;
@@ -251,7 +249,6 @@ export function toggleDrawWindowButton() {
251
249
  }
252
250
  const objectIndex = _3DXObjects.findIndex(obj => obj.object.id == currentObject.object.id);
253
251
  log.info("objectIndex", objectIndex);
254
- clearFloorBaseHeight();
255
252
  drawingConfig = {
256
253
  lineTypeComponentConfig: {
257
254
  renderPolygonOnAdd: false,
@@ -302,6 +299,7 @@ export function toggleDrawWindowButton() {
302
299
  }
303
300
  }
304
301
  }
302
+ // toggleUndoRedoButtons(false, false)
305
303
  }
306
304
  /**
307
305
  * Displays the partition form based on the current form mode.
@@ -339,12 +337,12 @@ function populatePartitionForm(partition) {
339
337
  const memo = document.getElementById('at-room-memo-input');
340
338
  if (partition.polygon_json != null) {
341
339
  memo.value = JSON.parse(partition.polygon_json).memo;
340
+ floorLevel.value = JSON.parse(partition.polygon_json).floor_level;
342
341
  }
343
342
  // Display Partitions
344
343
  currentPartitionDataArray = partition.children;
345
344
  savedPartitionDataArray = partition.children;
346
345
  if (currentPartitionDataArray.length !== 0) {
347
- floorLevel.value = JSON.parse(partition.children[0].polygon_json).floor.floor_level;
348
346
  wallheight.value = JSON.parse(partition.children[0].polygon_json).walls[0].wall_height;
349
347
  displayPartitions(currentPartitionDataArray);
350
348
  }
@@ -699,14 +697,6 @@ function displayFaces(polygon) {
699
697
  console.log("renderPolygon:", payload, getCurrentPolygon());
700
698
  // Re-render polygon
701
699
  renderPolygon(payload);
702
- const undoPaylaod = {
703
- action: "deleteWall",
704
- wallId: wallId,
705
- payload: payload
706
- };
707
- addUndoDrawActions(undoPaylaod);
708
- const redoBtn = document.getElementById('at-draw-redo-btn');
709
- redoBtn.classList.add('at_disabled');
710
700
  toggleModal(false);
711
701
  notify.success(`${i18n.t('SuccessWallDelete')}`);
712
702
  }));
@@ -929,6 +919,7 @@ function setupEditWindow(element, window) {
929
919
  const confirmBtn = element.querySelector(`#at-confirm-edit-window-${window.index}`);
930
920
  if (!editBtn || !editNameContainer || !inputName || !nameLabel || !editMaterialContainer || !inputMaterial)
931
921
  return;
922
+ currentWindow = window;
932
923
  // Show inputs when edit icon is clicked
933
924
  editBtn.addEventListener("click", () => {
934
925
  if (isDrawing) {
@@ -965,6 +956,17 @@ function setupEditWindow(element, window) {
965
956
  };
966
957
  enableVerticeControls(windowComponent);
967
958
  isDrawing = true;
959
+ let data;
960
+ if (currentPartitionData) {
961
+ data = {
962
+ polygon: {
963
+ uuid: currentPartitionData.uuid,
964
+ polygon_json: currentPolygonData
965
+ },
966
+ verticePath: window.path,
967
+ };
968
+ }
969
+ // partitionHistory.setCurrent(data)
968
970
  });
969
971
  // // Confirm edit name and material
970
972
  confirmBtn.addEventListener("click", () => {
@@ -998,6 +1000,8 @@ function setupEditWindow(element, window) {
998
1000
  saveWallChanges();
999
1001
  isDrawing = false;
1000
1002
  isEditWindow = false;
1003
+ partitionHistory.clearHistory();
1004
+ // toggleUndoRedoButtons(false, false)
1001
1005
  });
1002
1006
  }
1003
1007
  function saveWallChanges() {
@@ -1365,17 +1369,17 @@ export function getPartitionFormData() {
1365
1369
  const name = ((_a = document.getElementById('at-room-name-input')) === null || _a === void 0 ? void 0 : _a.value) || null;
1366
1370
  const wallheight = ((_b = document.getElementById('at-room-wall-height-input')) === null || _b === void 0 ? void 0 : _b.value) || null;
1367
1371
  const floorLevel = ((_c = document.getElementById('at-room-floor-level-input')) === null || _c === void 0 ? void 0 : _c.value) || null;
1368
- let memo = ((_d = document.getElementById('at-room-memo-input')) === null || _d === void 0 ? void 0 : _d.value) || null;
1372
+ const memo = ((_d = document.getElementById('at-room-memo-input')) === null || _d === void 0 ? void 0 : _d.value) || null;
1369
1373
  const currentUrl = window.location.href;
1370
1374
  const spaceUUID = extractUUID(currentUrl);
1371
1375
  let payload = {
1372
1376
  space_uuid: spaceUUID,
1373
1377
  name: name,
1374
1378
  parent_uuid: null,
1375
- polygon_json: JSON.stringify({ memo: memo }),
1379
+ polygon_json: JSON.stringify({ memo: memo, floor_level: Number(floorLevel) }),
1376
1380
  children: currentPartitionDataArray,
1377
1381
  };
1378
- if (!memo) {
1382
+ if (!memo && !floorLevel) {
1379
1383
  payload.polygon_json = null;
1380
1384
  }
1381
1385
  currentPartitionDataArray.forEach(partition => {
@@ -1391,7 +1395,7 @@ export function getPartitionFormData() {
1391
1395
  currentEditRoomData.children = currentPartitionDataArray;
1392
1396
  payload = currentEditRoomData;
1393
1397
  payload.name = name;
1394
- payload.polygon_json = JSON.stringify({ memo: memo });
1398
+ payload.polygon_json = JSON.stringify({ memo: memo, floor_level: Number(floorLevel) });
1395
1399
  }
1396
1400
  return payload;
1397
1401
  }
@@ -1655,6 +1659,25 @@ export function removeWindow(index = -1) {
1655
1659
  faceVertexContainer.innerHTML = '';
1656
1660
  faceVertexContainer.append(displayWall(currentWall));
1657
1661
  }
1662
+ export function toggleUndoRedoButtons(undo, redo) {
1663
+ console.log("toggleUndoRedoButtons", undo, redo);
1664
+ if (!undo) {
1665
+ const undoBtn = document.getElementById('at-draw-undo-btn');
1666
+ undoBtn.classList.add('at_disabled');
1667
+ }
1668
+ else {
1669
+ const undoBtn = document.getElementById('at-draw-undo-btn');
1670
+ undoBtn.classList.remove('at_disabled');
1671
+ }
1672
+ if (!redo) {
1673
+ const redoBtn = document.getElementById('at-draw-redo-btn');
1674
+ redoBtn.classList.add('at_disabled');
1675
+ }
1676
+ else {
1677
+ const redoBtn = document.getElementById('at-draw-redo-btn');
1678
+ redoBtn.classList.remove('at_disabled');
1679
+ }
1680
+ }
1658
1681
  function setFloorMaterial(material) {
1659
1682
  console.log('setFloorMaterial()', material);
1660
1683
  floorMaterial = material;
@@ -1785,7 +1808,6 @@ export function handlePartitionWallEditBtn(wallUuid) {
1785
1808
  currentPolygonData = JSON.parse(currentPartitionData.polygon_json);
1786
1809
  setDrawingMode(false);
1787
1810
  cancelDrawing();
1788
- clearDrawActionHistory();
1789
1811
  });
1790
1812
  }
1791
1813
  export function getTempCurrentRoomEditData() {
@@ -1794,3 +1816,6 @@ export function getTempCurrentRoomEditData() {
1794
1816
  export function setTempCurrentRoomEditData(roomEditData) {
1795
1817
  tempCurrentEditRoom = roomEditData;
1796
1818
  }
1819
+ export function getCurrentWall() {
1820
+ return currentWall;
1821
+ }
@@ -8,7 +8,9 @@ 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, _tagIotCategoryTypes, getIoTDeviceTagIcons, toggleMeshChildrenVisibility, set3DXObjects } 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, _tagIotCategoryTypes, getIoTDeviceTagIcons, toggleMeshChildrenVisibility, set3DXObjects, partitionHistory,
12
+ // polygonHistory
13
+ } from "../architwin";
12
14
  import { Notyf } from 'notyf';
13
15
  import 'notyf/notyf.min.css';
14
16
  import { SPACE_EVENTS, COORDINATE_SYSTEM, UNITS, DEGREE, MAP_OPTIONS, sortTagOptions, sortObjectOptions, CUSTOM_MAP_MODE, TAG_TYPE } from "../types";
@@ -24,7 +26,7 @@ import log from 'loglevel';
24
26
  import * as minimap from '../minimap';
25
27
  import { clearActiveThemeCard, getSelectedTheme } from "./components/toolbar/themePane";
26
28
  import { getCurrentEditRoomData, displayRoomTree, updatePartitionVisibilityUI, getSelectedPartitionId, updatePolygonVisibilityData, toggleVisibilityState, setFilteredDisplay, updateRoomVisibilityUI, highlightSelectedPartitionChild, highlightSelectedWindow, getRoomData } from "./components/toolbar/spacePartition/roomTreePane";
27
- import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setCurrentPartitionData, getCurrentPartitionData, getTempCurrentPolygon, clearTempCurrentPolygon, toggleDrawWindowButton, getIsDrawing, getDrawingMode, getCurrentPolygonData, setTempCurrentRoomEditData } from "./components/toolbar/spacePartition/roomFormPane";
29
+ import { toggleDrawPartitionButton, displayPartitionFormMode, setPartitionFormMode, clearPartitionForm, setPolygonData, getPartitionFormData, getPartitionSavingMode, setPartitionSavingMode, getPartitionFormMode, getNewlyAddedPartition, setCurrentPartitionData, getCurrentPartitionData, getTempCurrentPolygon, clearTempCurrentPolygon, toggleDrawWindowButton, getIsDrawing, getDrawingMode, getCurrentPolygonData, setTempCurrentRoomEditData, toggleUndoRedoButtons, getCurrentWall, currentWindow } from "./components/toolbar/spacePartition/roomFormPane";
28
30
  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
31
  import { getBasepointCalibrateBpCoordinateValues, getBasepointCalibrateMpCoordinateValues, initBsepointCalibratePane, toggleBasepointCalibratePane } from "./components/toolbar/basepointCalibratePane";
30
32
  import { toggleGeneralMapOptions, initGeneralSelectedMap, getSelectedMapOption } from './components/toolbar/generalSettingsMenuPane';
@@ -38,6 +40,7 @@ import { PipeForm } from "./components/toolbar/pipeFormPane";
38
40
  import { toggleIoTCategoryOptions, toggleIoTDevicesOptions, setSelectedIoTSystemRadio, clearIoTDropdowns, initIoTFormData, setIotCategoryOptions, getIotTagFormData, iotTagFormMode, selectedIotTag, clearIotFields, getIotCategoryOption } from './components/toolbar/tagIotFormPane';
39
41
  import { getTheseTagMessages, timedoutComment, unsendComment } from "./components/toolbar/tagMessagingPane";
40
42
  import { handleScreenShareResponsiveChanges, handleScreenShareAcceptRequest, handleScreenShareBackUserListPane, handleScreenShareEndSessionEvent, handleScreenShareUsersUpdated, renderScreenShareLeaveConfirmationModal } from "./components/toolbar/screenSharePane";
43
+ import _ from "lodash";
41
44
  const pipeList = new PipeList();
42
45
  const pipeForm = new PipeForm();
43
46
  let activeToolbarItem, activeActionItem, activePane, activeActionPane, cancelTagPlacementPrompt, cancelModelPlacementPrompt;
@@ -1505,9 +1508,8 @@ function setupSpaceEventSubscriptions() {
1505
1508
  subscribeSpaceEvent(SPACE_EVENTS.TAGPLACER_CREATED, handleTagPlacerCreated);
1506
1509
  subscribeSpaceEvent(SPACE_EVENTS.UPDATE_ROOM_TREE, handleUpdateRoomTree);
1507
1510
  subscribeSpaceEvent(SPACE_EVENTS.PARTITION_CLICKED, handlePartitionSelected);
1508
- subscribeSpaceEvent(SPACE_EVENTS.VERTEX_DRAG_END, setCurrentPartitionData);
1511
+ subscribeSpaceEvent(SPACE_EVENTS.VERTEX_DRAG_END, handleVertexDragEnd);
1509
1512
  subscribeSpaceEvent(SPACE_EVENTS.VERTEX_PLACED, handleVertexPlace);
1510
- subscribeSpaceEvent(SPACE_EVENTS.DRAW_HISTORY, handleDrawHistory);
1511
1513
  subscribeSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_UPLOADED, handleCustomMapFloorImageUploaded);
1512
1514
  subscribeSpaceEvent(SPACE_EVENTS.FLOOR_IMAGE_UPLOAD_FAILED, handleCustomMapFloorUploadFailed);
1513
1515
  subscribeSpaceEvent(SPACE_EVENTS.TAG_SANDBOX_REGISTERED, handleSandboxRegistered);
@@ -1518,6 +1520,31 @@ function setupSpaceEventSubscriptions() {
1518
1520
  subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_ACCEPT_REQUEST, handleScreenShareAcceptRequest);
1519
1521
  subscribeSpaceEvent(SPACE_EVENTS.SCREEN_SHARE_BACK_USER_LIST_PANE, handleScreenShareBackUserListPane);
1520
1522
  }
1523
+ function handleVertexDragEnd(payload) {
1524
+ log.info("handleVertexDragEnd()", payload);
1525
+ setCurrentPartitionData();
1526
+ if (isToolbarFeatureEnabled("roomCreation")) {
1527
+ let data;
1528
+ const currentPartitionData = _.cloneDeep(getCurrentPartitionData());
1529
+ const currentPolygonData = _.cloneDeep(getCurrentPolygonData());
1530
+ const currentWall = getCurrentWall();
1531
+ const wallIndex = currentPolygonData.walls.findIndex(w => w.uuid == currentWall.uuid);
1532
+ if (currentPartitionData) {
1533
+ data = {
1534
+ polygon: {
1535
+ uuid: currentPartitionData.uuid,
1536
+ polygon_json: currentPolygonData
1537
+ },
1538
+ verticePath: currentPolygonData.walls[wallIndex].windows[currentWindow.index].path
1539
+ };
1540
+ partitionHistory.addToHistory(JSON.parse(JSON.stringify(data)));
1541
+ }
1542
+ log.info("all history", partitionHistory.getAllHistory());
1543
+ }
1544
+ // partitionHistory.addToHistory(data)
1545
+ // polygonHistory.addToHistory(payload)
1546
+ // toggleUndoRedoButtons(polygonHistory.canUndo(), polygonHistory.canRedo())
1547
+ }
1521
1548
  function handlePartitionColiderClickSelected(payload) {
1522
1549
  return __awaiter(this, void 0, void 0, function* () {
1523
1550
  const polygonId = extractUUID(payload.collider.name);
@@ -1586,43 +1613,10 @@ function handleDragEnd(payload) {
1586
1613
  };
1587
1614
  setCurrentTransformationValues(transformValues);
1588
1615
  }
1589
- function handleDrawHistory(payload) {
1590
- console.log("handleDrawHistory", payload);
1591
- const undoCount = (payload.undoDrawActions).length;
1592
- const redoCount = (payload.redoDrawActions).length;
1593
- if (undoCount == 0) {
1594
- const undoBtn = document.getElementById('at-draw-undo-btn');
1595
- undoBtn.classList.add('at_disabled');
1596
- }
1597
- else {
1598
- const undoBtn = document.getElementById('at-draw-undo-btn');
1599
- undoBtn.classList.remove('at_disabled');
1600
- }
1601
- if (redoCount == 0) {
1602
- const redoBtn = document.getElementById('at-draw-redo-btn');
1603
- redoBtn.classList.add('at_disabled');
1604
- }
1605
- else {
1606
- const redoBtn = document.getElementById('at-draw-redo-btn');
1607
- redoBtn.classList.remove('at_disabled');
1608
- }
1609
- console.log("undoCount", undoCount);
1610
- console.log("redoCount", redoCount);
1611
- }
1612
1616
  function handleVertexPlace(payload) {
1613
1617
  console.log("handleVertexPlace ==>", payload);
1614
1618
  if (isToolbarFeatureEnabled('roomCreation')) {
1615
- log.info("getDrawingMode()", getDrawingMode());
1616
- if (getDrawingMode() === 'window') {
1617
- log.info("current polygon", getCurrentPolygon());
1618
- }
1619
- if (getDrawingMode() === 'partition') {
1620
- // setCurrentPartitionData()
1621
- }
1622
- const undoBtn = document.getElementById('at-draw-undo-btn');
1623
- undoBtn.classList.remove('at_disabled');
1624
- const redoBtn = document.getElementById('at-draw-redo-btn');
1625
- redoBtn.classList.add('at_disabled');
1619
+ toggleUndoRedoButtons(partitionHistory.canUndo(), partitionHistory.canRedo());
1626
1620
  }
1627
1621
  if (isToolbarFeatureEnabled('pipe')) {
1628
1622
  pipeForm.setPipeVertices(payload.path);
@@ -2338,11 +2332,6 @@ function handleCancelPartition() {
2338
2332
  clearSelectedObject();
2339
2333
  clearFloorBaseHeight();
2340
2334
  toggleDisplayPane('at-cancel-room-form-btn');
2341
- const drawHistory = {
2342
- redoDrawActions: [],
2343
- undoDrawActions: [],
2344
- };
2345
- handleDrawHistory(drawHistory);
2346
2335
  }));
2347
2336
  }
2348
2337
  /**
@@ -3944,6 +3933,7 @@ function handlePreviewModalResize() {
3944
3933
  // Handle horizontal resizing
3945
3934
  if (direction === null || direction === void 0 ? void 0 : direction.includes('right')) {
3946
3935
  newWidth = Math.max(minWidth, Math.min(maxWidth, startWidth + deltaX));
3936
+ // Don't change left position for right resize
3947
3937
  }
3948
3938
  else if (direction === null || direction === void 0 ? void 0 : direction.includes('left')) {
3949
3939
  const potentialWidth = startWidth - deltaX;
@@ -76,6 +76,7 @@ export declare class Vertice {
76
76
  texture: THREE.CanvasTexture;
77
77
  pointerSub: MpSdk.ISubscription;
78
78
  pointerIntersection: MpSdk.Pointer.Intersection;
79
+ cachedWallNormal: THREE.Vector3 | null;
79
80
  constructor(mpSdk: MpSdk);
80
81
  inputs: {
81
82
  index: any;
@@ -98,6 +99,7 @@ export declare class Vertice {
98
99
  'INTERACTION.HOVER': boolean;
99
100
  };
100
101
  onInputsUpdated: (prevInputs: any) => void;
102
+ calculateWallNormalFromVertices(): THREE.Vector3 | null;
101
103
  onEvent(eventType: any, data: any): void;
102
104
  onInit: () => void;
103
105
  renderVertice: (hovered?: boolean) => void;
@@ -184,6 +184,10 @@ export class TubeLine {
184
184
  if (this.panel) {
185
185
  this.panel.refresh();
186
186
  }
187
+ dispatchSpaceEvent(SPACE_EVENTS.PATH_UPDATED, {
188
+ path: this.inputs.path,
189
+ textColor: this.inputs.textColor
190
+ });
187
191
  };
188
192
  this.setBillboard = (value) => {
189
193
  this.billboard = value;
@@ -367,6 +371,7 @@ export const tubeLineFactory = function (mpSdk) {
367
371
  };
368
372
  export class Vertice {
369
373
  constructor(mpSdk) {
374
+ this.cachedWallNormal = null;
370
375
  this.inputs = {
371
376
  index: null,
372
377
  radius: 0.1,
@@ -418,6 +423,25 @@ export class Vertice {
418
423
  };
419
424
  this.mpSdk = mpSdk;
420
425
  }
426
+ calculateWallNormalFromVertices() {
427
+ const vertexPath = getVertexPath();
428
+ if (!vertexPath || vertexPath.length < 3) {
429
+ return null;
430
+ }
431
+ const THREE = this.context.three;
432
+ const p0 = new THREE.Vector3(vertexPath[0].x, vertexPath[0].y, vertexPath[0].z);
433
+ const p1 = new THREE.Vector3(vertexPath[1].x, vertexPath[1].y, vertexPath[1].z);
434
+ const p2 = new THREE.Vector3(vertexPath[2].x, vertexPath[2].y, vertexPath[2].z);
435
+ const v1 = new THREE.Vector3().subVectors(p1, p0);
436
+ const v2 = new THREE.Vector3().subVectors(p2, p0);
437
+ const normal = new THREE.Vector3().crossVectors(v1, v2);
438
+ const normalLen = normal.length();
439
+ if (normalLen === 0) {
440
+ // Vertices are collinear, can't determine plane
441
+ return null;
442
+ }
443
+ return normal.normalize();
444
+ }
421
445
  onEvent(eventType, data) {
422
446
  var _a;
423
447
  if (eventType === 'INTERACTION.DRAG') {
@@ -438,24 +462,30 @@ export class Vertice {
438
462
  if (drawingConfig && drawingConfig.lineTypeComponentConfig.drawingMode == 'window') {
439
463
  const firstVertex = getVertexPath()[0];
440
464
  // Skip constraint for first vertex (index 0) - it defines the wall plane
441
- if (this.inputs.index !== 0 && firstVertex && this.pointerIntersection.normal) {
465
+ if (this.inputs.index !== 0 && firstVertex) {
442
466
  const THREE = this.context.three;
443
- // Get wall normal from pointer intersection
444
- const wallNormal = new THREE.Vector3(this.pointerIntersection.normal.x, this.pointerIntersection.normal.y, this.pointerIntersection.normal.z).normalize();
445
- // First vertex position defines a point on the wall plane
446
- const planePoint = new THREE.Vector3(firstVertex.x, firstVertex.y, firstVertex.z);
447
- // Current drag position
448
- const dragPosition = new THREE.Vector3(e.x, e.y, e.z);
449
- // Vector from plane point to drag position
450
- const vecToPoint = new THREE.Vector3().subVectors(dragPosition, planePoint);
451
- // Calculate distance from point to plane along normal
452
- const distanceToPlane = vecToPoint.dot(wallNormal);
453
- // Project point onto plane by removing the perpendicular component
454
- const projectedPosition = new THREE.Vector3().subVectors(dragPosition, wallNormal.clone().multiplyScalar(distanceToPlane));
455
- // Update e with constrained position (stays on wall plane)
456
- e.x = projectedPosition.x;
457
- e.y = projectedPosition.y;
458
- e.z = projectedPosition.z;
467
+ // Use cached normal if available, otherwise fall back to pointer normal
468
+ let wallNormal = this.cachedWallNormal;
469
+ if (!wallNormal && this.pointerIntersection.normal) {
470
+ // Fallback for when we don't have 3 vertices yet
471
+ wallNormal = new THREE.Vector3(this.pointerIntersection.normal.x, this.pointerIntersection.normal.y, this.pointerIntersection.normal.z).normalize();
472
+ }
473
+ if (wallNormal) {
474
+ // First vertex position defines a point on the wall plane
475
+ const planePoint = new THREE.Vector3(firstVertex.x, firstVertex.y, firstVertex.z);
476
+ // Current drag position
477
+ const dragPosition = new THREE.Vector3(e.x, e.y, e.z);
478
+ // Vector from plane point to drag position
479
+ const vecToPoint = new THREE.Vector3().subVectors(dragPosition, planePoint);
480
+ // Calculate distance from point to plane along normal
481
+ const distanceToPlane = vecToPoint.dot(wallNormal);
482
+ // Project point onto plane by removing the perpendicular component
483
+ const projectedPosition = new THREE.Vector3().subVectors(dragPosition, wallNormal.clone().multiplyScalar(distanceToPlane));
484
+ // Update e with constrained position (stays on wall plane)
485
+ e.x = projectedPosition.x;
486
+ e.y = projectedPosition.y;
487
+ e.z = projectedPosition.z;
488
+ }
459
489
  }
460
490
  }
461
491
  this.mesh.position.set(e.x, e.y, e.z);
@@ -480,6 +510,11 @@ export class Vertice {
480
510
  this.pointerIntersection = data;
481
511
  });
482
512
  }
513
+ // Cache wall normal for window mode
514
+ const drawingConfig = getDrawingConfig();
515
+ if (drawingConfig && drawingConfig.lineTypeComponentConfig.drawingMode === 'window') {
516
+ this.cachedWallNormal = this.calculateWallNormalFromVertices();
517
+ }
483
518
  //@ts-expect-error
484
519
  this.notify('changed', {
485
520
  index: this.inputs.index,
@@ -493,6 +528,8 @@ export class Vertice {
493
528
  this.mesh.scale.set(1, 1, 1);
494
529
  this.mpSdk.Pointer.setVisible(true);
495
530
  (_a = this.pointerSub) === null || _a === void 0 ? void 0 : _a.cancel();
531
+ // Clear cached wall normal
532
+ this.cachedWallNormal = null;
496
533
  //renderPolygonFromPath()
497
534
  //@ts-expect-error
498
535
  this.notify('changed', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.15.5",
3
+ "version": "1.15.6",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",
@@ -1262,7 +1262,7 @@
1262
1262
  height: 100%;
1263
1263
  background: rgba(0, 0, 0, 0.8);
1264
1264
  z-index: 1000;
1265
- justify-content: center;
1265
+ justify-content: flex-start;
1266
1266
  align-items: center;
1267
1267
  animation: at_fade-in 0.3s ease;
1268
1268
  }
@@ -1285,15 +1285,16 @@
1285
1285
  color: var(--text-color-light);
1286
1286
  border-radius: var(--border-radius);
1287
1287
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
1288
- width: 95vw;
1288
+ width: 66.5vw;
1289
1289
  height: 95vh;
1290
- max-width: 95vw;
1290
+ max-width: 66.5vw;
1291
1291
  max-height: 95vh;
1292
1292
  overflow: hidden;
1293
1293
  position: relative;
1294
1294
  animation: at_slide-up 0.4s cubic-bezier(.39, .575, .565, 1.000) both;
1295
1295
  display: flex;
1296
1296
  flex-direction: column;
1297
+ margin-left: 0.5vw;
1297
1298
  }
1298
1299
 
1299
1300
  @keyframes at_slide-up {