designtopack/src/stores/virtualSample.js

24 lines
654 B
JavaScript
Raw Normal View History

import { defineStore } from "pinia";
import { ref, watch } from "vue";
2024-11-21 13:20:57 +01:00
import { usePageStore } from "./page";
export const useVirtualSampleStore = defineStore("virtual-sample", () => {
2024-11-21 13:20:57 +01:00
const { page } = usePageStore();
const step = page.steps.find((step) => step.id === "virtualSample");
2024-12-20 15:52:42 +01:00
const isCompareModeEnabled = ref(false);
2024-11-21 13:20:57 +01:00
const activeTab = ref(step.files.dynamic ? "dynamic" : "static");
const currentFile = ref(null);
const isLoopAnimationEnabled = ref(false);
watch(activeTab, () => (currentFile.value = null));
2024-12-20 15:52:42 +01:00
return {
activeTab,
currentFile,
step,
isLoopAnimationEnabled,
isCompareModeEnabled,
};
});