architwin 1.18.9 → 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.
@@ -14,7 +14,7 @@ import { getTargetPosition, addMediaScreen, _3DXObjects, selectedObject, setTran
14
14
  import { Notyf } from 'notyf';
15
15
  import 'notyf/notyf.min.css';
16
16
  import { SPACE_EVENTS, COORDINATE_SYSTEM, UNITS, DEGREE, MAP_OPTIONS, sortTagOptions, sortObjectOptions, CUSTOM_MAP_MODE, TAG_TYPE } from "../types";
17
- import { initFormData, hideTagsFromSpace, renderTagsInSpace, setTagFormMode } from "./components/toolbar/tagFormPane";
17
+ import { initFormData, setTagFormMode } from "./components/toolbar/tagFormPane";
18
18
  import { renderObjectList, resetSelectedObjectSortOption, selectedObjectSortOption, sortShowcaseObjects, updateSelectedObjectSortOption } from "./components/toolbar/objectListPane";
19
19
  import { renderLibraryList } from "./components/toolbar/libraryPane";
20
20
  import { renderObjectCard } from "./components/toolbar/card";
@@ -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;
@@ -3281,35 +3333,37 @@ function handleClearSearchTagName() {
3281
3333
  log.info('handleClearSearchTagName()');
3282
3334
  const searchTagName = document.getElementById('at-clear-search-tag-name');
3283
3335
  if (searchTagName) {
3284
- searchTagName.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
3336
+ searchTagName.addEventListener('click', () => {
3285
3337
  searchClearfield();
3286
3338
  // commented out due to iot Dummy Data
3287
3339
  // const tags = getMpTags()
3288
3340
  const tags = [..._tags];
3341
+ const filteredTags = filterTagList(tags);
3289
3342
  if (selectedCategoryFilterId || selectedSubCategoryFilterId && isTagPaneActive) {
3290
- const filteredTags = filterTagList(tags).filter(tag => tag.tag_type === TAG_TYPE.MP);
3291
- // show filtered tags only
3292
- yield renderTagsInSpace(filteredTags, true);
3343
+ const filteredTags = filterTagList(tags);
3293
3344
  renderTags(filteredTags);
3294
3345
  }
3295
3346
  else if (tags.length > 0 && isTagPaneActive) {
3296
- const filteredMPTags = tags.filter(tag => tag.tag_type === TAG_TYPE.MP);
3297
- yield renderTagsInSpace(filteredMPTags, true);
3298
- renderTags(filteredMPTags, true);
3347
+ renderTags(tags, true);
3299
3348
  }
3300
3349
  else if (!isTagPaneActive) {
3301
3350
  const filteredIotTags = filterIotTagList(tags);
3302
- yield renderTagsInSpace(filteredIotTags, true);
3303
3351
  renderTags(filteredIotTags);
3352
+ // if (selectedCategoryFilterId || selectedSubCategoryFilterId) {
3353
+ // const sortedTags = sortTags(filteredTags, {by: 'label', order: 'asc'})
3354
+ // renderTags(sortedTags)
3355
+ // } else if (tags.length > 0) {
3356
+ // const sortedTags = sortTags(tags, {by: 'label', order: 'asc'})
3357
+ // renderTags(sortedTags,true)
3304
3358
  }
3305
- }));
3359
+ });
3306
3360
  }
3307
3361
  }
3308
3362
  function handleSearchFromTagListButton() {
3309
3363
  log.info('handleSearchFromTagListButton()');
3310
3364
  const searchTagNameButton = document.getElementById('at-search-tag-button');
3311
3365
  if (searchTagNameButton) {
3312
- searchTagNameButton.addEventListener('click', () => __awaiter(this, void 0, void 0, function* () {
3366
+ searchTagNameButton.addEventListener('click', () => {
3313
3367
  const tags = getMpTags();
3314
3368
  const tagSearch = getSearchTagTerm();
3315
3369
  if (tagSearch) {
@@ -3319,36 +3373,18 @@ function handleSearchFromTagListButton() {
3319
3373
  if (foundTag) {
3320
3374
  if (selectedCategoryFilterId || selectedSubCategoryFilterId && isTagPaneActive) {
3321
3375
  const filteredTags = filterTagList(foundTag);
3322
- const removeTags = tags.filter(tag => !filteredTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
3323
- log.info("removeTags", removeTags);
3324
- // remove tags that is not part in the sorted Tags
3325
- yield hideTagsFromSpace(removeTags);
3326
- // show filtered tags only
3327
- yield renderTagsInSpace(filteredTags, true);
3328
3376
  renderTags(filteredTags);
3329
3377
  }
3330
3378
  else if (foundTag.length > 0 && isTagPaneActive) {
3331
- const removeTags = tags.filter(tag => !foundTag.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.MP);
3332
- log.info("removeTags", removeTags);
3333
- // remove tags that is not part in the sorted Tags
3334
- yield hideTagsFromSpace(removeTags);
3335
- // show filtered tags only
3336
- yield renderTagsInSpace(foundTag, true);
3337
3379
  renderTags(foundTag, true);
3338
3380
  }
3339
3381
  else if (!isTagPaneActive) {
3340
3382
  const filteredIotTags = filterIotTagList(foundTag);
3341
- const removeTags = tags.filter(tag => !filteredIotTags.some(ft => ft.id === tag.id) && tag.tag_type === TAG_TYPE.IOT);
3342
- log.info("removeTags", removeTags);
3343
- // remove tags that is not part in the sorted Tags
3344
- yield hideTagsFromSpace(removeTags);
3345
- // show filtered tags only
3346
- yield renderTagsInSpace(filteredIotTags, true);
3347
3383
  renderTags(filteredIotTags);
3348
3384
  }
3349
3385
  }
3350
3386
  }
3351
- }));
3387
+ });
3352
3388
  }
3353
3389
  }
3354
3390
  function handleCustomMapFloorImageUploaded(payload) {
@@ -3556,6 +3592,15 @@ function handlePlaceIotTag() {
3556
3592
  const tags = getMpTags();
3557
3593
  currentTag = _tags[tags.length - 1];
3558
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
+ }
3559
3604
  cancelTagPlacementPrompt.style.display = 'none';
3560
3605
  isPlacingTag = false;
3561
3606
  });
@@ -3587,6 +3632,15 @@ function handlePlaceIotTag() {
3587
3632
  notyf.success(`${i18n.t('SuccessAddTagToSpace')}`);
3588
3633
  const tags = getMpTags();
3589
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
+ }
3590
3644
  log.info("Last IoT Tag Pushed", tags[tags.length - 1]);
3591
3645
  cancelTagPlacementPrompt.style.display = 'none';
3592
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.9",
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",