Skip to content

Commit

Permalink
MINOR: Add Topic viewer layout if multi viewpoints (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurtil authored Jul 9, 2024
1 parent 2ca6302 commit 9f78694
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/components/bcf-topic-form/BcfTopicForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ export default {
.filter((v) => v.snapshot)
);
let viewerLayout = null;
const hasErrorTitle = ref(false);
const isOpenModal = ref(false);
const loading = ref(false);
Expand Down Expand Up @@ -345,15 +347,21 @@ export default {
{ immediate: true }
);
const createViewpoints = () => {
Promise.all(
($viewer?.globalContext.localContexts ?? [])
.filter(ctx => ctx.viewer && ctx.loadedModels.length > 0)
const createViewpoints = async () => {
const contexts = ($viewer?.globalContext.localContexts ?? [])
.filter(ctx => ctx.viewer && ctx.loadedModels.length > 0);
await Promise.all(
contexts
.map(async ctx => {
const viewpoint = await getViewerViewpoint(ctx);
viewpointsToCreate.value.push(viewpoint);
})
);
if (contexts.length > 1) {
viewerLayout = JSON.stringify($viewer?.globalContext.layout);
} else {
viewerLayout = null;
}
};
const uploadViewpoints = (event) => {
Expand Down Expand Up @@ -446,6 +454,7 @@ export default {
due_date: topicDueDate.value,
description: topicDescription.value,
labels: topicLabels.value,
bimdata_viewer_layout: viewpointsToCreate.value.length > 1 && viewerLayout ? viewerLayout : null,
};
let newTopic;
Expand Down

0 comments on commit 9f78694

Please sign in to comment.