architwin 1.9.2 → 1.9.4
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 +13 -1
- package/lib/architwin.js +176 -94
- package/lib/atwinui/components/toolbar/i18n.js +2 -0
- package/lib/atwinui/components/toolbar/spacePartition/roomFormPane.d.ts +2 -0
- package/lib/atwinui/components/toolbar/spacePartition/roomFormPane.js +26 -11
- package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.d.ts +39 -5
- package/lib/atwinui/components/toolbar/spacePartition/roomTreePane.js +263 -57
- package/lib/atwinui/events.d.ts +11 -2
- package/lib/atwinui/events.js +343 -121
- package/lib/loaders/polydrawerLoader.d.ts +2 -0
- package/lib/loaders/polydrawerLoader.js +29 -5
- package/lib/types.d.ts +13 -3
- package/lib/utils.d.ts +6 -0
- package/lib/utils.js +15 -0
- package/package.json +1 -1
- package/static/atwinui.css +1 -1
- package/static/utility.css +4 -0
|
@@ -8,12 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { getBundleVersion, extractUUID } from "../../../../utils";
|
|
11
|
-
import { batchAddEventListenerByClassName,
|
|
11
|
+
import { batchAddEventListenerByClassName, handlePartitionVisibility, handlePolygonVisibility, toggleDisplayPane } from "../../../events";
|
|
12
12
|
import i18n from "../i18n";
|
|
13
13
|
import { setPartitionFormMode } from "./roomFormPane";
|
|
14
|
-
import {
|
|
14
|
+
import { SPACE_EVENTS } from "../../../../types";
|
|
15
|
+
import { _3DXObjects, dispatchSpaceEvent, getChildrenOfModel } from "../../../../architwin";
|
|
15
16
|
let roomDataArray = [];
|
|
16
17
|
let currentEditRoomData = null;
|
|
18
|
+
let currentSelectedPartitionId = null;
|
|
19
|
+
let currentFilteredDisplay = "All";
|
|
17
20
|
/**
|
|
18
21
|
* Renders and returns the HTML element for the room tree pane.
|
|
19
22
|
* @returns {HTMLElement} The HTML element representing the room tree pane.
|
|
@@ -67,9 +70,11 @@ export function renderRoomTreePane() {
|
|
|
67
70
|
* Displays the UI for the Room tree structure.
|
|
68
71
|
* @param partitions - Details of the partitions to construct the tree.
|
|
69
72
|
*/
|
|
70
|
-
export function displayRoomTree(partitions) {
|
|
71
|
-
console.log("__@ displayRoomTree");
|
|
73
|
+
export function displayRoomTree(partitions, objectData) {
|
|
74
|
+
console.log("__@ displayRoomTree partitions ", partitions);
|
|
72
75
|
console.info("__@ Room tree _3DXObjects: ", _3DXObjects);
|
|
76
|
+
console.info("__@ Room tree objectData: ", objectData);
|
|
77
|
+
const filteredDisplay = filteredData(partitions);
|
|
73
78
|
try {
|
|
74
79
|
// Target the at-room-tree container
|
|
75
80
|
const roomTreeContainer = document.getElementById('at-room-tree');
|
|
@@ -79,12 +84,12 @@ export function displayRoomTree(partitions) {
|
|
|
79
84
|
const rootUl = document.createElement('ul');
|
|
80
85
|
rootUl.classList.add('at_room_tree');
|
|
81
86
|
// Iterate over each room
|
|
82
|
-
|
|
83
|
-
const partitionItem =
|
|
87
|
+
filteredDisplay.forEach((item) => {
|
|
88
|
+
const partitionItem = displayRoomPartition(item, objectData);
|
|
84
89
|
roomTreeContainer.appendChild(partitionItem);
|
|
85
90
|
if (item.children.length > 0) {
|
|
86
|
-
// Render
|
|
87
|
-
|
|
91
|
+
// Render child partitions
|
|
92
|
+
displayChildPartitions(item.children, item.uuid, objectData);
|
|
88
93
|
}
|
|
89
94
|
});
|
|
90
95
|
// Append the root <ul> to the #at-room-tree container
|
|
@@ -101,16 +106,20 @@ export function displayRoomTree(partitions) {
|
|
|
101
106
|
* @param {PartitionNode} partition - The details of the room to be rendered.
|
|
102
107
|
* @returns {HTMLElement}
|
|
103
108
|
*/
|
|
104
|
-
export function
|
|
109
|
+
export function displayRoomPartition(partition, objectData) {
|
|
110
|
+
console.log("__@ displayPartition partition ", objectData);
|
|
105
111
|
const element = document.createElement('ul');
|
|
106
112
|
element.classList.add('at_room_tree');
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
const isVisible = objectData ? objectData.some(obj => obj.component.mesh.children.some(child => child.visible)) : false;
|
|
115
|
+
console.log("__@ isVisible", isVisible);
|
|
107
116
|
element.innerHTML = `
|
|
108
117
|
<li class="at_room_tree_parent">
|
|
109
118
|
<div class="at_flex at_space_between at_toggle">
|
|
110
|
-
<span class="toggle selectable" >▶ ${partition.name}</span>
|
|
119
|
+
<span class="toggle selectable" id="at-room-${partition.uuid}">▶ ${partition.name}</span>
|
|
111
120
|
<div>
|
|
112
121
|
<span id="at-room-edit-${partition.uuid}-btn" class="mdi mdi-pencil at_room_edit_btn" target-pane="at-room-form-pane"></span>
|
|
113
|
-
<span id="at-room-visibility-${partition.uuid}
|
|
122
|
+
<span id="at-room-visibility-btn-${partition.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_room_visible_btn"></span>
|
|
114
123
|
</div>
|
|
115
124
|
</div>
|
|
116
125
|
<ul id="at-partition-container-${partition.uuid}" class="hidden">
|
|
@@ -125,69 +134,100 @@ export function displayPartition(partition) {
|
|
|
125
134
|
* @param partitionId - The identifier of the room to which the partitions belong.
|
|
126
135
|
* @returns {HTMLElement}
|
|
127
136
|
*/
|
|
128
|
-
export function
|
|
129
|
-
console.log("__@
|
|
130
|
-
const partitionContainer = document.getElementById(`at-partition-container-${
|
|
131
|
-
if (partitionContainer)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<ul id="at-partition-items-container-${partition.uuid}" class="hidden">
|
|
146
|
-
`;
|
|
147
|
-
const polygonJson = JSON.parse(partition.polygon_json);
|
|
148
|
-
console.log("artition polygon data: ", polygonJson);
|
|
149
|
-
if (polygonJson && polygonJson.floor && polygonJson.walls) {
|
|
150
|
-
// Render floor
|
|
151
|
-
partitionHTML += displayPartitionItems(polygonJson.floor);
|
|
152
|
-
// Render walls
|
|
153
|
-
if (polygonJson.walls.length > 0) {
|
|
154
|
-
partitionHTML += displayPartitionItems(polygonJson.walls);
|
|
155
|
-
}
|
|
137
|
+
export function displayChildPartitions(partitions, parentPartitionId, objectData) {
|
|
138
|
+
console.log("__@ displayChildPartitions objectData: ", objectData);
|
|
139
|
+
const partitionContainer = document.getElementById(`at-partition-container-${parentPartitionId}`);
|
|
140
|
+
if (!partitionContainer)
|
|
141
|
+
return;
|
|
142
|
+
// Clear existing content
|
|
143
|
+
partitionContainer.innerHTML = '';
|
|
144
|
+
const partitionHTML = partitions.map((partition, index) => {
|
|
145
|
+
let objectId = 0;
|
|
146
|
+
let modelChildren = [];
|
|
147
|
+
let polygonObj;
|
|
148
|
+
// Find object data
|
|
149
|
+
if (objectData) {
|
|
150
|
+
polygonObj = objectData.find((obj) => obj.object.object_data.uuid === partition.uuid);
|
|
151
|
+
if (polygonObj) {
|
|
152
|
+
objectId = polygonObj.object.id;
|
|
153
|
+
modelChildren = getChildrenOfModel(polygonObj.component).filter((model) => model.name !== '' && !model.name.includes('wallLabel') && !model.name.includes('edgeLabel'));
|
|
156
154
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
155
|
+
}
|
|
156
|
+
// Parse polygon_json data
|
|
157
|
+
const polygonJson = partition.polygon_json ? JSON.parse(partition.polygon_json) : null;
|
|
158
|
+
console.log("Partition polygon data: ", polygonJson);
|
|
159
|
+
let childHTML = '';
|
|
160
|
+
console.log("modelChildren: ", modelChildren);
|
|
161
|
+
if (polygonJson && polygonJson.floor && polygonJson.walls) {
|
|
162
|
+
// Render floor
|
|
163
|
+
const floorObj = modelChildren.find(item => item.name.includes('floor'));
|
|
164
|
+
console.log("modelChildren floorObj: ", floorObj);
|
|
165
|
+
childHTML += displayPartitionItems(polygonJson.floor, partition.uuid, floorObj);
|
|
166
|
+
// Render walls
|
|
167
|
+
if (polygonJson.walls.length > 0) {
|
|
168
|
+
// modelChildren.splice(index, 1); // Remove processed child
|
|
169
|
+
const wallObjs = modelChildren.filter(item => !item.name.includes("floor"));
|
|
170
|
+
console.log("modelChildren wallObjs: ", wallObjs);
|
|
171
|
+
childHTML += displayPartitionItems(polygonJson.walls, partition.uuid, wallObjs);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
// @ts-ignore
|
|
175
|
+
const isVisible = polygonObj ? polygonObj.component.mesh.children.find(child => child.visible === true) : false;
|
|
176
|
+
console.log("__@ child isVisible ", isVisible);
|
|
177
|
+
return `
|
|
178
|
+
|
|
179
|
+
<li class="at_room_tree_child">
|
|
180
|
+
<div id="at-child-partition-${partition.uuid.split('-')[0]}" class="at_flex at_space_between at_toggle">
|
|
181
|
+
<span class="toggle selectable" id="at-partition-${partition.uuid}" parentId="at-partition-${parentPartitionId}">▶ ${i18n.t(`${partition.name}`)}</span>
|
|
182
|
+
<div>
|
|
183
|
+
<span id="at-partition-visibility-btn-${objectId}" parent-id="${parentPartitionId}"
|
|
184
|
+
class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_room_visible_btn"></span>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
<ul id="at-partition-items-container-${objectId}" class="hidden">
|
|
188
|
+
${childHTML}
|
|
189
|
+
</ul>
|
|
190
|
+
</li>
|
|
191
|
+
`;
|
|
192
|
+
}).join(''); // Combine all partition HTML strings into one
|
|
193
|
+
// Append the built HTML string to the container
|
|
194
|
+
partitionContainer.innerHTML = partitionHTML;
|
|
161
195
|
}
|
|
162
196
|
/**s
|
|
163
197
|
* Displays the items within a specific partition.
|
|
164
198
|
* @param partitionItems - The details of the partition items to be rendered.
|
|
165
199
|
* @returns {HTMLElement}
|
|
166
200
|
*/
|
|
167
|
-
export function displayPartitionItems(partitionItems) {
|
|
168
|
-
console.log("__@ displayPartitionItems: ",
|
|
201
|
+
export function displayPartitionItems(partitionItems, partitionId, object) {
|
|
202
|
+
console.log("__@ displayPartitionItems: ", object === null || object === void 0 ? void 0 : object.name);
|
|
169
203
|
let itemsHTML = '';
|
|
170
204
|
// Check if item is an array, e.g.: walls
|
|
171
205
|
if (Array.isArray(partitionItems)) {
|
|
172
206
|
// This is for the walls
|
|
173
|
-
partitionItems.forEach(item => {
|
|
207
|
+
partitionItems.forEach((item, index) => {
|
|
174
208
|
console.log("__@ partition item: ", item);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
209
|
+
if (!item.hide) {
|
|
210
|
+
// Split wall name to localize
|
|
211
|
+
const match = item.name.match(/_wall-(\d+)$/);
|
|
212
|
+
const isVisible = item.options.is_visible;
|
|
213
|
+
itemsHTML += `
|
|
214
|
+
<li class="at_toggle">${i18n.t(`Wall`)} ${match[1]}
|
|
215
|
+
<span id="${object[index].name}" partition-id="${partitionId}" polygon-item-id="${item.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn at_pull_right"></span>
|
|
216
|
+
</li>
|
|
217
|
+
`;
|
|
218
|
+
}
|
|
182
219
|
});
|
|
183
220
|
}
|
|
184
221
|
else {
|
|
185
222
|
// This is for the floor
|
|
186
|
-
|
|
223
|
+
const isVisible = partitionItems.options.is_visible;
|
|
224
|
+
if (!partitionItems.hide) {
|
|
225
|
+
itemsHTML += `
|
|
187
226
|
<li class="at_toggle"> ${i18n.t(`${partitionItems.name}`)}
|
|
188
|
-
<span id="
|
|
227
|
+
<span id="${object.name}" partition-id="${partitionId}" polygon-item-id="${partitionItems.uuid}" class="mdi ${isVisible ? 'mdi-eye ' : 'mdi-eye-off'} at_child_visible_btn at_pull_right"></span>
|
|
189
228
|
</li>
|
|
190
229
|
`;
|
|
230
|
+
}
|
|
191
231
|
}
|
|
192
232
|
return itemsHTML;
|
|
193
233
|
}
|
|
@@ -199,6 +239,13 @@ function toggleSelectedPartition() {
|
|
|
199
239
|
try {
|
|
200
240
|
document.querySelectorAll('.at_room_tree .toggle, .at_room_tree .selectable').forEach(function (item) {
|
|
201
241
|
item.addEventListener('click', function (event) {
|
|
242
|
+
const targetElement = event.target;
|
|
243
|
+
const partitionId = extractUUID(targetElement.id);
|
|
244
|
+
setSelectedPartitionId(partitionId);
|
|
245
|
+
if (item.getAttribute('parentId')) {
|
|
246
|
+
const parentId = extractUUID(item.getAttribute('parentId'));
|
|
247
|
+
setSelectedPartitionId(parentId);
|
|
248
|
+
}
|
|
202
249
|
// Prevent event from propagating to parent elements
|
|
203
250
|
event.stopPropagation();
|
|
204
251
|
// Find the parent div of the clicked toggle
|
|
@@ -254,7 +301,11 @@ function toggleSelectedPartition() {
|
|
|
254
301
|
// Highlight selected item
|
|
255
302
|
highlightSelectedItem(event);
|
|
256
303
|
// Handle visibility logic
|
|
257
|
-
|
|
304
|
+
handlePartitionVisibility(target.id);
|
|
305
|
+
}));
|
|
306
|
+
batchAddEventListenerByClassName('at_child_visible_btn', (event) => __awaiter(this, void 0, void 0, function* () {
|
|
307
|
+
const target = event.target;
|
|
308
|
+
handlePolygonVisibility(target.id);
|
|
258
309
|
}));
|
|
259
310
|
}
|
|
260
311
|
/**
|
|
@@ -299,6 +350,32 @@ export function updateParentVisibility(isPartition, currentBtn) {
|
|
|
299
350
|
}
|
|
300
351
|
}
|
|
301
352
|
}
|
|
353
|
+
function filteredData(data) {
|
|
354
|
+
const displayFilter = getFilteredDisplay();
|
|
355
|
+
let filtredData;
|
|
356
|
+
if (displayFilter === "All") {
|
|
357
|
+
filtredData = data;
|
|
358
|
+
}
|
|
359
|
+
else if (["Floor", "Wall"].includes(displayFilter)) {
|
|
360
|
+
const keyToHide = displayFilter === "Floor" ? "walls" : "floor";
|
|
361
|
+
filtredData = data.map(node => (Object.assign(Object.assign({}, node), { children: node.children.map(partition => {
|
|
362
|
+
if (!partition.polygon_json)
|
|
363
|
+
return partition;
|
|
364
|
+
const polygonData = JSON.parse(partition.polygon_json);
|
|
365
|
+
if (keyToHide === "walls" && Array.isArray(polygonData.walls)) {
|
|
366
|
+
polygonData.walls.forEach(wall => wall.hide = true);
|
|
367
|
+
}
|
|
368
|
+
else if (keyToHide === "floor" && polygonData.floor) {
|
|
369
|
+
polygonData.floor.hide = true;
|
|
370
|
+
}
|
|
371
|
+
return Object.assign(Object.assign({}, partition), { polygon_json: JSON.stringify(polygonData) });
|
|
372
|
+
}) })));
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
throw new Error("Invalid filter value");
|
|
376
|
+
}
|
|
377
|
+
return filtredData;
|
|
378
|
+
}
|
|
302
379
|
/**
|
|
303
380
|
* Sets the room data for the application.
|
|
304
381
|
* @param rooms - An array of room nodes to be stored.
|
|
@@ -310,7 +387,7 @@ function setRoomData(rooms) {
|
|
|
310
387
|
* Retrieves the stored room data.
|
|
311
388
|
* @returns An array of room nodes.
|
|
312
389
|
*/
|
|
313
|
-
function getRoomData() {
|
|
390
|
+
export function getRoomData() {
|
|
314
391
|
return roomDataArray;
|
|
315
392
|
}
|
|
316
393
|
/**
|
|
@@ -328,3 +405,132 @@ function setCurrentEditRoomData(id) {
|
|
|
328
405
|
export function getCurrentEditRoomData() {
|
|
329
406
|
return currentEditRoomData;
|
|
330
407
|
}
|
|
408
|
+
function setSelectedPartitionId(partitionId) {
|
|
409
|
+
currentSelectedPartitionId = partitionId;
|
|
410
|
+
}
|
|
411
|
+
export function getSelectedPartitionId() {
|
|
412
|
+
return currentSelectedPartitionId;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Updates the visibility of a partition and its children if it's a parent partition.
|
|
416
|
+
* @param isVisible - The visibility state to set (true/false).
|
|
417
|
+
* @param currPartition - The current partition node to update.
|
|
418
|
+
* @param isParentPartition - Indicates if the current partition is a parent (true) or a child (false).
|
|
419
|
+
*/
|
|
420
|
+
export function updatePartitionVisibilityUI(isVisible, currPartition, isParentPartition, isUpdateAllChildren) {
|
|
421
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
422
|
+
console.log("updatePartitionVisibilityUI currPartition: ", currPartition);
|
|
423
|
+
if (!currPartition) {
|
|
424
|
+
console.error("Invalid partition");
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if (isParentPartition) {
|
|
428
|
+
// Auto update visibility of all children
|
|
429
|
+
currPartition.children.forEach((child) => __awaiter(this, void 0, void 0, function* () {
|
|
430
|
+
yield updatePolygonData(child, isVisible, isUpdateAllChildren);
|
|
431
|
+
}));
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
// Children: Ex: Partition 1
|
|
435
|
+
yield updatePolygonData(currPartition, isVisible, isUpdateAllChildren);
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Updates the visibility of a specific polygon (floor or wall) within a partition.
|
|
441
|
+
* @param isVisible - The visibility state to set (true/false).
|
|
442
|
+
* @param currPartition - The current partition node containing the polygon data.
|
|
443
|
+
* @param isFloor - Indicates if the target is a floor (true) or a wall (false).
|
|
444
|
+
* @param polygonItemId - The ID of the specific polygon (floor or wall) to update.
|
|
445
|
+
*/
|
|
446
|
+
export function updatePolygonVisibilityData(isVisible, currPartition, isFloor, polygonItemId) {
|
|
447
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
448
|
+
console.log("updatePolygonVisibility:", currPartition, isFloor, polygonItemId);
|
|
449
|
+
if (currPartition) {
|
|
450
|
+
let targetItem = null;
|
|
451
|
+
// Parse polygon_json data
|
|
452
|
+
const polygonJson = JSON.parse(currPartition.polygon_json);
|
|
453
|
+
// Check if floor or walls
|
|
454
|
+
if (isFloor) {
|
|
455
|
+
console.log("FLOOR!");
|
|
456
|
+
// FLOOR
|
|
457
|
+
targetItem = polygonJson.floor.uuid === polygonItemId ? polygonJson.floor : null;
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
console.log("WALL!");
|
|
461
|
+
// WALLS
|
|
462
|
+
targetItem = polygonJson.walls.find(item => item.uuid === polygonItemId) || null;
|
|
463
|
+
}
|
|
464
|
+
if (targetItem) {
|
|
465
|
+
targetItem.options.is_visible = isVisible;
|
|
466
|
+
// Update and dispatch event
|
|
467
|
+
currPartition.polygon_json = JSON.stringify(polygonJson);
|
|
468
|
+
console.log("Updated currPartition:", currPartition);
|
|
469
|
+
// Dispatch event: PARTITION_EDITED
|
|
470
|
+
dispatchSpaceEvent(SPACE_EVENTS.PARTITION_EDITED, { data: currPartition, isUpdateTree: false });
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
console.warn("Target not found.");
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Helper function to update the visibility and dispatch PARTITION_EDITED event.
|
|
480
|
+
* @param currPartition - The partition node to update.
|
|
481
|
+
* @param isVisible - The visibility state to set (true/false).
|
|
482
|
+
*/
|
|
483
|
+
function updatePolygonData(currPartition, isVisible, isUpdateAllChildren) {
|
|
484
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
485
|
+
const polygonJson = currPartition.polygon_json ? JSON.parse(currPartition.polygon_json) : {};
|
|
486
|
+
// Update visibility in polygon_json
|
|
487
|
+
if (!isUpdateAllChildren) {
|
|
488
|
+
polygonJson.options.is_visible = isVisible;
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
console.log("polygonJson: ", polygonJson, isVisible);
|
|
492
|
+
if (isUpdateAllChildren) {
|
|
493
|
+
// Update floor and walls same with Partition visibility
|
|
494
|
+
polygonJson.floor.options.is_visible = isVisible;
|
|
495
|
+
polygonJson.walls.forEach(wall => {
|
|
496
|
+
wall.options.is_visible = isVisible;
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
currPartition.polygon_json = JSON.stringify(polygonJson);
|
|
501
|
+
console.log("updatePolygonData: ", JSON.parse(currPartition.polygon_json));
|
|
502
|
+
// Dispatch event: PARTITION_EDITED
|
|
503
|
+
dispatchSpaceEvent(SPACE_EVENTS.PARTITION_EDITED, { data: currPartition, isUpdateTree: false });
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Toggles the target element visibility state.
|
|
508
|
+
* @param element - Target HTML element.
|
|
509
|
+
* @param isVisible - Visibility state of the element.
|
|
510
|
+
*/
|
|
511
|
+
export function toggleVisibilityState(element, isVisible) {
|
|
512
|
+
element.classList.toggle('mdi-eye', isVisible);
|
|
513
|
+
element.classList.toggle('mdi-eye-off', !isVisible);
|
|
514
|
+
}
|
|
515
|
+
export function setFilteredDisplay(type) {
|
|
516
|
+
// Types - 'All', 'Floor', 'Wall'
|
|
517
|
+
// All : display all
|
|
518
|
+
// Floor : display floors only
|
|
519
|
+
// Wall : display walls only
|
|
520
|
+
currentFilteredDisplay = type;
|
|
521
|
+
}
|
|
522
|
+
function getFilteredDisplay() {
|
|
523
|
+
return currentFilteredDisplay;
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Toggles the visibility button state of the target room.
|
|
527
|
+
* @param parentId - ID of the room
|
|
528
|
+
* @param isVisible - Visibility value
|
|
529
|
+
*/
|
|
530
|
+
export function updateRoomVisibilityUI(parentId, isVisible) {
|
|
531
|
+
const roomElement = document.getElementById(`at-room-visibility-btn-${parentId}`);
|
|
532
|
+
console.log("roomElement: ", roomElement);
|
|
533
|
+
if (isVisible && roomElement.classList.contains('mdi-eye-off')) {
|
|
534
|
+
toggleVisibilityState(roomElement, true);
|
|
535
|
+
}
|
|
536
|
+
}
|
package/lib/atwinui/events.d.ts
CHANGED
|
@@ -13,5 +13,14 @@ declare function handleShowMinimap(): void;
|
|
|
13
13
|
declare function handleScrollToView(scrollContainerId: string, targetId: string): void;
|
|
14
14
|
declare function handleRenderMeetingUI(): void;
|
|
15
15
|
declare function setupSpaceEventSubscriptions(): void;
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Toggles the visibility of the partitions within a room tree.
|
|
18
|
+
* @param {string} targetId - ID of the target partition element.
|
|
19
|
+
*/
|
|
20
|
+
declare function handlePartitionVisibility(targetId: string): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Toggles the visibility of the child partitions within a partition tree. (FLOOR and WALLS)
|
|
23
|
+
* @param {string} targetId - ID of the target partition element.
|
|
24
|
+
*/
|
|
25
|
+
declare function handlePolygonVisibility(targetId: string): Promise<void>;
|
|
26
|
+
export { activeToolbarItem, activeActionItem, cancelModelPlacementPrompt, batchAddEventListenerById, batchAddEventListenerByClassName, batchAddEventListenerByClassNames, setActiveToolbarItem, toggleDisplayPane, toggleActionBar, setupIndividualEventListeners, setupSpaceEventSubscriptions, handleModelVisibility, handleDeleteModel, handleShowMinimap, handleScrollToView, handleRenderMeetingUI, handlePartitionVisibility, handlePolygonVisibility, };
|