@bimdata/bcf-components 6.2.1-rc.5 → 6.2.1-rc.6

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.2.1-rc.5",
3
+ "version": "6.2.1-rc.6",
4
4
  "files": [
5
5
  "src",
6
6
  "vue3-plugin.js"
@@ -96,7 +96,7 @@
96
96
  <script>
97
97
  import { onMounted, inject, ref, watch, onBeforeUnmount } from "vue";
98
98
  import service from "../../../service.js";
99
- import { getViewerOptions, highlightViewer, unhighlightViewer } from "../../../utils/viewer.js";
99
+ import { getViewerOptions, getViewerViewpoint, highlightViewer, unhighlightViewer } from "../../../utils/viewer.js";
100
100
 
101
101
  // Components
102
102
  import TopicComment from "./topic-comment/TopicComment.vue";
@@ -153,9 +153,7 @@ export default {
153
153
  const createViewpoint = async ({ context }) => {
154
154
  unhighlightViewer(context);
155
155
  viewerSelectVisible.value = false;
156
- const vpt = context.getViewpoint();
157
- vpt.snapshot = await context.getSnapshot();
158
- viewpoint.value = vpt;
156
+ viewpoint.value = await getViewerViewpoint(context);
159
157
  };
160
158
 
161
159
  const deleteViewpoint = () => {
@@ -139,7 +139,7 @@
139
139
  <script>
140
140
  import { inject, onMounted, ref, onBeforeUnmount } from "vue";
141
141
  import service from "../../../../service.js";
142
- import { getViewerOptions, highlightViewer, unhighlightViewer } from "../../../../utils/viewer.js";
142
+ import { getViewerOptions, getViewerViewpoint, highlightViewer, unhighlightViewer } from "../../../../utils/viewer.js";
143
143
 
144
144
  // TODO: should be imported from DS
145
145
  import UserAvatar from "../../../user-avatar/UserAvatar.vue";
@@ -218,9 +218,7 @@ export default {
218
218
  const createViewpoint = async ({ context }) => {
219
219
  unhighlightViewer(context);
220
220
  viewerSelectVisible.value = false;
221
- const vpt = context.getViewpoint();
222
- vpt.snapshot = await context.getSnapshot();
223
- viewpoint.value = vpt;
221
+ viewpoint.value = await getViewerViewpoint(context);
224
222
  };
225
223
 
226
224
  const canEditComment = comment => {
@@ -4,16 +4,24 @@ export function getViewerOptions($viewer) {
4
4
  .map((ctx, i) => ({ key: ctx.id, index: i, name: ctx.viewer.$plugin.name, context: ctx }));
5
5
  }
6
6
 
7
+ export async function getViewerViewpoint(context) {
8
+ const ctx = context.viewer.$viewer.localContext;
9
+ return {
10
+ ...ctx.getViewpoint(),
11
+ snapshot: await ctx.getSnapshot()
12
+ };
13
+ }
14
+
7
15
  export function highlightViewer(context) {
8
- const el = context.viewer.$viewer.localContext.el;
9
- el.style.boxSizing = "border-box";
10
- el.style.border = "2px solid var(--color-primary)";
11
- el.style.opacity = ".85";
16
+ const ctx = context.viewer.$viewer.localContext;
17
+ ctx.el.style.boxSizing = "border-box";
18
+ ctx.el.style.border = "2px solid var(--color-primary)";
19
+ ctx.el.style.opacity = ".85";
12
20
  }
13
21
 
14
22
  export function unhighlightViewer(context) {
15
- const el = context.viewer.$viewer.localContext.el;
16
- el.style.boxSizing = "";
17
- el.style.border = "";
18
- el.style.opacity = "";
23
+ const ctx = context.viewer.$viewer.localContext;
24
+ ctx.el.style.boxSizing = "";
25
+ ctx.el.style.border = "";
26
+ ctx.el.style.opacity = "";
19
27
  }