architwin 1.18.10 → 1.18.11

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.
@@ -213,11 +213,13 @@ export function displayPartitionItems(partitionItems, partitionId, object, paren
213
213
  // This is for the walls
214
214
  partitionItems.forEach((wall, index) => {
215
215
  log.info("__@ partition item: ", wall);
216
+ if (!wall || !wall.name || !(object === null || object === void 0 ? void 0 : object[index]))
217
+ return;
216
218
  if (!wall.options.is_deleted) {
217
219
  if (!wall.hide) {
218
220
  // Split wall name to localize
219
221
  const match = wall.name.match(/wall-(\d+)$/);
220
- const wallNumber = parseInt(match[1]) + 1;
222
+ const wallNumber = match ? parseInt(match[1]) + 1 : index + 1;
221
223
  const isVisible = wall.options.is_visible;
222
224
  const objName = object[index].name.includes('_') ? object[index].name : `${partitionId}_${object[index].name}`;
223
225
  log.info("__@ objName: ", objName);
@@ -274,6 +274,11 @@ export function renderTags(tags, showOwnTagsOnly = false) {
274
274
  console.log("TAG DELETE", tagId, _tags);
275
275
  const targetTag = _tags.find(tag => tag.json_data.id.toString() == tagId);
276
276
  yield disposeTag({ tagId: tagId });
277
+ if (targetTag) {
278
+ const tagType = targetTag.tag_type || TAG_TYPE.MP;
279
+ delete tagVisibility[tagType][tagId];
280
+ updateShowAllButton();
281
+ }
277
282
  const tagRow = document.getElementById(`at-tag-row-${tagId}`);
278
283
  tagRow.remove();
279
284
  const payload = { tag: targetTag };
@@ -488,7 +493,13 @@ export function addClickEventToTagRow(tag) {
488
493
  if (tag) {
489
494
  const tagId = tag.getAttribute('tag-id');
490
495
  if (tagId && tagId !== null) {
496
+ const deletedTag = _tags.find(t => t.json_data.id.toString() === tagId);
491
497
  yield disposeTag({ tagId: tagId });
498
+ if (deletedTag) {
499
+ const tagType = deletedTag.tag_type || TAG_TYPE.MP;
500
+ delete tagVisibility[tagType][tagId];
501
+ updateShowAllButton();
502
+ }
492
503
  const tagRow = document.getElementById(`at-tag-row-${tagId}`);
493
504
  tagRow.remove();
494
505
  notify.success(i18n.t('Successfully deleted tag'));
@@ -181,7 +181,13 @@ function toggleDisplayPane(targetId) {
181
181
  if (tag) {
182
182
  const tagId = tag.getAttribute('tag-id');
183
183
  if (tagId && tagId !== null) {
184
+ const deletedTag = _tags.find(t => t.json_data.id.toString() === tagId);
184
185
  yield disposeTag({ tagId: tagId });
186
+ if (deletedTag) {
187
+ const tagType = deletedTag.tag_type || TAG_TYPE.MP;
188
+ delete tagVisibility[tagType][tagId];
189
+ updateShowAllButton();
190
+ }
185
191
  const tagRow = document.getElementById(`at-tag-row-${tagId}`);
186
192
  log.info("tagRow", tagRow);
187
193
  tagRow.remove();
@@ -817,6 +823,15 @@ function handlePlaceTag() {
817
823
  const tags = getMpTags();
818
824
  _tags[tags.length - 1].category_uuid = payload.tagSubcategoryId;
819
825
  currentTag = _tags[_tags.length - 1];
826
+ if (currentTag) {
827
+ const tagType = currentTag.tag_type || TAG_TYPE.MP;
828
+ const tagId = currentTag.json_data.id;
829
+ if (!tagVisibility[tagType])
830
+ tagVisibility[tagType] = {};
831
+ tagVisibility[tagType][tagId] = true;
832
+ updateShowAllButton();
833
+ saveTagVisibilityToStorage(tagVisibility);
834
+ }
820
835
  log.info('_tags', _tags);
821
836
  log.info("Last Tag Pushed", currentTag);
822
837
  cancelTagPlacementPrompt.style.display = 'none';
@@ -850,6 +865,15 @@ function handlePlaceTag() {
850
865
  notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
851
866
  const tags = getMpTags();
852
867
  currentTag = tags[tags.length - 1];
868
+ if (currentTag) {
869
+ const tagType = currentTag.tag_type || TAG_TYPE.MP;
870
+ const tagId = currentTag.json_data.id;
871
+ if (!tagVisibility[tagType])
872
+ tagVisibility[tagType] = {};
873
+ tagVisibility[tagType][tagId] = true;
874
+ updateShowAllButton();
875
+ saveTagVisibilityToStorage(tagVisibility);
876
+ }
853
877
  log.info("Last Tag Pushed", tags[tags.length - 1]);
854
878
  cancelTagPlacementPrompt.style.display = 'none';
855
879
  isPlacingTag = false;
@@ -907,6 +931,14 @@ function handlePlaceTag() {
907
931
  if (index !== -1) {
908
932
  log.info("tag found");
909
933
  _tags[index].category_uuid = payload.tagSubcategoryId;
934
+ const newTag = _tags[index];
935
+ const tagType = newTag.tag_type || TAG_TYPE.MP;
936
+ const tagId = newTag.json_data.id;
937
+ if (!tagVisibility[tagType])
938
+ tagVisibility[tagType] = {};
939
+ tagVisibility[tagType][tagId] = true;
940
+ updateShowAllButton();
941
+ saveTagVisibilityToStorage(tagVisibility);
910
942
  }
911
943
  else {
912
944
  log.info("tag not found");
@@ -946,6 +978,14 @@ function handlePlaceTag() {
946
978
  if (index !== -1) {
947
979
  log.info("tag found");
948
980
  _tags[index].category_uuid = payload.tagSubcategoryId;
981
+ const newTag = _tags[index];
982
+ const tagType = newTag.tag_type || TAG_TYPE.MP;
983
+ const tagId = newTag.json_data.id;
984
+ if (!tagVisibility[tagType])
985
+ tagVisibility[tagType] = {};
986
+ tagVisibility[tagType][tagId] = true;
987
+ updateShowAllButton();
988
+ saveTagVisibilityToStorage(tagVisibility);
949
989
  }
950
990
  else {
951
991
  log.info("tag not found");
@@ -975,7 +1015,13 @@ function onDisposeTag() {
975
1015
  if (tag) {
976
1016
  const tagId = tag.getAttribute('tag-id');
977
1017
  if (tagId && tagId !== null) {
1018
+ const deletedTag = _tags.find(t => t.json_data.id.toString() === tagId);
978
1019
  yield disposeTag({ tagId: tagId });
1020
+ if (deletedTag) {
1021
+ const tagType = deletedTag.tag_type || TAG_TYPE.MP;
1022
+ delete tagVisibility[tagType][tagId];
1023
+ updateShowAllButton();
1024
+ }
979
1025
  const tagRow = document.getElementById(`at-tag-row-${tagId}`);
980
1026
  log.info("tagRow", tagRow);
981
1027
  tagRow.remove();
@@ -994,7 +1040,13 @@ function onDisposeTag() {
994
1040
  }
995
1041
  cancelMoveTag();
996
1042
  if (iTag !== null) {
1043
+ const deletedTag = _tags.find(t => t.id.toString() === iTag.id.toString());
997
1044
  yield disposeTag({ tagId: iTag.id });
1045
+ if (deletedTag) {
1046
+ const tagType = deletedTag.tag_type || TAG_TYPE.MP;
1047
+ delete tagVisibility[tagType][iTag.id.toString()];
1048
+ updateShowAllButton();
1049
+ }
998
1050
  }
999
1051
  iTag = null;
1000
1052
  if (cancelTagPlacementPrompt) {
@@ -1230,7 +1282,7 @@ function handleToggleVisibilityTags() {
1230
1282
  const updateAll = (visible) => __awaiter(this, void 0, void 0, function* () {
1231
1283
  // Determine which tags to update based on current mode
1232
1284
  const tagsToUpdate = currentTagPaneMode
1233
- ? _tags.filter(tag => tag.tag_type === currentTagPaneMode)
1285
+ ? _tags.filter(tag => (tag.tag_type || TAG_TYPE.MP) === currentTagPaneMode)
1234
1286
  : _tags;
1235
1287
  for (const tag of tagsToUpdate) {
1236
1288
  const tagType = tag.tag_type || TAG_TYPE.MP;
@@ -3540,6 +3592,15 @@ function handlePlaceIotTag() {
3540
3592
  const tags = getMpTags();
3541
3593
  currentTag = _tags[tags.length - 1];
3542
3594
  _tags[tags.length - 1].category_uuid = payload.tagCategoryId;
3595
+ if (currentTag) {
3596
+ const tagType = currentTag.tag_type || TAG_TYPE.IOT;
3597
+ const tagId = currentTag.json_data.id;
3598
+ if (!tagVisibility[tagType])
3599
+ tagVisibility[tagType] = {};
3600
+ tagVisibility[tagType][tagId] = true;
3601
+ updateShowAllButton();
3602
+ saveTagVisibilityToStorage(tagVisibility);
3603
+ }
3543
3604
  cancelTagPlacementPrompt.style.display = 'none';
3544
3605
  isPlacingTag = false;
3545
3606
  });
@@ -3571,6 +3632,15 @@ function handlePlaceIotTag() {
3571
3632
  notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
3572
3633
  const tags = getMpTags();
3573
3634
  currentTag = tags[tags.length - 1];
3635
+ if (currentTag) {
3636
+ const tagType = currentTag.tag_type || TAG_TYPE.IOT;
3637
+ const tagId = currentTag.json_data.id;
3638
+ if (!tagVisibility[tagType])
3639
+ tagVisibility[tagType] = {};
3640
+ tagVisibility[tagType][tagId] = true;
3641
+ updateShowAllButton();
3642
+ saveTagVisibilityToStorage(tagVisibility);
3643
+ }
3574
3644
  log.info("Last IoT Tag Pushed", tags[tags.length - 1]);
3575
3645
  cancelTagPlacementPrompt.style.display = 'none';
3576
3646
  isPlacingTag = false;
@@ -621,11 +621,13 @@ export class BufferGeometry {
621
621
  // }
622
622
  };
623
623
  this.renderPolygon = () => {
624
- var _a;
624
+ var _a, _b, _c, _d;
625
625
  const THREE = this.context.three;
626
+ if (!this.inputs.path || this.inputs.path.length === 0)
627
+ return;
626
628
  const polyData = this.inputs.polygonData;
627
629
  console.log("polyData ", polyData);
628
- const WALL_HEIGHT = polyData && polyData.walls[0].wall_height ? polyData.walls[0].wall_height : this.inputs.wallHeight;
630
+ const WALL_HEIGHT = (_c = (_b = (_a = polyData === null || polyData === void 0 ? void 0 : polyData.walls) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.wall_height) !== null && _c !== void 0 ? _c : this.inputs.wallHeight;
629
631
  this.groupedMesh = new THREE.Group();
630
632
  let floorDataArray = [];
631
633
  let wallDataArray = [];
@@ -637,7 +639,7 @@ export class BufferGeometry {
637
639
  return point;
638
640
  });
639
641
  let floorLevel;
640
- console.log("floorLevel polyData.floor.floor_level", (_a = polyData === null || polyData === void 0 ? void 0 : polyData.floor) === null || _a === void 0 ? void 0 : _a.floor_level);
642
+ console.log("floorLevel polyData.floor.floor_level", (_d = polyData === null || polyData === void 0 ? void 0 : polyData.floor) === null || _d === void 0 ? void 0 : _d.floor_level);
641
643
  floorLevel = this.inputs.path[0].y;
642
644
  console.log("floorLevel ", floorLevel);
643
645
  console.log("floorLevel this.inputs.path[0].y", this.inputs.path[0].y);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.18.10",
3
+ "version": "1.18.11",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",