Skip to content

Commit

Permalink
fix(#231): open the right model from models-card
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed May 30, 2022
1 parent 19fb840 commit 046d573
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ export default {
const containerRect = container.value.getBoundingClientRect();
const viewportRect = viewport.value.getBoundingClientRect();
let offset = Math.abs(
Math.ceil(nbSlices * (1 - (event.clientX - containerRect.x) / containerRect.width))
Math.ceil(
nbSlices *
(1 - (event.clientX - containerRect.x) / containerRect.width)
)
);
offset = Math.min(offset, nbSlices);
translation.value = (offset - 1) * viewportRect.width;
Expand Down Expand Up @@ -113,8 +116,10 @@ export default {
name: model.name,
url: model.viewer360File
}));
image.value = images.value.length > 0 ? images.value[0] : {};
index.value = 0;
image.value = images.value.length > 0 ? images.value[0] : {};
emit("model-changed", props.models[index.value]);
},
{ immediate: true }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ import { useRouter } from "vue-router";
import { useToggle } from "@/composables/toggle.js";
import { MODEL_TYPE } from "@/config/models.js";
import routeNames from "@/router/route-names.js";
import { useModels } from "@/state/models.js";
import ModelService from "@/services/ModelService.js";
// Components
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ export default {
const containerRect = container.value.getBoundingClientRect();
const viewportRect = viewport.value.getBoundingClientRect();
let offset = Math.abs(
Math.ceil(nbSlices * (1 - (event.clientX - containerRect.x) / containerRect.width))
Math.ceil(
nbSlices *
(1 - (event.clientX - containerRect.x) / containerRect.width)
)
);
offset = Math.min(offset, nbSlices);
translation.value = (offset - 1) * viewportRect.width;
Expand Down
4 changes: 3 additions & 1 deletion src/views/project-board/project-overview/ProjectOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ export default {
const { pushNotification } = useAppNotification();
const ifcs = computed(() =>
projectModels.value.filter(model => model.type === MODEL_TYPE.IFC)
projectModels.value.filter(
model => model.type === MODEL_TYPE.IFC && !model.archived
)
);
const {
Expand Down

0 comments on commit 046d573

Please sign in to comment.