This commit is contained in:
isUnknown 2024-12-20 15:52:42 +01:00
parent 9b5a61e57d
commit 9d496efd03
3 changed files with 21 additions and 3 deletions

View file

@ -51,19 +51,21 @@ import { storeToRefs } from "pinia";
import { usePageStore } from "../../../stores/page"; import { usePageStore } from "../../../stores/page";
import Interactive360 from "./Interactive360.vue"; import Interactive360 from "./Interactive360.vue";
import { useDialogStore } from "../../../stores/dialog"; import { useDialogStore } from "../../../stores/dialog";
import { useVirtualSampleStore } from "../../../stores/virtualSample";
const { page } = storeToRefs(usePageStore()); const { page } = storeToRefs(usePageStore());
const { isCommentsOpen, isCommentPanelEnabled, activeTracks } = storeToRefs( const { isCommentsOpen, isCommentPanelEnabled, activeTracks } = storeToRefs(
useDialogStore() useDialogStore()
); );
const { isCompareModeEnabled } = storeToRefs(useVirtualSampleStore());
const tracks = computed( const tracks = computed(
() => () =>
page.value.steps.find((step) => step.slug === "virtual-sample").files page.value.steps.find((step) => step.slug === "virtual-sample").files
.dynamic .dynamic
); );
const isCompareModeEnabled = ref(false);
watch(isCompareModeEnabled, (newValue) => { watch(isCompareModeEnabled, (newValue) => {
if (newValue) { if (newValue) {
isCommentsOpen.value = false; isCommentsOpen.value = false;

View file

@ -5,7 +5,16 @@
class="drag-zone" class="drag-zone"
:class="{ grabbing: isDragToRotateEnabled }" :class="{ grabbing: isDragToRotateEnabled }"
></div> ></div>
<img :src="openedFile.url" alt="" width="500" height="500" /> <img
:src="
virtualSampleStore.isCompareModeEnabled
? currentFile.url
: openedFile.url
"
alt=""
width="500"
height="500"
/>
</figure> </figure>
<div <div
id="helper" id="helper"

View file

@ -5,6 +5,7 @@ import { usePageStore } from "./page";
export const useVirtualSampleStore = defineStore("virtual-sample", () => { export const useVirtualSampleStore = defineStore("virtual-sample", () => {
const { page } = usePageStore(); const { page } = usePageStore();
const step = page.steps.find((step) => step.id === "virtualSample"); const step = page.steps.find((step) => step.id === "virtualSample");
const isCompareModeEnabled = ref(false);
const activeTab = ref(step.files.dynamic ? "dynamic" : "static"); const activeTab = ref(step.files.dynamic ? "dynamic" : "static");
const currentFile = ref(null); const currentFile = ref(null);
@ -12,5 +13,11 @@ export const useVirtualSampleStore = defineStore("virtual-sample", () => {
watch(activeTab, () => (currentFile.value = null)); watch(activeTab, () => (currentFile.value = null));
return { activeTab, currentFile, step, isLoopAnimationEnabled }; return {
activeTab,
currentFile,
step,
isLoopAnimationEnabled,
isCompareModeEnabled,
};
}); });