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.
@@ -126,11 +126,11 @@ export function handleClickEventUserRow() {
126
126
  _screenShareUser = user;
127
127
  if (user.onlineStatus === 'offline')
128
128
  return;
129
- if (user.onlineStatus === 'sharing')
129
+ if (user.onlineStatus === 'in_session')
130
130
  return;
131
131
  if (user.onlineStatus === 'pending')
132
132
  return;
133
- if (user.onlineStatus === 'in_session') {
133
+ if (user.onlineStatus === 'sharing') {
134
134
  if (!_screenShareSession) {
135
135
  return;
136
136
  }
@@ -19,5 +19,5 @@ export declare function searchTagList(tags: Array<ITag>): Array<ITag>;
19
19
  export declare function setSearchTagTerm(searchTagName: string): void;
20
20
  export declare function searchClearfield(): void;
21
21
  export declare const sortTags: (items: ITag[], options: SortConfig) => ITag[];
22
- export declare function updateSelectedTagSortOption(textSortOption: string): void;
22
+ export declare function updateSelectedTagSortOption(sortOption: string): void;
23
23
  export declare function resetSelectedTagSortOption(): void;
@@ -17,6 +17,7 @@ import { Notyf } from 'notyf';
17
17
  import { _tagCategories } from "../../../architwin";
18
18
  import i18n from './i18n';
19
19
  import log from 'loglevel';
20
+ // import { e } from "mathjs";
20
21
  let notify = new Notyf({ position: { x: 'left', y: 'bottom' } });
21
22
  let _tagLink;
22
23
  let isChevronEventAdded = false;
@@ -37,16 +38,16 @@ export function renderTagListPane() {
37
38
  <span>${i18n.t('Tags')}</span>
38
39
  </div>
39
40
  <div class="at_form_container at_h-min-65 at_tag_list_pane">
40
- <!-- <div class="at_sort_btn_container">
41
+ <div class="at_sort_btn_container">
41
42
  <div id="at-tag-sort-icon" class="mdi mdi-filter mdi-24px at_icon_hover">
42
43
  <span id="at-tag-sort-options-tooltip" class="at_custom_tooltip">
43
- <p class="at_tag_sort_option at_sort_option_selected">Ascending</p>
44
- <p class="at_tag_sort_option">Descending</p>
45
- <p class="at_tag_sort_option">Newest</p>
46
- <p class="at_tag_sort_option">Oldest</p>
44
+ <p class="at_tag_sort_option at_sort_option_selected" data-sort="Ascending">${i18n.t('Ascending')}</p>
45
+ <p class="at_tag_sort_option" data-sort="Descending">${i18n.t('Descending')}</p>
46
+ <p class="at_tag_sort_option" data-sort="Newest">${i18n.t('Newest')}</p>
47
+ <p class="at_tag_sort_option" data-sort="Oldest">${i18n.t('Oldest')}</p>
47
48
  </span>
48
49
  </div>
49
- </div> -->
50
+ </div>
50
51
  <div class="at_flex_row">
51
52
  <input class="at_field_search_input" type="text" name="search_name" id="at-tag-name-search" data-cy="at-tag-name-search" placeholder=${i18n.t('Search...')}>
52
53
  <span class="mdi mdi-close at_button_search_tag" id="at-clear-search-tag-name" style="display:none"></span>
@@ -530,12 +531,12 @@ export const sortTags = (items, options) => {
530
531
  return options.order === 'desc' ? -comparison : comparison;
531
532
  });
532
533
  };
533
- export function updateSelectedTagSortOption(textSortOption) {
534
- selectedTagSortOption = sortTagOptions[textSortOption] || { by: 'label', order: 'asc' };
534
+ export function updateSelectedTagSortOption(sortOption) {
535
+ selectedTagSortOption = sortTagOptions[sortOption] || { by: 'label', order: 'asc' };
535
536
  const tooltip = document.getElementById('at-tag-sort-options-tooltip');
536
537
  const options = tooltip.querySelectorAll('.at_tag_sort_option');
537
538
  options.forEach((option) => {
538
- if (option.innerText === textSortOption) {
539
+ if (option.dataset.sort === sortOption) {
539
540
  option.classList.add('at_sort_option_selected');
540
541
  }
541
542
  else {
@@ -551,7 +552,7 @@ export function resetSelectedTagSortOption() {
551
552
  const options = tooltip.querySelectorAll('.at_tag_sort_option');
552
553
  if (options) {
553
554
  options.forEach((option) => {
554
- if (option.innerText === 'Ascending') {
555
+ if (option.dataset.sort === 'Ascending') {
555
556
  option.classList.add('at_sort_option_selected');
556
557
  }
557
558
  else {
@@ -19,7 +19,7 @@ import { renderObjectCard } from "./components/toolbar/card";
19
19
  import { toggleModelControl, getCoordinateValues, showCurrentCoordinateValue, handleModelControlInputs, setSelectedObjectCoordinateSystem, getSelectedObjectCoordinateSystem, getCurrentTransformationValues, setCurrentTransformationValues, getTransformValues, clearCurrentTransformationValues } from "./components/toolbar/modelControlsPane";
20
20
  import { attachTagMedia, handleTagPlacerCreated, cancelMoveTag } from "../tag";
21
21
  import i18n from './components/toolbar/i18n';
22
- import { isValidUrl, debounce, isElementVisible, extractUUID, showLoader } from "../utils";
22
+ import { isValidUrl, debounce, isElementVisible, extractUUID, showLoader, isVec3Equal, isQuatEqual } from "../utils";
23
23
  import log from 'loglevel';
24
24
  import * as minimap from '../minimap';
25
25
  import { clearActiveThemeCard, getSelectedTheme } from "./components/toolbar/themePane";
@@ -1348,16 +1348,6 @@ function handleConfirmTransform() {
1348
1348
  const selected = getSelectedObject();
1349
1349
  if (transform) {
1350
1350
  setObjectTransformation(selected.node, transform);
1351
- //clearCoordinateInputs()
1352
- //Add to the action history so it can be reverse with undo or redo
1353
- const currentTransform = JSON.stringify(transform);
1354
- actionHistory.push(currentTransform);
1355
- //@ts-expect-error
1356
- transformHistory.addAction(selected.object.id, transform.object_position, transform.object_rotation, transform.object_scale);
1357
- if (_mpConfig.toolbarConfig) {
1358
- toggleActionBarButtons('at-redo-action-btn', transformHistory.canRedo(selected.object.id));
1359
- toggleActionBarButtons('at-undo-action-btn', transformHistory.canUndo(selected.object.id));
1360
- }
1361
1351
  //Emit a drag end event so app side can listen
1362
1352
  const payload = selected.object;
1363
1353
  payload.object_position = transform.object_position;
@@ -1397,6 +1387,24 @@ function handleConfirmTransform() {
1397
1387
  activeElement.classList.remove("at_sidebar_button_icon_active");
1398
1388
  removeTransformControls();
1399
1389
  toggleModelControl(false);
1390
+ // Add to the action history so it can be reversed with undo or redo
1391
+ // Get the most recent action in the transformHistory
1392
+ const { object_position: lastPos, object_rotation: lastRot, object_scale: lastScale } = JSON.parse(transformHistory.getTransformHistory(selected.object.id).at(transformHistory.getCurrentIndex(selected.object.id)));
1393
+ const isPositionEqual = isVec3Equal(selected.node.position, lastPos);
1394
+ // @ts-expect-error
1395
+ const isRotationEqual = isQuatEqual(selected.node.obj3D.rotation, lastRot);
1396
+ const isScaleEqual = isVec3Equal(selected.node.scale, lastScale);
1397
+ // Only push actionHistory when the previous action is not equal to the current action
1398
+ if (!isPositionEqual || !isRotationEqual || !isScaleEqual) {
1399
+ const currentTransform = JSON.stringify(transform);
1400
+ actionHistory.push(currentTransform);
1401
+ // @ts-expect-error
1402
+ transformHistory.addAction(selected.object.id, selected.node.position, selected.node.obj3D.rotation, selected.node.scale);
1403
+ if (_mpConfig.toolbarConfig) {
1404
+ toggleActionBarButtons('at-redo-action-btn', transformHistory.canRedo(selected.object.id));
1405
+ toggleActionBarButtons('at-undo-action-btn', transformHistory.canUndo(selected.object.id));
1406
+ }
1407
+ }
1400
1408
  }
1401
1409
  });
1402
1410
  }
@@ -3170,7 +3178,6 @@ function handleClickEventInTagSortOption() {
3170
3178
  if (sortIcon) {
3171
3179
  sortIcon.addEventListener('mouseover', () => {
3172
3180
  const sortTooltip = document.getElementById('at-tag-sort-options-tooltip');
3173
- // console.log('Tooltip ready:', !!sortTooltip)
3174
3181
  // Only add the click listener once
3175
3182
  if (sortTooltip && !clickListenerAdded) {
3176
3183
  clickListenerAdded = true;
@@ -3178,11 +3185,11 @@ function handleClickEventInTagSortOption() {
3178
3185
  const target = event.target;
3179
3186
  const closestOption = target.closest('.at_tag_sort_option');
3180
3187
  if (closestOption) {
3181
- const innerText = closestOption.innerText;
3182
- updateSelectedTagSortOption(innerText);
3188
+ const sortOption = closestOption.dataset.sort;
3189
+ updateSelectedTagSortOption(sortOption);
3183
3190
  const tags = getMpTags();
3184
3191
  const filteredTags = filterTagList(tags);
3185
- const sortConfig = sortTagOptions[innerText] || { by: 'label', order: 'asc' };
3192
+ const sortConfig = sortTagOptions[sortOption] || { by: 'label', order: 'asc' };
3186
3193
  if (selectedCategoryFilterId || selectedSubCategoryFilterId) {
3187
3194
  const sortedTags = sortTags(filteredTags, sortConfig);
3188
3195
  renderTags(sortedTags);
@@ -3211,12 +3218,12 @@ function handleClickEventInObjectSortOption() {
3211
3218
  const target = event.target;
3212
3219
  const closestOption = target.closest('.at_object_sort_option');
3213
3220
  if (closestOption) {
3214
- const innerText = closestOption.innerText;
3215
- updateSelectedObjectSortOption(innerText);
3221
+ const sortOption = closestOption.dataset.sort;
3222
+ updateSelectedObjectSortOption(sortOption);
3216
3223
  const objectsInSpace = get3DXObjects();
3217
3224
  const objectComponents = objectsInSpace.map(obj => obj.component);
3218
3225
  const spaceObjects = objectsInSpace.filter(obj => obj.type !== 'POLYGON' && obj.type !== 'BASEPOINT').map(obj => obj.object);
3219
- const sortConfig = sortObjectOptions[innerText] || { by: 'label', order: 'asc' };
3226
+ const sortConfig = sortObjectOptions[sortOption] || { by: 'label', order: 'asc' };
3220
3227
  const sortedObjects = sortShowcaseObjects(spaceObjects, sortConfig);
3221
3228
  renderObjectCards(sortedObjects, objectComponents);
3222
3229
  }
@@ -325,7 +325,8 @@ export class TubeLine {
325
325
  }
326
326
  }
327
327
  onDestroy() {
328
- this.texture.dispose();
328
+ var _a;
329
+ (_a = this.texture) === null || _a === void 0 ? void 0 : _a.dispose();
329
330
  if (this.panel) {
330
331
  this.panel.dispose();
331
332
  //@ts-expect-error
package/lib/utils.d.ts CHANGED
@@ -91,3 +91,5 @@ export declare function convertMeasurement(value: any, fromUnit: any, toUnit: an
91
91
  export declare function showLoader(visible: boolean): void;
92
92
  export declare function percentToScale(percentValue: Vector3): Vector3;
93
93
  export declare function scaleToPercent(scaleValue: Vector3): Vector3;
94
+ export declare function isVec3Equal(a: any, b: any): boolean;
95
+ export declare function isQuatEqual(a: any, b: any): boolean;
package/lib/utils.js CHANGED
@@ -449,3 +449,10 @@ export function scaleToPercent(scaleValue) {
449
449
  z: parseFloat((clampMin(scaleValue.z) * 100).toFixed(2)),
450
450
  };
451
451
  }
452
+ // Helper for comparing {x, y, z}
453
+ export function isVec3Equal(a, b) {
454
+ return a.x.toFixed(3) === b.x.toFixed(3) && a.y.toFixed(3) === b.y.toFixed(3) && a.z.toFixed(3) === b.z.toFixed(3);
455
+ }
456
+ export function isQuatEqual(a, b) {
457
+ return a._x.toFixed(3) === b._x.toFixed(3) && a._y.toFixed(3) === b._y.toFixed(3) && a._z.toFixed(3) === b._z.toFixed(3);
458
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.14.1",
3
+ "version": "1.14.3",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",