@bimdata/bcf-components 6.5.0 → 6.5.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bimdata/bcf-components",
3
- "version": "6.5.0",
3
+ "version": "6.5.2",
4
4
  "files": [
5
5
  "src",
6
6
  "vue3-plugin.js"
@@ -49,7 +49,7 @@
49
49
  @mouseenter="highlightViewer(element.context)"
50
50
  @mouseleave="unhighlightViewer(element.context)"
51
51
  >
52
- {{ `(${element.index}) ${element.name}` }}
52
+ {{ `(${element.index + 1}) ${element.name}` }}
53
53
  </div>
54
54
  </template>
55
55
  </BIMDataDropdownList>
@@ -94,7 +94,7 @@
94
94
  </template>
95
95
 
96
96
  <script>
97
- import { onMounted, inject, ref, watch, onBeforeUnmount } from "vue";
97
+ import { onMounted, inject, ref, watch, onBeforeUnmount, shallowRef } from "vue";
98
98
  import service from "../../../service.js";
99
99
  import { getViewerOptions, getViewerViewpoint, highlightViewer, unhighlightViewer } from "../../../utils/viewer.js";
100
100
 
@@ -125,7 +125,7 @@ export default {
125
125
  },
126
126
  emis: ["comment-created", "comment-updated", "comment-deleted", "view-comment-snapshot"],
127
127
  setup(props, { emit }) {
128
- let pluginCreatedSub, pluginDestroyedSub;
128
+ let windowOpenSub, windowCloseSub;
129
129
 
130
130
  const $viewer = inject("$viewer", null);
131
131
 
@@ -136,13 +136,15 @@ export default {
136
136
  const text = ref("");
137
137
  const viewpoint = ref(null);
138
138
  const viewerSelectVisible = ref(false);
139
- const viewerSelectOptions = ref([]);
139
+ const viewerSelectOptions = shallowRef([]);
140
140
 
141
141
  const loadComments = async () => {
142
142
  comments.value = await service.fetchTopicComments(props.project, props.topic);
143
143
  };
144
144
 
145
145
  const setCommentViewpoint = async () => {
146
+ viewerSelectOptions.value = getViewerOptions($viewer);
147
+
146
148
  if (viewerSelectOptions.value.length === 1) {
147
149
  await createViewpoint(viewerSelectOptions.value[0]);
148
150
  } else if (viewerSelectOptions.value.length > 1) {
@@ -204,20 +206,18 @@ export default {
204
206
 
205
207
  onMounted(() => {
206
208
  if ($viewer) {
207
- viewerSelectOptions.value = getViewerOptions($viewer);
208
- pluginCreatedSub = $viewer.globalContext.hub.on("plugin-created", () => {
209
- viewerSelectOptions.value = getViewerOptions($viewer);
210
- });
211
- pluginDestroyedSub = $viewer.globalContext.hub.on("plugin-destroyed", () => {
212
- viewerSelectOptions.value = getViewerOptions($viewer);
213
- });
209
+ const hideViewerSelect = () => {
210
+ viewerSelectVisible.value = false;
211
+ };
212
+ windowOpenSub = $viewer.globalContext.hub.on("window-open", hideViewerSelect);
213
+ windowCloseSub = $viewer.globalContext.hub.on("window-close", hideViewerSelect);
214
214
  }
215
215
  });
216
216
 
217
217
  onBeforeUnmount(() => {
218
218
  if ($viewer) {
219
- $viewer.globalContext.hub.off(pluginCreatedSub);
220
- $viewer.globalContext.hub.off(pluginDestroyedSub);
219
+ $viewer.globalContext.hub.off(windowOpenSub);
220
+ $viewer.globalContext.hub.off(windowCloseSub);
221
221
  }
222
222
  });
223
223
 
@@ -1,7 +1,9 @@
1
+ import { markRaw } from "vue";
2
+
1
3
  export function getViewerOptions($viewer) {
2
4
  return $viewer.globalContext.localContexts
3
5
  .filter(ctx => ctx.viewer && ctx.loadedModels.length > 0)
4
- .map((ctx, i) => ({ key: ctx.id, index: i, name: ctx.viewer.$plugin.name, context: ctx }));
6
+ .map((ctx, i) => ({ key: ctx.id, index: i, name: ctx.viewer.$plugin.name, context: markRaw(ctx) }));
5
7
  }
6
8
 
7
9
  export async function getViewerViewpoint(context) {
@@ -13,14 +15,14 @@ export async function getViewerViewpoint(context) {
13
15
 
14
16
  export function highlightViewer(context) {
15
17
  const ctx = context.viewer.$viewer.localContext;
16
- ctx.el.style.boxSizing = "border-box";
17
- ctx.el.style.border = "2px solid var(--color-primary)";
18
+ ctx.el.style.outlineOffset = "-2px";
19
+ ctx.el.style.outline = "2px solid var(--color-primary)";
18
20
  ctx.el.style.opacity = ".85";
19
21
  }
20
22
 
21
23
  export function unhighlightViewer(context) {
22
24
  const ctx = context.viewer.$viewer.localContext;
23
- ctx.el.style.boxSizing = "";
24
- ctx.el.style.border = "";
25
+ ctx.el.style.outlineOffset = "";
26
+ ctx.el.style.outline = "";
25
27
  ctx.el.style.opacity = "";
26
28
  }