architwin 1.14.1 → 1.14.3

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.
@@ -16,6 +16,7 @@ import { Notyf } from 'notyf';
16
16
  import i18n from './i18n';
17
17
  import { getBasepoint, getCoordinateSystem, getMeasurementUnit, getMPBasepoint, getScaleFactor } from "./actionSettingsPane";
18
18
  import { convertYupScaleToZupScale } from "../../../worldConversion";
19
+ import { toggleActionBarButtons } from "../../components/toolbar";
19
20
  let activeCard, activeLibraryCard;
20
21
  let _basePath = '../../../../architwin/static';
21
22
  export function renderObjectCard(payload, objectComponent) {
@@ -161,6 +162,10 @@ export function setActiveCard(cardId) {
161
162
  //@ts-expect-error
162
163
  transformHistory.addAction(selected.object.id, selected.node.position, selected.node.obj3D.rotation, selected.node.scale);
163
164
  }
165
+ if (_mpConfig.toolbarConfig) {
166
+ toggleActionBarButtons('at-redo-action-btn', transformHistory.canRedo(selected.object.id));
167
+ toggleActionBarButtons('at-undo-action-btn', transformHistory.canUndo(selected.object.id));
168
+ }
164
169
  });
165
170
  }
166
171
  export function clearActiveCard() {
@@ -196,6 +196,12 @@ i18n
196
196
  "HideShowAllPipes": "Hide/Show All Pipes",
197
197
  "Pipe": "Pipe",
198
198
  "Vertex": "Vertex",
199
+ "ConfirmDeleteVertex": "Are you sure you want to delete this vertex?",
200
+ "DeleteVertex": "Delete vertex",
201
+ "Ascending": "Ascending",
202
+ "Descending": "Descending",
203
+ "Newest": "Newest",
204
+ "Oldest": "Oldest",
199
205
  "ScreenShare": "Screen Share",
200
206
  "Users": "Users",
201
207
  "EndSession": "End Session",
@@ -390,7 +396,7 @@ i18n
390
396
  "EditPipeType": "矢印マーカー種別を編集",
391
397
  "PipeTypeName": "矢印マーカー名",
392
398
  "CategoryColor": "矢印マーカー色",
393
- "NoPipesToDisplay": "表示する快感がありません",
399
+ "NoPipesToDisplay": "表示する矢印マーカーがありません",
394
400
  "DrawPipe": " 矢印マーカーを描画",
395
401
  "NoVertexToDisplay": "表示する頂点がありません",
396
402
  "NoPipesTypeToDisplay": "表示する矢印マーカー種別がありません",
@@ -412,6 +418,12 @@ i18n
412
418
  "HideShowAllPipes": "全ての矢印マーカーを表示/非表示",
413
419
  "Pipe": "矢印マーカー",
414
420
  "Vertex": "頂点",
421
+ "ConfirmDeleteVertex": "この頂点を削除してもよろしいですか?",
422
+ "DeleteVertex": "削除",
423
+ "Ascending": "オブジェクト名称昇順",
424
+ "Descending": "オブジェクト名称降順",
425
+ "Newest": "新しく登録された順",
426
+ "Oldest": "古く登録された順",
415
427
  "Screen Share": "画面共有",
416
428
  "Users": "ユーザー",
417
429
  "EndSession": "画面共有を終了",
@@ -51,9 +51,9 @@ export function renderMenuBar(iFrame) {
51
51
  <span class="mdi mdi-arrow-decision" id="at-pipe-btn" data-cy="at-pipe-btn" target-pane="at-pipe-list-pane"></span>
52
52
  <div class="at_icon_tooltip" data-cy="at-tooltip-pipe">${i18n.t('Pipes')}</div>
53
53
  </div>
54
- <div class="at_sidebar_button_icon" style="display:${isThemeEnabled ? 'block' : 'none'}">
55
- <span class="mdi mdi-palette" id="at-theme-picker-btn" data-cy="at-theme-picker-btn" target-pane="at-theme-pane"></span>
56
- <div class="at_icon_tooltip" data-cy="at-tooltip-theme">${i18n.t('Theme')}</div>
54
+ <div class="at_sidebar_button_icon" style="display:${isSpaceScreenSharingEnabled ? 'block' : 'none'}">
55
+ <span class="mdi mdi-monitor-multiple" id="at-screen-share-btn" data-cy="at-screen-share-pane" target-pane="at-screen-share-pane"></span>
56
+ <div class="at_icon_tooltip" data-cy="at-tooltip-screen-share">${i18n.t('Screen Share')}</div>
57
57
  </div>
58
58
  <div class="at_sidebar_button_icon" style="display:${isRoomCreationEnabled ? 'block' : 'none'}">
59
59
  <span class="mdi mdi-ruler-square-compass" id="at-room-creation-btn" data-cy="at-room-creation-btn" target-pane="at-room-tree-pane"></span>
@@ -63,14 +63,14 @@ export function renderMenuBar(iFrame) {
63
63
  <img class="mdi at_bim_settings_img" src="${bimImageIcon}" alt="bim" id="at-settings-btn" data-cy="at-settings-btn" target-pane="at-settings-pane"/>
64
64
  <div class="at_icon_tooltip" data-cy="at-tooltip-settings">${i18n.t('Settings')}</div>
65
65
  </div>
66
+ <div class="at_sidebar_button_icon" style="display:${isThemeEnabled ? 'block' : 'none'}">
67
+ <span class="mdi mdi-palette" id="at-theme-picker-btn" data-cy="at-theme-picker-btn" target-pane="at-theme-pane"></span>
68
+ <div class="at_icon_tooltip" data-cy="at-tooltip-theme">${i18n.t('Theme')}</div>
69
+ </div>
66
70
  <div class="at_sidebar_button_icon" style="display:${isGeneralSettingsEnabled ? 'block' : 'none'}">
67
71
  <span class="mdi mdi-cog-outline" id="at-general-setting-btn" data-cy="at-general-setting-btn" target-pane="at-general-setting-pane"></span>
68
72
  <div class="at_icon_tooltip" data-cy="at-tooltip-general-setting">${i18n.t('General Settings')}</div>
69
73
  </div>
70
- <div class="at_sidebar_button_icon" style="display:${isSpaceScreenSharingEnabled ? 'block' : 'none'}">
71
- <span class="mdi mdi-monitor-multiple" id="at-screen-share-btn" data-cy="at-screen-share-pane" target-pane="at-screen-share-pane"></span>
72
- <div class="at_icon_tooltip" data-cy="at-tooltip-screen-share">${i18n.t('Screen Share')}</div>
73
- </div>
74
74
  `;
75
75
  return menuBarElement;
76
76
  }
@@ -1,12 +1,12 @@
1
1
  import { convertMeasurement, degreesToRadians, percentToScale, radiansToDegrees, scaleToPercent, useCapitalizeFirstLetter } from "../../../utils";
2
- import { getSelectedObject, setObjectTransformation, get3DXObjects, _mpConfig, _3DXObjects, isToolbarFeatureEnabled, actionHistory, transformHistory } from "../../../architwin";
2
+ import { getSelectedObject, setObjectTransformation, get3DXObjects, _3DXObjects, isToolbarFeatureEnabled } from "../../../architwin";
3
3
  import { COORDINATE_SYSTEM, UNITS } from "../../../types";
4
4
  import { convertZupToYup, convertYupToZup, getOffsetPositionFromBasepoint, convertYupScaleToZupScale, convertZupScaleToYupScale } from "../../../worldConversion";
5
5
  import { getScaleFactor, getMeasurementUnit, getBasepoint, getCoordinateSystem, isAdjust, getMPBasepoint, getRotationUnit } from "./actionSettingsPane";
6
6
  import { Notyf } from 'notyf';
7
7
  import log from 'loglevel';
8
8
  import i18n from "./i18n";
9
- import { toggleActionBarButtons } from "../../components/toolbar";
9
+ // import { toggleActionBarButtons } from "../../components/toolbar"
10
10
  let notyf = new Notyf({ position: { x: 'left', y: 'bottom' }, duration: 4500 });
11
11
  export let activeModelControlPane = false;
12
12
  export let modelControlPane;
@@ -290,23 +290,23 @@ export function getCoordinateValues() {
290
290
  transform.object_scale = transformType === 'scale' ? mpScale : selectedObject.node.scale;
291
291
  transform.object_rotation = transformType === 'rotate' ? mpRotation : selectedObject.object.object_rotation;
292
292
  console.log("caroline input transform", transform, formCoords);
293
- if (transform && formCoords) {
294
- console.log("caroline input undo coordinates", transform, formCoords);
295
- setObjectTransformation(selectedObject.node, transform);
296
- //Add to the action history so it can be reverse with undo or redo
297
- console.log("caroline input undo test", formCoords);
298
- const currentTransform = JSON.stringify(formCoords);
299
- if (currentTransform) {
300
- console.log("caroline input current transform", transform, currentTransform);
301
- actionHistory.push(currentTransform);
302
- // @ts-expect-error
303
- transformHistory.addAction(selectedObject.object.id, transform.object_position, transform.object_rotation, transform.object_scale);
304
- }
305
- if (_mpConfig.toolbarConfig) {
306
- toggleActionBarButtons('at-redo-action-btn', transformHistory.canRedo(selectedObject.object.id));
307
- toggleActionBarButtons('at-undo-action-btn', transformHistory.canUndo(selectedObject.object.id));
308
- }
309
- }
293
+ // if (transform && formCoords) {
294
+ // console.log("caroline input undo coordinates", transform, formCoords)
295
+ // setObjectTransformation(selectedObject.node, transform)
296
+ // //Add to the action history so it can be reverse with undo or redo
297
+ // console.log("caroline input undo test", formCoords)
298
+ // const currentTransform = JSON.stringify(formCoords)
299
+ // if (currentTransform) {
300
+ // console.log("caroline input current transform", transform, currentTransform)
301
+ // actionHistory.push(currentTransform)
302
+ // // @ts-expect-error
303
+ // transformHistory.addAction(selectedObject.object.id, transform.object_position, transform.object_rotation, transform.object_scale)
304
+ // }
305
+ // if (_mpConfig.toolbarConfig) {
306
+ // toggleActionBarButtons('at-redo-action-btn',transformHistory.canRedo(selectedObject.object.id))
307
+ // toggleActionBarButtons('at-undo-action-btn',transformHistory.canUndo(selectedObject.object.id))
308
+ // }
309
+ // }
310
310
  console.log("getCoordinateValues rotation quaternion values", selectedObject.node.quaternion);
311
311
  return transform;
312
312
  }
@@ -8,5 +8,5 @@ export declare function removeObjectCard(elementId: string): void;
8
8
  export declare function updateObjectCard(objectCards: HTMLElement, payload: IShowcaseObject): void;
9
9
  export declare function renderObjectList(cardList: Array<IShowcaseObject>, objectComponents?: Array<Scene.IComponent>): void;
10
10
  export declare const sortShowcaseObjects: (items: IShowcaseObject[], options: SortConfig) => IShowcaseObject[];
11
- export declare function updateSelectedObjectSortOption(textSortOption: string): void;
11
+ export declare function updateSelectedObjectSortOption(sortOption: string): void;
12
12
  export declare function resetSelectedObjectSortOption(): void;
@@ -39,14 +39,14 @@ export function renderObjectListPane(cardList) {
39
39
  <div class="at_button at_ghost" id="at-models-list-view-btn" data-cy="at-models-list-view-btn">
40
40
  <span class="mdi mdi-list-box"></span>
41
41
  </div>
42
- <!-- <div id="at-object-sort-icon" class="mdi mdi-filter mdi-24px at_icon_hover">
42
+ <div id="at-object-sort-icon" class="mdi mdi-filter mdi-24px at_icon_hover">
43
43
  <span id="at-object-sort-options-tooltip" class="at_custom_tooltip">
44
- <p class="at_object_sort_option at_sort_option_selected">Ascending</p>
45
- <p class="at_object_sort_option">Descending</p>
46
- <p class="at_object_sort_option">Newest</p>
47
- <p class="at_object_sort_option">Oldest</p>
44
+ <p class="at_object_sort_option at_sort_option_selected" data-sort="Ascending">${i18n.t('Ascending')}</p>
45
+ <p class="at_object_sort_option" data-sort="Descending">${i18n.t('Descending')}</p>
46
+ <p class="at_object_sort_option" data-sort="Newest">${i18n.t('Newest')}</p>
47
+ <p class="at_object_sort_option" data-sort="Oldest">${i18n.t('Oldest')}</p>
48
48
  </span>
49
- </div> -->
49
+ </div>
50
50
  </div>
51
51
  <div class="at_scrollable_container at_h-min-60" id="at-object-cards" data-cy="at-object-cards">
52
52
 
@@ -260,12 +260,12 @@ export const sortShowcaseObjects = (items, options) => {
260
260
  return options.order === 'desc' ? -comparison : comparison;
261
261
  });
262
262
  };
263
- export function updateSelectedObjectSortOption(textSortOption) {
264
- selectedObjectSortOption = sortObjectOptions[textSortOption] || { by: 'label', order: 'asc' };
263
+ export function updateSelectedObjectSortOption(sortOption) {
264
+ selectedObjectSortOption = sortObjectOptions[sortOption] || { by: 'label', order: 'asc' };
265
265
  const tooltip = document.getElementById('at-object-sort-options-tooltip');
266
266
  const options = tooltip.querySelectorAll('.at_object_sort_option');
267
267
  options.forEach((option) => {
268
- if (option.innerText === textSortOption) {
268
+ if (option.dataset.sort === sortOption) {
269
269
  option.classList.add('at_sort_option_selected');
270
270
  }
271
271
  else {
@@ -281,7 +281,7 @@ export function resetSelectedObjectSortOption() {
281
281
  const options = tooltip.querySelectorAll('.at_object_sort_option');
282
282
  if (options) {
283
283
  options.forEach((option) => {
284
- if (option.innerText === 'Ascending') {
284
+ if (option.dataset.sort === 'Ascending') {
285
285
  option.classList.add('at_sort_option_selected');
286
286
  }
287
287
  else {
@@ -16,6 +16,8 @@ export declare class PipeForm {
16
16
  save(): void;
17
17
  cancel(): void;
18
18
  delete(): void;
19
+ private handlePipeDelete;
20
+ private handleVertexDelete;
19
21
  draw(): void;
20
22
  undoEventHandler(): Promise<void>;
21
23
  redoEventHandler(): void;
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { _3DXObjects, _pathConfig, _pipes, _selectedPipe, _selectedPipeCategory, _undoDrawActions, cancelDraw, dispatchSpaceEvent, disposeModel, enableVerticeControls, getCurrentCameraPose, moveToSweep, redoDrawAction, renderPath, setModelVisibility, setPathLineOptions, setPipeIsDrawingMode, setPipes, startDraw, undoDrawAction } from "../../../architwin";
10
+ import { _3DXObjects, _pathConfig, _pipes, _selectedPipe, _selectedPipeCategory, cancelDraw, dispatchSpaceEvent, disposeModel, enableVerticeControls, getCurrentCameraPose, moveToSweep, pathHistory, redoPipePath, renderPath, setPathLineOptions, setPipeIsDrawingMode, setPipes, startDraw, undoPipePath } from "../../../architwin";
11
11
  import i18n from './i18n';
12
12
  import { COLLAPSE, SPACE_EVENTS } from "../../../types";
13
13
  import { Collapse } from "./collapse";
@@ -79,7 +79,7 @@ export class PipeForm {
79
79
  // Creates collapse pipe under a category
80
80
  createCollapseElement(category, pipes) {
81
81
  const element = document.createElement('div');
82
- element.id = 'at-pipe-pane';
82
+ element.id = 'at-pipe-form-collapse';
83
83
  element.setAttribute('data-cy', 'at-pipe-pane');
84
84
  element.innerHTML = pipes != undefined && (pipes === null || pipes === void 0 ? void 0 : pipes.filter(pipe => (pipe === null || pipe === void 0 ? void 0 : pipe.category_uuid) === category.uuid).length)
85
85
  ? `
@@ -118,7 +118,6 @@ export class PipeForm {
118
118
  <div class="at_collapsible_content" id="${COLLAPSE.CONTENT_ID}">
119
119
  <div class="at_p-2">
120
120
  ${(() => {
121
- console.log("TEMPLERE ==>", pipe);
122
121
  let parsed, vertices;
123
122
  try {
124
123
  parsed = JSON.parse(pipe === null || pipe === void 0 ? void 0 : pipe.json_data);
@@ -160,7 +159,7 @@ export class PipeForm {
160
159
  </div>
161
160
  ` : `
162
161
  <div class="at_flex at_justify_center at_items_center at_flex_column at_h-responsive-650">
163
- <div><span class="mdi mdi-pipe-disconnected at_pipe_category-container"></span></div>
162
+ <div><span class="mdi mdi-arrow-decision at_pipe_category-container"></span></div>
164
163
  <div> ${i18n.t('NoPipesToDisplay')}</div>
165
164
  </div>
166
165
  `;
@@ -210,7 +209,7 @@ export class PipeForm {
210
209
  moveToSweep(parsed.sweepId, parsed.rotation);
211
210
  _3DXObjects.filter(obj => obj.object.uuid != uuid).forEach(targetObj => {
212
211
  if (targetObj) {
213
- setModelVisibility(targetObj.object.id);
212
+ disposeModel(targetObj);
214
213
  }
215
214
  });
216
215
  }
@@ -278,7 +277,7 @@ export class PipeForm {
278
277
  const updated = { vertices: payload, sweepId: getCurrentCameraPose().sweep, rotation: getCurrentCameraPose().rotation };
279
278
  _selectedPipe.json_data = JSON.stringify(updated);
280
279
  yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_ON_CHANGE, Object.assign({}, _selectedPipe));
281
- this.populateFormCollapse(_selectedPipeCategory, _selectedPipe);
280
+ // this.populateFormCollapse(_selectedPipeCategory, _selectedPipe);
282
281
  this.setEditMode(_selectedPipe);
283
282
  });
284
283
  }
@@ -324,47 +323,65 @@ export class PipeForm {
324
323
  const target = e.currentTarget;
325
324
  const type = target.dataset.type;
326
325
  const uuid = target.dataset.uuid;
326
+ const isHeader = type === COLLAPSE.HEADER;
327
+ const config = {
328
+ title: i18n.t(isHeader ? 'DeletePipe' : 'DeleteVertex'),
329
+ description: i18n.t(isHeader ? 'ConfirmDeletePipe' : 'ConfirmDeleteVertex'),
330
+ buttonLabel: i18n.t('YesDelete'),
331
+ };
327
332
  toggleModal();
328
- setModalAction({
329
- title: `${i18n.t('DeletePipe')}`,
330
- description: `${i18n.t('ConfirmDeletePipe')}`,
331
- buttonLabel: `${i18n.t('YesDelete')}`
332
- }, () => {
333
- var _a;
334
- if (uuid) {
335
- if (type == COLLAPSE.HEADER) {
336
- dispatchSpaceEvent(SPACE_EVENTS.PIPE_REMOVED, uuid);
337
- const targetObj = _3DXObjects.find(obj => obj.object.uuid == uuid);
338
- if (targetObj) {
339
- disposeModel(targetObj);
340
- }
341
- notyf.success(`${i18n.t('PipeSuccessfullyDeleted')}`);
342
- toggleModal(false);
343
- }
344
- else {
345
- dispatchSpaceEvent(SPACE_EVENTS.PIPE_VERTEX_REMOVED, uuid);
346
- const index = Number(target.dataset.index);
347
- this.renderPipePath(_selectedPipe.uuid);
348
- if (this.getDrawButton((_a = JSON.parse(_selectedPipeCategory.json_data)) === null || _a === void 0 ? void 0 : _a.color, 'black').classList.contains('active')) {
349
- const targetObj = _3DXObjects.find(obj => obj.object.uuid == _selectedPipe.uuid);
350
- enableVerticeControls(targetObj.component);
351
- }
352
- notyf.success(`${i18n.t('VertexDeletedSuccessfully!')}`);
353
- toggleModal(false);
354
- }
355
- this.collapse.removeElement(uuid, type);
356
- }
357
- });
333
+ setModalAction(config, () => __awaiter(this, void 0, void 0, function* () {
334
+ dispatchSpaceEvent(isHeader ? SPACE_EVENTS.PIPE_REMOVED : SPACE_EVENTS.PIPE_VERTEX_REMOVED, uuid);
335
+ yield waitForChange(() => (isHeader ? _pipes : Object.assign({}, _selectedPipe)), { interval: 500, timeout: 10000 });
336
+ isHeader ? this.handlePipeDelete(uuid) : this.handleVertexDelete(uuid);
337
+ toggleModal(false);
338
+ this.collapse.removeElement(uuid, type);
339
+ }));
358
340
  }));
359
341
  });
360
342
  }
343
+ handlePipeDelete(uuid) {
344
+ if (!_pipes.some(p => p.category_uuid === _selectedPipeCategory.uuid)) {
345
+ document.getElementById('at-pipe-form-collapse').innerHTML = `
346
+ <div class="at_flex at_justify_center at_items_center at_flex_column at_h-responsive-650">
347
+ <div><span class="mdi mdi-arrow-decision at_pipe_category-container"></span></div>
348
+ <div> ${i18n.t('NoPipesToDisplay')}</div>
349
+ </div>
350
+ `;
351
+ }
352
+ const obj = _3DXObjects.find(o => o.object.uuid === uuid);
353
+ if (obj)
354
+ disposeModel(obj);
355
+ notyf.success(i18n.t('PipeDeletedSuccessfully'));
356
+ }
357
+ handleVertexDelete(uuid) {
358
+ var _a, _b, _c;
359
+ if (((_b = (_a = JSON.parse(_selectedPipe.json_data)) === null || _a === void 0 ? void 0 : _a.vertices) === null || _b === void 0 ? void 0 : _b.length) === 0) {
360
+ document.getElementById(`${COLLAPSE.CONTENT_ID}`).innerHTML = `
361
+ <div class="at_flex at_justify_center at_items_center at_flex_column">
362
+ <div><span class="mdi mdi-ray-start-vertex-end at_pipe_category-container"></span></div>
363
+ <div>${i18n.t('NoVertexToDisplay')}</div>
364
+ </div>
365
+ `;
366
+ }
367
+ else {
368
+ this.renderPipePath(_selectedPipe.uuid);
369
+ }
370
+ if (this.getDrawButton((_c = JSON.parse(_selectedPipeCategory.json_data)) === null || _c === void 0 ? void 0 : _c.color, 'black').classList.contains('active')) {
371
+ const targetObj = _3DXObjects.find(obj => obj.object.uuid == _selectedPipe.uuid);
372
+ if (!targetObj)
373
+ return;
374
+ enableVerticeControls(targetObj.component);
375
+ }
376
+ notyf.success(`${i18n.t('VertexDeletedSuccessfully!')}`);
377
+ }
361
378
  // draw pipe listener
362
379
  draw() {
363
380
  const btn = this.getDrawButton(null, 'white');
364
381
  if (!btn)
365
382
  return;
366
383
  btn.addEventListener('click', (e) => __awaiter(this, void 0, void 0, function* () {
367
- var _a, _b;
384
+ var _a, _b, _c, _d;
368
385
  const target = e.currentTarget;
369
386
  const uuid = target.dataset.uuid;
370
387
  const categoryData = JSON.parse((_a = _selectedPipeCategory === null || _selectedPipeCategory === void 0 ? void 0 : _selectedPipeCategory.json_data) !== null && _a !== void 0 ? _a : '{}');
@@ -378,26 +395,21 @@ export class PipeForm {
378
395
  target.style.backgroundColor = (_b = JSON.parse(_selectedPipeCategory.json_data)) === null || _b === void 0 ? void 0 : _b.color;
379
396
  target.style.color = 'black';
380
397
  target.textContent = `${i18n.t('DoneDrawing')}`;
381
- _pipes.forEach(pipe => {
382
- const targetObj = _3DXObjects.find(obj => obj.object.uuid === pipe.uuid);
383
- if (targetObj) {
384
- setModelVisibility(targetObj.object.id, false);
385
- }
386
- });
398
+ _3DXObjects.filter(obj => obj.object.uuid != _selectedPipe.uuid).forEach(disposeModel);
387
399
  setPipeIsDrawingMode(true);
388
400
  startDraw({
389
401
  lineTypeComponentConfig: Object.assign(Object.assign({}, _pathConfig.lineTypeComponentConfig), { scrollSpeed: 0.70, radialSegments: 3, radius: 0.11 })
390
402
  });
391
403
  notyf.success(`${i18n.t('DrawingModeIsNowActive')}`);
392
404
  if (_selectedPipe.uuid) {
393
- console.log("EDIT PIPE ACTIVE", _selectedPipe.uuid);
394
405
  const targetObject = _3DXObjects.find(obj => obj.object.uuid === _selectedPipe.uuid);
395
- console.log("OBJECT", _3DXObjects, targetObject);
396
- if (!targetObject)
397
- return;
398
- enableVerticeControls(targetObject.component);
399
- disposeModel(targetObject);
400
- this.setEditMode(_selectedPipe);
406
+ if (targetObject) {
407
+ if (Array.isArray((_d = (_c = targetObject === null || targetObject === void 0 ? void 0 : targetObject.component) === null || _c === void 0 ? void 0 : _c.inputs) === null || _d === void 0 ? void 0 : _d.path) && targetObject.component.inputs.path.length > 1) {
408
+ disposeModel(targetObject);
409
+ enableVerticeControls(targetObject.component);
410
+ }
411
+ this.setEditMode(_selectedPipe);
412
+ }
401
413
  }
402
414
  else {
403
415
  yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_ADD, {});
@@ -411,7 +423,7 @@ export class PipeForm {
411
423
  this.savePiPeEventHandler();
412
424
  cancelDraw();
413
425
  setPipeIsDrawingMode(false);
414
- this.renderPipePath(uuid);
426
+ // this.renderPipePath(uuid)
415
427
  target.textContent = i18n.t('DrawPipe');
416
428
  target.style.backgroundColor = null;
417
429
  target.style.color = 'white';
@@ -424,15 +436,14 @@ export class PipeForm {
424
436
  yield dispatchSpaceEvent(SPACE_EVENTS.DRAW_PIPE_UNDO);
425
437
  this.populateFormCollapse(_selectedPipeCategory, _selectedPipe);
426
438
  this.setEditMode(_selectedPipe);
427
- undoDrawAction();
439
+ undoPipePath();
428
440
  });
429
441
  }
430
442
  redoEventHandler() {
431
443
  dispatchSpaceEvent(SPACE_EVENTS.DRAW_PIPE_REDO, _selectedPipe);
432
444
  this.populateFormCollapse(_selectedPipeCategory, _selectedPipe);
433
445
  this.setEditMode(_selectedPipe);
434
- // this.renderPipePath()
435
- redoDrawAction();
446
+ redoPipePath();
436
447
  }
437
448
  undo() {
438
449
  const btn = document.getElementById('at-pipe-undo-btn');
@@ -444,7 +455,7 @@ export class PipeForm {
444
455
  notyf.error(`${i18n.t('DrawingModeIsCurrentlyInactive')}`);
445
456
  return;
446
457
  }
447
- if (_undoDrawActions.length == 0)
458
+ if (!pathHistory.canUndo())
448
459
  return;
449
460
  this.undoEventHandler();
450
461
  }));
@@ -460,7 +471,7 @@ export class PipeForm {
460
471
  notyf.error(`${i18n.t('DrawingModeIsCurrentlyInactive')}`);
461
472
  return;
462
473
  }
463
- if (_undoDrawActions.length == 0)
474
+ if (!pathHistory.canRedo())
464
475
  return;
465
476
  this.redoEventHandler();
466
477
  }));
@@ -479,9 +490,7 @@ export class PipeForm {
479
490
  return;
480
491
  document.querySelectorAll('.at_circle.selected').forEach(el => el.classList.remove('selected'));
481
492
  target.classList.add('selected');
482
- console.log("clicked");
483
493
  const bgColor = getComputedStyle(target).backgroundColor;
484
- console.log("CAHNGE COLOR ==>", bgColor);
485
494
  this.getDrawButton(bgColor, 'black');
486
495
  const obj = { color: bgColor };
487
496
  _selectedPipeCategory.json_data = JSON.stringify(obj);
@@ -511,7 +520,6 @@ export class PipeForm {
511
520
  if (!btn)
512
521
  return;
513
522
  if (btn === null || btn === void 0 ? void 0 : btn.classList.contains('active')) {
514
- console.log("DRAW BUTTON ===>", btn.classList);
515
523
  btn.style.backgroundColor = background;
516
524
  btn.style.color = color;
517
525
  }
@@ -552,7 +560,11 @@ export class PipeForm {
552
560
  // render specific pipe category and its pipes
553
561
  renderPipePath(uuid) {
554
562
  var _a;
555
- _3DXObjects.filter(x => x.type === 'PATH').forEach(disposeModel);
563
+ _3DXObjects.filter(x => x.type === 'PATH').forEach(obj => {
564
+ if (obj) {
565
+ disposeModel(obj);
566
+ }
567
+ });
556
568
  const category = JSON.parse((_a = _selectedPipeCategory === null || _selectedPipeCategory === void 0 ? void 0 : _selectedPipeCategory.json_data) !== null && _a !== void 0 ? _a : '{}');
557
569
  const targetPipes = uuid
558
570
  ? _pipes.filter(p => p.uuid === uuid)
@@ -12,6 +12,9 @@ export declare class PipeList {
12
12
  edit(): void;
13
13
  toggle(): void;
14
14
  delete(): void;
15
+ private handleDisposePipeObjectModel;
16
+ private handleCategoryDelete;
17
+ private handlePipeDelete;
15
18
  renderPipePaths(): void;
16
19
  initDropdown(options: string[]): void;
17
20
  }
@@ -69,6 +69,7 @@ export class PipeList {
69
69
  createCollapseElement(categories, pipes) {
70
70
  const element = document.createElement('div');
71
71
  element.classList.add('at_collapse_container', 'at_h-responsive-304');
72
+ element.id = 'at-pipe-list-collapse';
72
73
  element.innerHTML = categories.length ? categories.sort((a, b) => new Date(a.created_on).getTime() - new Date(b.created_on).getTime()).map((category, index) => {
73
74
  var _a;
74
75
  return `
@@ -86,7 +87,7 @@ export class PipeList {
86
87
  <span class="mdi mdi-eye" id="at-view-btn-${COLLAPSE.HEADER}-${category.uuid}" data-type="${COLLAPSE.HEADER}" data-cy="at-pipe-type-view-btn" data-uuid="${category.uuid}"></span>
87
88
  </div>
88
89
  </div>
89
- <div class="at_collapsible_content at_secondary_azusa" id="${COLLAPSE.CONTENT_ID}">
90
+ <div class="at_collapsible_content at_secondary_azusa" id="${COLLAPSE.CONTENT_ID}-${category.uuid}" data-cy="at-collapsible-content-${category.uuid}">
90
91
  <div class="at_p-2">
91
92
  ${pipes != undefined && pipes.filter(pipe => pipe.category_uuid === category.uuid).length ?
92
93
  pipes
@@ -100,14 +101,14 @@ export class PipeList {
100
101
  <div class="at_locate_area_container at_flex at_justify_end at_gap_2" id="at-collapsible-${COLLAPSE.LIST}-${pipe.uuid}" data-uuid="${pipe.uuid}" data-type="${COLLAPSE.LIST}">
101
102
  <div id="at-locate-area-${COLLAPSE.LIST}-${pipe.uuid}" data-uuid="${pipe.uuid}" data-type="${COLLAPSE.LIST}">
102
103
  <span>${pipe.name.split(' ')[0] === 'Pipe' ? i18n.t('Pipe') + ' ' + pipe.name.split(' ')[1] : pipe.name}</span>
103
- <span class="mdi mdi-trash-can-outline at-pipe-filter-chevron" id="at-delete-btn-${COLLAPSE.LIST}-${pipe.uuid}" data-cy="at-pipe-delete-btn" data-type="${COLLAPSE.LIST}" data-uuid="${pipe.uuid}"></span>
104
+ <span class="mdi mdi-trash-can-outline at-pipe-filter-chevron" id="at-delete-btn-${COLLAPSE.LIST}-${pipe.uuid}" data-cy="at-pipe-delete-btn" data-type="${COLLAPSE.LIST}" data-uuid="${pipe.uuid}" data-categoryuuid="${category.uuid}"></span>
104
105
  <span class="mdi mdi-eye at-pipe-filter-chevron" id="at-view-btn-${COLLAPSE.LIST}-${pipe.uuid}" data-cy="at-pipe-view-btn" data-uuid="${pipe.uuid}" data-type="${COLLAPSE.LIST}"></span>
105
106
  </div>
106
107
  </div>
107
108
  `).join('')
108
109
  :
109
110
  `
110
- <div class="at_flex at_justify_center at_items_center at_flex_column">
111
+ <div class="at_flex at_justify_center at_items_center at_flex_column at_text_sm">
111
112
  <div style="white-space:nowrap"> ${i18n.t('NoPipesToDisplay')}</div>
112
113
  </div>
113
114
  `}
@@ -179,7 +180,6 @@ export class PipeList {
179
180
  const target = currentTarget;
180
181
  const uuid = target.dataset.uuid;
181
182
  const type = target.dataset.type;
182
- console.log("CLICKED");
183
183
  const pipe = type === COLLAPSE.HEADER
184
184
  ? _pipes.find(p => p.category_uuid === uuid)
185
185
  : _pipes.find(p => p.uuid === uuid);
@@ -198,7 +198,6 @@ export class PipeList {
198
198
  btn.addEventListener('click', (e) => __awaiter(this, void 0, void 0, function* () {
199
199
  const target = e.currentTarget;
200
200
  yield dispatchSpaceEvent(SPACE_EVENTS.PIPE_CATEGORY_ADD, {});
201
- console.log("CLICKED ADD CATEGORY =>", _selectedPipeCategory);
202
201
  this.form.setPipeTitle("AddPipeType");
203
202
  yield this.form.init(_selectedPipeCategory);
204
203
  yield toggleDisplayPane(target.id);
@@ -270,46 +269,61 @@ export class PipeList {
270
269
  }));
271
270
  });
272
271
  }
273
- //delete and dispose 3d objects
274
272
  delete() {
275
- document.querySelectorAll('[id^="at-delete-btn"]').forEach(el => {
276
- el.addEventListener('click', (e) => __awaiter(this, void 0, void 0, function* () {
277
- const target = e.currentTarget;
278
- const uuid = target.dataset.uuid;
279
- const type = target.dataset.type;
280
- toggleModal();
281
- setModalAction({
282
- title: `${i18n.t('DeletePipeCategory')}`,
283
- description: `${i18n.t('ConfirmDeletePipeCategory')}`,
284
- buttonLabel: `${i18n.t('YesDelete')}`
285
- }, () => {
286
- if (uuid) {
287
- if (type == COLLAPSE.HEADER) {
288
- dispatchSpaceEvent(SPACE_EVENTS.PIPE_CATEGORY_REMOVED, uuid);
289
- _pipes.filter(pipe => pipe.category_uuid == uuid).forEach(pipe => {
290
- const targetObj = _3DXObjects.find(obj => obj.object.uuid == pipe.uuid);
291
- if (targetObj) {
292
- disposeModel(targetObj);
293
- }
294
- });
295
- notyf.success(`${i18n.t('PipeCategoryDeletedSuccessfully')}`);
296
- toggleModal(false);
297
- }
298
- else {
299
- dispatchSpaceEvent(SPACE_EVENTS.PIPE_REMOVED, uuid);
300
- const targetObj = _3DXObjects.find(obj => obj.object.uuid == uuid);
301
- if (targetObj) {
302
- disposeModel(targetObj);
303
- }
304
- notyf.success(`${i18n.t('PipeSuccessfullyDeleted')}`);
305
- toggleModal(false);
306
- }
307
- this.collapse.removeElement(uuid, type);
308
- }
309
- });
273
+ document.querySelectorAll('[id^="at-delete-btn"]').forEach(el => el.addEventListener('click', (e) => __awaiter(this, void 0, void 0, function* () {
274
+ const target = e.currentTarget;
275
+ const { uuid, type, categoryuuid } = target.dataset;
276
+ if (!uuid)
277
+ return;
278
+ const isHeader = type === COLLAPSE.HEADER;
279
+ const config = {
280
+ title: i18n.t(isHeader ? 'DeletePipeCategory' : 'DeletePipe'),
281
+ description: i18n.t(isHeader ? 'ConfirmDeletePipeCategory' : 'ConfirmDeletePipe'),
282
+ buttonLabel: i18n.t('YesDelete'),
283
+ };
284
+ toggleModal();
285
+ setModalAction(config, () => __awaiter(this, void 0, void 0, function* () {
286
+ this.handleDisposePipeObjectModel(uuid, isHeader);
287
+ dispatchSpaceEvent(isHeader ? SPACE_EVENTS.PIPE_CATEGORY_REMOVED : SPACE_EVENTS.PIPE_REMOVED, uuid);
288
+ yield waitForChange(() => _pipeCategories, () => _pipes, { interval: 300, timeout: 10000 });
289
+ isHeader ? this.handleCategoryDelete() : this.handlePipeDelete(categoryuuid);
290
+ toggleModal(false);
291
+ this.collapse.removeElement(uuid, type);
310
292
  }));
293
+ })));
294
+ }
295
+ handleDisposePipeObjectModel(uuid, isHeader) {
296
+ (isHeader
297
+ ? _pipes.filter(p => p.category_uuid === uuid).map(p => p.uuid)
298
+ : [uuid]).forEach(id => {
299
+ const obj = _3DXObjects.find(o => o.object.uuid === id);
300
+ if (obj)
301
+ disposeModel(obj);
311
302
  });
312
303
  }
304
+ handleCategoryDelete() {
305
+ if (_pipeCategories.length == 0) {
306
+ document.getElementById('at-pipe-list-collapse').innerHTML = `
307
+ <div class="at_h-responsive-304">
308
+ <div class="at_flex at_justify_center at_items_center at_flex_column at_h-full">
309
+ <span class="mdi mdi-pipe-disconnected at_pipe_category at_text-xxl"></span>
310
+ <div class="at_text_xs" style="white-space:nowrap">${i18n.t('NoPipesTypeToDisplay')}</div>
311
+ </div>
312
+ </div>`;
313
+ }
314
+ notyf.success(i18n.t('PipeCategoryDeletedSuccessfully'));
315
+ }
316
+ handlePipeDelete(categoryuuid) {
317
+ if (!_pipes.some(p => p.category_uuid === categoryuuid)) {
318
+ document.getElementById(`${COLLAPSE.CONTENT_ID}-${categoryuuid}`).innerHTML = `
319
+ <div class="at_flex at_justify_center at_items_center at_flex_column">
320
+ <div class="at_p-2">
321
+ <div style="white-space:nowrap">${i18n.t('NoPipesToDisplay')}</div>
322
+ </div>
323
+ </div>`;
324
+ }
325
+ notyf.success(i18n.t('PipeDeletedSuccessfully'));
326
+ }
313
327
  //render pipe path 3D objects
314
328
  renderPipePaths() {
315
329
  // initialize to empty