From 54669a942cc9c2d682f53148c48d5a55699e9e64 Mon Sep 17 00:00:00 2001 From: Gaelle Date: Wed, 4 Oct 2023 09:39:23 +0200 Subject: [PATCH 1/4] Fix make multiple snapshots --- .../BcfTopicSnapshotsActions.scss | 10 ------ .../BcfTopicSnapshotsActions.vue | 29 ----------------- .../BcfTopicSnapshots.scss | 3 ++ .../bcf-topic-snapshots/BcfTopicSnapshots.vue | 32 ++++++++++++++++--- 4 files changed, 30 insertions(+), 44 deletions(-) delete mode 100644 src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.scss 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 deleted file mode 100644 index cc38fb5..0000000 --- a/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.scss +++ /dev/null @@ -1,10 +0,0 @@ -.bcf-topic-snapshots-actions { - &:not(.bcf-topic-snapshots-actions__xs) { - display: flex; - flex-direction: column; - gap: 6px; - } - label { - 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..4833560 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,8 +1,6 @@ - - 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..0ec4a9e 100644 --- a/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.vue +++ b/src/components/bcf-topic-form/bcf-topic-snapshots/BcfTopicSnapshots.vue @@ -18,11 +18,25 @@ @@ -55,12 +69,20 @@ export default { }, emits: ["create-viewpoint", "delete-viewpoint"], setup(props, { emit }) { + const createViewpoints = () => { + const viewers = Object.values(props.getViewers?.() ?? {}).flat(); + viewers.forEach(async (viewer) => { + const viewpoint = await viewer.getViewpoint(); + emit("create-viewpoint", viewpoint); + }); + }; const deleteViewpoint = (viewpoint) => { emit("delete-viewpoint", viewpoint); }; return { // Methods + createViewpoints, deleteViewpoint, }; }, From 043d4ecb73eb073c77697918e8c241149f8b5dfb Mon Sep 17 00:00:00 2001 From: Gaelle Date: Wed, 4 Oct 2023 10:02:25 +0200 Subject: [PATCH 2/4] delete unused order in config --- src/config.js | 6 ------ 1 file changed, 6 deletions(-) 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", From b2baf5a6725e2efe6b6949db4d355420ad86bde4 Mon Sep 17 00:00:00 2001 From: Gaelle Date: Wed, 4 Oct 2023 11:05:23 +0200 Subject: [PATCH 3/4] add createViewpoint & uploadViewpoint into BcfTopicForm --- .../bcf-topic-form/BcfTopicForm.vue | 38 +++++++++++- .../BcfTopicSnapshotsActions.vue | 58 +++++-------------- .../bcf-topic-snapshots/BcfTopicSnapshots.vue | 26 ++------- 3 files changed, 54 insertions(+), 68 deletions(-) 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.vue b/src/components/bcf-topic-form/bcf-topic-snapshots-actions/BcfTopicSnapshotsActions.vue index 4833560..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 @@ -3,7 +3,7 @@ class="bcf-topic-snapshots-actions flex" > - + @@ -44,6 +42,7 @@ + + \ No newline at end of file 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 0ec4a9e..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,7 +18,7 @@