architwin 1.18.5 → 1.18.7

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.
@@ -271,19 +271,22 @@ export function setActiveLibraryCard(cardId) {
271
271
  const payload = yield addObjectToSpace(selectedObject.amazon_uri, selectedObject.object_type, { position: coords });
272
272
  payload.object_data = selectedObject;
273
273
  if (isToolbarFeatureEnabled('bim')) {
274
- payload.coordinate_system = getCoordinateSystem();
275
- const thisObjBimPosition = convertYupToZup(payload.object_position, getMPBasepoint(), getBasepoint(), getMeasurementUnit(), parseInt(getScaleFactor()));
276
- console.log("====== caroline thisObjBimPosition: ", thisObjBimPosition);
277
- const thisObjBimScale = convertYupScaleToZupScale(payload.object_scale, UNITS.METER, parseInt(getScaleFactor()));
278
- console.log("====== caroline thisObjBimScale: ", thisObjBimScale);
279
- const coordPayload = {
280
- coord_system: getCoordinateSystem(),
281
- bim_coordinates: {
282
- position: thisObjBimPosition,
283
- scale: thisObjBimScale,
284
- }
285
- };
286
- payload.json_data = JSON.stringify({ coordSystemCalibration: coordPayload });
274
+ const basepoint = get3DXObjects().find(obj => obj.type === "BASEPOINT");
275
+ if (basepoint) {
276
+ payload.coordinate_system = getCoordinateSystem();
277
+ const thisObjBimPosition = convertYupToZup(payload.object_position, getMPBasepoint(), getBasepoint(), getMeasurementUnit(), parseInt(getScaleFactor()));
278
+ console.log("====== caroline thisObjBimPosition: ", thisObjBimPosition);
279
+ const thisObjBimScale = convertYupScaleToZupScale(payload.object_scale, UNITS.METER, parseInt(getScaleFactor()));
280
+ console.log("====== caroline thisObjBimScale: ", thisObjBimScale);
281
+ const coordPayload = {
282
+ coord_system: getCoordinateSystem(),
283
+ bim_coordinates: {
284
+ position: thisObjBimPosition,
285
+ scale: thisObjBimScale,
286
+ }
287
+ };
288
+ payload.json_data = JSON.stringify({ coordSystemCalibration: coordPayload });
289
+ }
287
290
  }
288
291
  console.log("======Payload:", payload);
289
292
  dispatchSpaceEvent(SPACE_EVENTS.MODEL_RENDERED, { model: payload });
@@ -168,7 +168,8 @@ export function getTagFormData() {
168
168
  }
169
169
  if (tagNameInput) {
170
170
  const tagName = tagNameInput.value;
171
- const tagDescription = tagDescriptionInput.value.split('\n')[0];
171
+ const tagDescription = tagDescriptionInput.value;
172
+ //const tagDescription = tagDescriptionInput.value.split('\n')[0]
172
173
  const tagEmbed = tagEmbedInput.value;
173
174
  const formData = {
174
175
  tagName: tagName,
@@ -59,7 +59,7 @@ export function renderTagListPane() {
59
59
  <span id="at-tag-list-title">${i18n.t('Tags')}</span>
60
60
  </div>
61
61
  <div class="at_form_container at_h-min-65 at_tag_list_pane">
62
- <div class="at_button_row at_justify_end ${_mpConfig.restrictionConfig.isTagReadOnly ? 'at_disabled' : ''}">
62
+ <div class="at_button_row at_justify_end">
63
63
  <div class="at_button at_ghost">
64
64
  <span class="mdi mdi-sort at_icon_hover" id="at-tag-sort-icon" data-cy="at-tag-sort-btn" >
65
65
  <span id="at-tag-sort-options-tooltip" class="at_custom_tooltip">
@@ -70,14 +70,14 @@ export function renderTagListPane() {
70
70
  </span>
71
71
  </span>
72
72
  </div>
73
- <div class="at_button at_ghost" id="at-visibility-tag-btn" data-cy="at-visibility-tag-btn" >
73
+ <div class="at_button at_ghost ${_mpConfig.restrictionConfig.isTagReadOnly ? 'at_hidden' : ''}" id="at-visibility-tag-btn" data-cy="at-visibility-tag-btn">
74
74
  <span class="mdi mdi-eye at_icon_hover" id="at-visibility-tag-btn">
75
75
  <span class="at_custom_tooltip">
76
76
  <p class="at_tag_sort_option">${i18n.t('HideAll')}</p>
77
77
  </span>
78
78
  </span>
79
79
  </div>
80
- <div class="at_button at_ghost" id="at-add-tag-btn" data-cy="at-add-tag-btn" target-pane="at-tag-form-pane">
80
+ <div class="at_button at_ghost ${_mpConfig.restrictionConfig.isTagReadOnly ? 'at_hidden' : ''}" id="at-add-tag-btn" data-cy="at-add-tag-btn" target-pane="at-tag-form-pane">
81
81
  ${i18n.t('AddTag')}
82
82
  <span class="mdi mdi-plus-circle-outline" id="at-add-tag-btn"></span>
83
83
  </div>
@@ -174,8 +174,6 @@ export function renderTags(tags, showOwnTagsOnly = false) {
174
174
  console.log("renderTags", tags);
175
175
  iotTags = tags;
176
176
  const tagContainer = document.getElementById('at-tag-list-container');
177
- // get value from mp config
178
- const isReadOnly = _mpConfig.restrictionConfig.isTagReadOnly;
179
177
  if (!tagContainer) {
180
178
  console.error("Tag container does not exist in DOM");
181
179
  return;
@@ -0,0 +1,8 @@
1
+ import { IMattertagsResponse } from "./types";
2
+ /**
3
+ * Sends a GraphQL query to the Matterport API to retrieve all mattertags and their associated data for a given model ID and application key.
4
+ * @param modelId - Id of the model space
5
+ * @param appKey - Matterport app key
6
+ * @returns
7
+ */
8
+ export declare function getTagAndTagData(modelId: string, appKey: string): Promise<IMattertagsResponse>;
package/lib/graphql.js ADDED
@@ -0,0 +1,60 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ /**
11
+ * Sends a GraphQL query to the Matterport API to retrieve all mattertags and their associated data for a given model ID and application key.
12
+ * @param modelId - Id of the model space
13
+ * @param appKey - Matterport app key
14
+ * @returns
15
+ */
16
+ export function getTagAndTagData(modelId, appKey) {
17
+ return __awaiter(this, void 0, void 0, function* () {
18
+ var query = `{
19
+ model(id: "${modelId}") {
20
+ mattertags(includeDisabled: true) {
21
+ id
22
+ floor { id }
23
+ created
24
+ modified
25
+ enabled
26
+ color
27
+ icon
28
+ keywords
29
+ label
30
+ description
31
+ media
32
+ mediaType
33
+ position { x, y, z }
34
+ anchorPosition { x, y, z }
35
+ discPosition { x, y, z }
36
+ stemNormal { x, y, z }
37
+ stemLength
38
+ stemEnabled
39
+ stemDirection { x, y, z } # Deprecated, use stemNormal and stemLength
40
+
41
+ }
42
+ }
43
+ }`;
44
+ var headers = {
45
+ 'Content-Type': 'application/graphql',
46
+ 'x-matterport-application-key': appKey,
47
+ };
48
+ var options = {
49
+ method: 'POST',
50
+ mode: 'cors',
51
+ headers: headers,
52
+ body: query,
53
+ redirect: 'follow',
54
+ };
55
+ var url = 'https://my.matterport.com/api/mp/models/graph';
56
+ //@ts-ignore
57
+ const response = yield fetch(url, options);
58
+ return yield response.json();
59
+ });
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "architwin",
3
- "version": "1.18.5",
3
+ "version": "1.18.7",
4
4
  "description": "ArchiTwin Library for Matterport",
5
5
  "main": "./lib/architwin.js",
6
6
  "types": "./lib/architwin.d.ts",