architwin 1.14.13 → 1.14.15
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.
- package/lib/architwin.d.ts +2 -1
- package/lib/architwin.js +1 -1
- package/lib/atwinui/components/toolbar/i18n.js +6 -2
- package/lib/atwinui/components/toolbar/spacePartition/roomFormPane.js +83 -20
- package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.d.ts +9 -1
- package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.js +219 -57
- package/lib/atwinui/components/toolbar/tagIotFormPane.js +45 -16
- package/lib/atwinui/components/toolbar/viewingRemoteSpace.d.ts +0 -1
- package/lib/atwinui/components/toolbar/viewingRemoteSpace.js +0 -6
- package/lib/atwinui/events.d.ts +3 -1
- package/lib/atwinui/events.js +61 -10
- package/lib/loaders/polydrawerLoader.d.ts +3 -0
- package/lib/loaders/polydrawerLoader.js +26 -22
- package/lib/types.d.ts +5 -0
- package/package.json +1 -1
- package/static/atwinui.css +41 -8
- package/static/utility.css +1 -1
|
@@ -233,7 +233,9 @@ i18n
|
|
|
233
233
|
"ConfirmDeleteWindow": "Are you sure you want to delete this window?",
|
|
234
234
|
"SuccessWindowDelete": "Succesfully deleted window",
|
|
235
235
|
"EnterFloorMaterial": "Enter floor material",
|
|
236
|
-
"EnterWallMaterial": "Enter wall material"
|
|
236
|
+
"EnterWallMaterial": "Enter wall material",
|
|
237
|
+
"Window": "Window",
|
|
238
|
+
"CannotBackDrawingMode": "Cannot go back while drawing mode is active."
|
|
237
239
|
}
|
|
238
240
|
},
|
|
239
241
|
ja: {
|
|
@@ -466,7 +468,9 @@ i18n
|
|
|
466
468
|
"ConfirmDeleteWindow": "本当にこの建具を削除しますか?",
|
|
467
469
|
"SuccessWindowDelete": "建具の削除が完了しました",
|
|
468
470
|
"EnterFloorMaterial": "仕上げ(床)を入力",
|
|
469
|
-
"EnterWallMaterial": "仕上げ(壁)を入力"
|
|
471
|
+
"EnterWallMaterial": "仕上げ(壁)を入力",
|
|
472
|
+
"Window": "建具",
|
|
473
|
+
"CannotBackDrawingMode": "描画モードがアクティブな間は戻ることができません。"
|
|
470
474
|
}
|
|
471
475
|
}
|
|
472
476
|
},
|
|
@@ -41,6 +41,9 @@ let inputFloorMaterial;
|
|
|
41
41
|
let floorMaterial = '';
|
|
42
42
|
let inputWallMaterial;
|
|
43
43
|
let wallMaterial = '';
|
|
44
|
+
let isEditWindow = false;
|
|
45
|
+
let currentEditWindowIndex = null;
|
|
46
|
+
let newlyAddedWindow = null;
|
|
44
47
|
export function renderRoomFormPane() {
|
|
45
48
|
log.info("__@ renderRoomFormPane: ", roomFormMode);
|
|
46
49
|
const element = document.createElement('div');
|
|
@@ -224,8 +227,8 @@ export function toggleDrawPartitionButton() {
|
|
|
224
227
|
}
|
|
225
228
|
}
|
|
226
229
|
export function toggleDrawWindowButton() {
|
|
227
|
-
var _a;
|
|
228
|
-
log.info("toggleDrawWindowButton()", getCurrentPolygon());
|
|
230
|
+
var _a, _b;
|
|
231
|
+
log.info("toggleDrawWindowButton()", getCurrentPolygon(), _3DXObjects);
|
|
229
232
|
setCurrentPolygon(undefined);
|
|
230
233
|
const addDoorButton = document.getElementById('at-add-window-door-btn');
|
|
231
234
|
if (!isDrawing) {
|
|
@@ -238,13 +241,16 @@ export function toggleDrawWindowButton() {
|
|
|
238
241
|
${i18n.t('DoneDrawing')}
|
|
239
242
|
<span class="mdi mdi-check-bold"></span>
|
|
240
243
|
`;
|
|
244
|
+
const objectIndex = _3DXObjects.findIndex(obj => obj.object.id == currentObject.object.id);
|
|
245
|
+
log.info("objectIndex", objectIndex);
|
|
241
246
|
drawingConfig = {
|
|
242
247
|
lineTypeComponentConfig: {
|
|
243
248
|
renderPolygonOnAdd: false,
|
|
244
249
|
drawingMode: drawingMode,
|
|
245
|
-
targetIndex: ((_a = currentWall.windows) === null || _a === void 0 ? void 0 : _a.length)
|
|
250
|
+
targetIndex: (_b = currentEditWindowIndex !== null && currentEditWindowIndex !== void 0 ? currentEditWindowIndex : (_a = currentWall.windows) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0,
|
|
246
251
|
polygonData: currentPolygonData,
|
|
247
|
-
targetUUID: currentWall.uuid
|
|
252
|
+
targetUUID: currentWall.uuid,
|
|
253
|
+
objectIndex: objectIndex
|
|
248
254
|
}
|
|
249
255
|
};
|
|
250
256
|
log.info("drawingConfig", drawingConfig);
|
|
@@ -263,6 +269,19 @@ export function toggleDrawWindowButton() {
|
|
|
263
269
|
`;
|
|
264
270
|
cancelDraw();
|
|
265
271
|
resetDrawingConfig();
|
|
272
|
+
setCurrentPolygon(currentObject);
|
|
273
|
+
let payload;
|
|
274
|
+
if (currentPartitionData) {
|
|
275
|
+
payload = {
|
|
276
|
+
uuid: currentPartitionData.uuid,
|
|
277
|
+
space_uuid: currentPartitionData.space_uuid,
|
|
278
|
+
name: currentPartitionData.name,
|
|
279
|
+
parent_uuid: currentPartitionData.parent_uuid,
|
|
280
|
+
polygon_json: currentPolygonData
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
// Re-render polygon
|
|
284
|
+
renderPolygon(payload);
|
|
266
285
|
}
|
|
267
286
|
}
|
|
268
287
|
/**
|
|
@@ -832,6 +851,9 @@ function displayWindows(window) {
|
|
|
832
851
|
wallMaterial = currentWall.material;
|
|
833
852
|
inputWallMaterial.value = currentWall.material;
|
|
834
853
|
}
|
|
854
|
+
const isEditing = currentEditWindowIndex === window.index;
|
|
855
|
+
const editDisplay = isEditing ? 'none' : 'flex';
|
|
856
|
+
const confirmDisplay = isEditing ? 'flex' : 'none';
|
|
835
857
|
element.innerHTML = `
|
|
836
858
|
<div class="at_dropdown_subitem_container">
|
|
837
859
|
<div class="at_subitem_left">
|
|
@@ -843,16 +865,16 @@ function displayWindows(window) {
|
|
|
843
865
|
<div class="at_distance">${window.area.toFixed(2)} m²</div>
|
|
844
866
|
</div>
|
|
845
867
|
<div class="at_subitem_right">
|
|
846
|
-
<span class="mdi mdi-pencil" id="at-edit-window-btn-${window.index}"></span>
|
|
847
|
-
<span class="mdi mdi-check" id="at-confirm-edit-window-${window.index}" data-cy="at-confirm-edit-window-${window.index}" style="display:
|
|
868
|
+
<span class="mdi mdi-pencil" id="at-edit-window-btn-${window.index}" style="display: ${editDisplay};"></span>
|
|
869
|
+
<span class="mdi mdi-check" id="at-confirm-edit-window-${window.index}" data-cy="at-confirm-edit-window-${window.index}" style="display: ${confirmDisplay};"></span>
|
|
848
870
|
<span class="mdi mdi-delete-outline" id="at-delete-window-btn-${window.index}"></span>
|
|
849
871
|
</div>
|
|
850
872
|
</div>
|
|
851
|
-
<div class="at_edit_name" id="at-edit-window-name-${window.index}" data-index="${window.index}" style="display:
|
|
873
|
+
<div class="at_edit_name" id="at-edit-window-name-${window.index}" data-index="${window.index}" style="display: ${confirmDisplay};">
|
|
852
874
|
<input class="at_edit_name_input" type="text" id="at-edit-window-name-input-${window.index}" data-cy="at-edit-window-name-input-${window.index}" value="${windowName}" placeholder="${i18n.t('EnterNameHere')}">
|
|
853
875
|
</div>
|
|
854
|
-
<div class="at_edit_material" id="at-edit-window-material-${window.index}" data-index="${window.index}" style="display:
|
|
855
|
-
<input class="at_edit_material_input"
|
|
876
|
+
<div class="at_edit_material" id="at-edit-window-material-${window.index}" data-index="${window.index}" style="display: ${confirmDisplay};">
|
|
877
|
+
<input class="at_edit_material_input" type="text" id="at-edit-window-material-input-${window.index}" data-cy="at-edit-window-material-input-${window.index}" value="${(_a = window.material) !== null && _a !== void 0 ? _a : ''}" placeholder="${i18n.t('EnterMaterialHere')}">
|
|
856
878
|
</div>
|
|
857
879
|
`;
|
|
858
880
|
const nameElement = element.querySelector(`#at-window-name-${window.index}`);
|
|
@@ -885,16 +907,28 @@ function setupEditWindow(element, window) {
|
|
|
885
907
|
return;
|
|
886
908
|
// Show inputs when edit icon is clicked
|
|
887
909
|
editBtn.addEventListener("click", () => {
|
|
910
|
+
log.info("window", window);
|
|
888
911
|
editNameContainer.style.display = "flex";
|
|
889
912
|
editMaterialContainer.style.display = "flex";
|
|
890
913
|
editBtn.style.display = "none";
|
|
891
914
|
confirmBtn.style.display = "flex";
|
|
892
915
|
inputName.focus();
|
|
893
|
-
|
|
894
|
-
|
|
916
|
+
isEditWindow = true;
|
|
917
|
+
currentEditWindowIndex = window.index;
|
|
918
|
+
// toggleDrawWindowButton()
|
|
919
|
+
// @ts-ignore
|
|
920
|
+
const windowComponent = {
|
|
921
|
+
inputs: {
|
|
922
|
+
path: window.path
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
log.info("currentObject ", currentObject);
|
|
926
|
+
// setCurrentPolygon(currentObject)
|
|
927
|
+
// enableVerticeControls(windowComponent)
|
|
895
928
|
});
|
|
896
929
|
// // Confirm edit name and material
|
|
897
930
|
confirmBtn.addEventListener("click", () => {
|
|
931
|
+
log.info("3dxobject", _3DXObjects);
|
|
898
932
|
// Update window name
|
|
899
933
|
const newName = inputName.value.trim();
|
|
900
934
|
window.name = newName || window.name;
|
|
@@ -907,12 +941,28 @@ function setupEditWindow(element, window) {
|
|
|
907
941
|
confirmBtn.style.display = "none";
|
|
908
942
|
const windowTooltip = document.getElementById(`at-window-name-tooltip-${window.index}`);
|
|
909
943
|
windowTooltip.innerText = `${window.name}`;
|
|
944
|
+
isEditWindow = false;
|
|
945
|
+
currentEditWindowIndex = null;
|
|
946
|
+
currentWall.windows[window.index] = window;
|
|
947
|
+
const objectIndex = _3DXObjects.findIndex(obj => obj.object.object_id == currentObject.object.object_id);
|
|
948
|
+
if (_3DXObjects[objectIndex].children) {
|
|
949
|
+
_3DXObjects[objectIndex].children.map((win) => __awaiter(this, void 0, void 0, function* () {
|
|
950
|
+
log.info("WIND", win);
|
|
951
|
+
if (win.index == window.index && win.wallUUID == currentWall.uuid) {
|
|
952
|
+
yield disposeModel(win);
|
|
953
|
+
}
|
|
954
|
+
}));
|
|
955
|
+
}
|
|
956
|
+
// toggleDrawWindowButton()
|
|
910
957
|
saveWallChanges();
|
|
911
958
|
});
|
|
912
959
|
}
|
|
913
960
|
function saveWallChanges() {
|
|
961
|
+
log.info("currentWall", currentWall);
|
|
914
962
|
updateWallInPolygon(currentWall);
|
|
915
963
|
updatePartitionData();
|
|
964
|
+
//
|
|
965
|
+
log.info("currentObject", currentObject);
|
|
916
966
|
setCurrentPolygon(currentObject);
|
|
917
967
|
renderCurrentPartition();
|
|
918
968
|
// dispatchSpaceEvent(SPACE_EVENTS.PARTITION_EDITED, { data: currentPartitionData });
|
|
@@ -940,6 +990,7 @@ function renderCurrentPartition() {
|
|
|
940
990
|
parent_uuid: currentPartitionData.parent_uuid,
|
|
941
991
|
polygon_json: currentPolygonData
|
|
942
992
|
};
|
|
993
|
+
log.info("render paylaod", payload);
|
|
943
994
|
renderPolygon(payload);
|
|
944
995
|
}
|
|
945
996
|
function setupDeleteWindow(element, window) {
|
|
@@ -968,6 +1019,18 @@ function setupDeleteWindow(element, window) {
|
|
|
968
1019
|
currentWall = Object.assign(Object.assign({}, wall), { windows: wall.windows.filter((w) => w.index !== window.index) });
|
|
969
1020
|
return currentWall;
|
|
970
1021
|
});
|
|
1022
|
+
const objectIndex = _3DXObjects.findIndex(obj => obj.object.object_id == currentObject.object.object_id);
|
|
1023
|
+
if (objectIndex != null) {
|
|
1024
|
+
log.info("objectIndex", objectIndex);
|
|
1025
|
+
if (_3DXObjects[objectIndex].children) {
|
|
1026
|
+
_3DXObjects[objectIndex].children.map((win) => __awaiter(this, void 0, void 0, function* () {
|
|
1027
|
+
log.info("WIND", win);
|
|
1028
|
+
if (win.index == window.index && win.wallUUID == currentWall.uuid) {
|
|
1029
|
+
yield disposeModel(win);
|
|
1030
|
+
}
|
|
1031
|
+
}));
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
971
1034
|
// Save + rerender window
|
|
972
1035
|
currentObject.object.object_data.json_data = currentPolygonData;
|
|
973
1036
|
saveWallChanges();
|
|
@@ -1007,6 +1070,10 @@ function goBackToPartitionList() {
|
|
|
1007
1070
|
}
|
|
1008
1071
|
function goBackToFloorWallList() {
|
|
1009
1072
|
log.info("goBackToFloorWallList()");
|
|
1073
|
+
if (isDrawing) {
|
|
1074
|
+
notify.error(`${i18n.t('CannotBackDrawingMode')}`);
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1010
1077
|
const elements = {
|
|
1011
1078
|
'at-face-title': 'flex',
|
|
1012
1079
|
'at-window-door-title': 'none',
|
|
@@ -1140,8 +1207,8 @@ export function clearPartitionForm() {
|
|
|
1140
1207
|
displayElement('at-draw-partition-form-btn', 'block');
|
|
1141
1208
|
hideElement('at-add-window-door-btn');
|
|
1142
1209
|
hideElement('at-edit-wall-material');
|
|
1143
|
-
resetDrawingConfig();
|
|
1144
1210
|
cancelDrawing();
|
|
1211
|
+
resetDrawingConfig();
|
|
1145
1212
|
const partitionContainer = document.getElementById('at-partition-item-container');
|
|
1146
1213
|
partitionContainer.style.display = 'none';
|
|
1147
1214
|
const addDoorButton = document.getElementById('at-add-window-door-btn');
|
|
@@ -1165,6 +1232,8 @@ export function clearPartitionForm() {
|
|
|
1165
1232
|
previousPartitionData = null;
|
|
1166
1233
|
isDrawing = false;
|
|
1167
1234
|
drawingMode = null;
|
|
1235
|
+
currentEditWindowIndex = null;
|
|
1236
|
+
isEditWindow = false;
|
|
1168
1237
|
}
|
|
1169
1238
|
/**
|
|
1170
1239
|
* Cancels the drawing action for a partition.
|
|
@@ -1332,12 +1401,6 @@ export function clearTempCurrentPolygon() {
|
|
|
1332
1401
|
*/
|
|
1333
1402
|
export function setPolygonData(payload) {
|
|
1334
1403
|
console.log('setPolygonData()', payload);
|
|
1335
|
-
// let currentObjectData = getCurrentPolygon()
|
|
1336
|
-
// console.log('currentObjectData ', currentObjectData);
|
|
1337
|
-
// if (currentObjectData) {
|
|
1338
|
-
// currentObjectData.object.object_data.json_data = payload
|
|
1339
|
-
// }
|
|
1340
|
-
// setCurrentPolygon(currentObjectData)
|
|
1341
1404
|
// Helper function to round numbers to 2 decimals
|
|
1342
1405
|
function roundToFourDecimals(value) {
|
|
1343
1406
|
if (typeof value === "number") {
|
|
@@ -1436,9 +1499,9 @@ export function setCurrentPartitionData() {
|
|
|
1436
1499
|
displayFaces(currentPolygonData);
|
|
1437
1500
|
}
|
|
1438
1501
|
else if (drawingMode === 'window') {
|
|
1439
|
-
log.info("current wall", currentWall);
|
|
1440
1502
|
// Update current edit wall display
|
|
1441
1503
|
currentWall = currentPolygonData.walls.find(wall => wall.uuid == currentWall.uuid);
|
|
1504
|
+
log.info("current wall", currentWall, currentPolygonData);
|
|
1442
1505
|
const faceVertexContainer = document.getElementById('at-face-vertex-container');
|
|
1443
1506
|
faceVertexContainer.innerHTML = '';
|
|
1444
1507
|
faceVertexContainer.append(displayWall(currentWall));
|
|
@@ -1481,7 +1544,7 @@ function updatePartitionDataArray(payload, currentPartitionDataArray) {
|
|
|
1481
1544
|
}
|
|
1482
1545
|
else if (drawingMode === 'window') {
|
|
1483
1546
|
// Update current partition data
|
|
1484
|
-
currentPartitionData.polygon_json = JSON.stringify(
|
|
1547
|
+
currentPartitionData.polygon_json = JSON.stringify(payload.polygon_json);
|
|
1485
1548
|
// Update current partition data array
|
|
1486
1549
|
const currentPartitionDataIndex = currentPartitionDataArray.findIndex(partitionData => partitionData.uuid = currentPartitionData.uuid);
|
|
1487
1550
|
currentPartitionDataArray[currentPartitionDataIndex] = currentPartitionData;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IObjectData, PartitionNode } from "../../../../types";
|
|
2
|
+
import { Vector3 } from "../../../../../bundle/sdk";
|
|
2
3
|
/**
|
|
3
4
|
* Renders and returns the HTML element for the room tree pane.
|
|
4
5
|
* @returns {HTMLElement} The HTML element representing the room tree pane.
|
|
@@ -69,8 +70,15 @@ export declare function setFilteredDisplay(type: String): void;
|
|
|
69
70
|
*/
|
|
70
71
|
export declare function updateRoomVisibilityUI(parentId: string, isVisible: boolean): void;
|
|
71
72
|
/**
|
|
72
|
-
* Highlights the selected child element within a partition by toggling CSS classes.
|
|
73
|
+
* Highlights the selected child element and toggle expand indicator within a partition by toggling CSS classes.
|
|
73
74
|
* @param partitionId - The unique identifier of the partition containing the child elements
|
|
74
75
|
* @param name - The specific name/identifier of the child element to highlight
|
|
75
76
|
*/
|
|
76
77
|
export declare function highlightSelectedPartitionChild(partitionId: string, name: string): void;
|
|
78
|
+
export declare function toggeleExpandParitionWallChild(partitionId: string, name: string): void;
|
|
79
|
+
export declare function highlightSelectedWallWindow(wallUuid: string, index: number | string): void;
|
|
80
|
+
export declare function toggleHighlightedPartitionItem(): void;
|
|
81
|
+
export declare function toggleHighlightedWindowItem(): void;
|
|
82
|
+
export declare function calculateMidPoint(coords: Array<{
|
|
83
|
+
start: Vector3;
|
|
84
|
+
}>): Vector3;
|
|
@@ -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((
|
|
213
|
-
log.info("__@ partition item: ",
|
|
214
|
-
if (!
|
|
215
|
-
if (!
|
|
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 =
|
|
217
|
+
const match = wall.name.match(/wall-(\d+)$/);
|
|
218
218
|
const wallNumber = parseInt(match[1]) + 1;
|
|
219
|
-
const isVisible =
|
|
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(
|
|
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="
|
|
226
|
-
<div>
|
|
227
|
-
<
|
|
228
|
-
|
|
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">
|
|
244
|
-
<div>
|
|
245
|
-
<
|
|
246
|
-
<
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
676
|
-
|
|
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
|
+
}
|