diff --git a/src/components/bcf-topic-form/BcfTopicForm.vue b/src/components/bcf-topic-form/BcfTopicForm.vue
index c934485..e3d8d90 100644
--- a/src/components/bcf-topic-form/BcfTopicForm.vue
+++ b/src/components/bcf-topic-form/BcfTopicForm.vue
@@ -32,15 +32,16 @@
:viewpoints="viewpointsToDisplay"
:getViewers="getViewers"
@create-viewpoint="createViewpoint"
+ @upload-viewpoint="uploadViewpoint"
@delete-viewpoint="deleteViewpoint"
/>
{
- viewpointsToCreate.value.push(viewpoint);
+ const createViewpoint = () => {
+ const viewers = Object.values(props.getViewers?.() ?? {}).flat();
+ viewers.forEach(async (viewer) => {
+ const viewpoint = await viewer.getViewpoint();
+ viewpointsToCreate.value.push(viewpoint);
+ });
+ };
+
+ const uploadViewpoint = (event) => {
+ [...event.target.files].forEach((file) => {
+ let type;
+ if (file.type === "image/png") {
+ type = "png";
+ } else if (file.type === "image/jpeg") {
+ type = "jpg"; // `jpeg` is not a valid value, only `jpg` is
+ } else {
+ type = file.type;
+ }
+
+ const reader = new FileReader();
+ reader.addEventListener("load", () => {
+ const viewpoint = {
+ isUpload: true,
+ snapshot: {
+ snapshot_type: type,
+ snapshot_data: reader.result,
+ },
+ };
+ viewpointsToCreate.value.push(viewpoint);
+ });
+ reader.readAsDataURL(file);
+ });
};
const deleteViewpoint = (viewpoint) => {
@@ -500,6 +531,7 @@ export default {
viewpointsToDisplay,
// Methods
createViewpoint,
+ uploadViewpoint,
deleteViewpoint,
submit,
};
diff --git a/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.scss b/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.scss
index cc38fb5..2f1ae89 100644
--- a/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.scss
+++ b/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.scss
@@ -1,10 +1,9 @@
.bcf-topic-snapshots-actions {
- &:not(.bcf-topic-snapshots-actions__xs) {
- display: flex;
- flex-direction: column;
- gap: 6px;
- }
label {
+ height: 32px;
+ width: 32px;
+ display: flex;
+ justify-content: center;
cursor: pointer;
}
}
diff --git a/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.vue b/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.vue
index 74a4168..a4898bf 100644
--- a/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.vue
+++ b/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.vue
@@ -1,11 +1,9 @@
-
+
-
-
-
- {{ $t("BcfComponents.BcfTopicForm.takeSnapshot") }}
-
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.scss b/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.scss
index 25174f9..fd7d9aa 100644
--- a/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.scss
+++ b/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.scss
@@ -43,5 +43,8 @@
justify-content: center;
align-items: center;
border: 2px dashed var(--color-silver);
+ label {
+ cursor: pointer;
+ }
}
}
diff --git a/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.vue b/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.vue
index 432a7eb..bcca5b8 100644
--- a/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.vue
+++ b/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.vue
@@ -9,7 +9,7 @@
:key="viewpoint.guid || i"
>
-
+
@@ -18,11 +18,25 @@
-
+
+
+ {{ $t("BcfComponents.BcfTopicForm.takeSnapshot") }}
+
+
+
+
+
@@ -53,17 +67,7 @@ export default {
type: Function,
},
},
- emits: ["create-viewpoint", "delete-viewpoint"],
- setup(props, { emit }) {
- const deleteViewpoint = (viewpoint) => {
- emit("delete-viewpoint", viewpoint);
- };
-
- return {
- // Methods
- deleteViewpoint,
- };
- },
+ emits: ["create-viewpoint", "upload-viewpoint", "delete-viewpoint"],
};
diff --git a/src/config.js b/src/config.js
index ef8b7ed..26b85c8 100644
--- a/src/config.js
+++ b/src/config.js
@@ -45,36 +45,30 @@ const VIEWPOINT_TYPES = Object.freeze({
const VIEWPOINT_CONFIG = Object.freeze({
[VIEWPOINT_TYPES.IFC3D]: {
- order: 1,
window: "3d",
plugin: "viewer3d",
icon: "fileIfcPolychrome",
},
[VIEWPOINT_TYPES.POINT_CLOUD]: {
- order: 2,
window: "pointCloud",
plugin: "pointCloud",
},
[VIEWPOINT_TYPES.IFC2D]: {
- order: 3,
window: "2d",
plugin: "viewer2d",
icon: "fileIfcPolychrome",
},
[VIEWPOINT_TYPES.DWG]: {
- order: 4,
window: "dwg",
plugin: "dwg",
icon: "fileDwgPolychrome",
},
[VIEWPOINT_TYPES.PLAN]: {
- order: 5,
window: "plan",
plugin: "plan",
icon: "filePlanPolychrome",
},
[VIEWPOINT_TYPES.PANORAMA]: {
- order: 6,
window: "panorama",
plugin: "panorama",
icon: "filePlanPolychrome",