Pdf viewer : reload only on file change

This commit is contained in:
isUnknown 2024-12-19 15:02:18 +01:00
parent 94c35eadaf
commit ad6f7736c0
2 changed files with 17 additions and 6 deletions

View file

@ -25,12 +25,14 @@ import throttle from "lodash/throttle";
import { ref, computed, watch } from "vue";
import { useVirtualSampleStore } from "../../../stores/virtualSample";
import { storeToRefs } from "pinia";
import { useDialogStore } from "../../../stores/dialog";
const { activeTrack } = defineProps({
activeTrack: Object,
});
// Helper
const { openedFile } = storeToRefs(useDialogStore());
const virtualSampleStore = useVirtualSampleStore();
const isHelperHidden = ref(localStorage.getItem("isHelperHidden"));
localStorage.setItem("isHelperHidden", true);
@ -56,9 +58,16 @@ const currentFileIndex = computed(() => currentY.value + "_" + currentX.value);
const currentFile = computed(() =>
activeTrack.files.find((file) => file.name.includes(currentFileIndex.value))
);
watch(currentFile, () => (virtualSampleStore.currentFile = currentFile.value), {
immediate: true,
});
watch(
currentFile,
() => {
virtualSampleStore.currentFile = currentFile.value;
openedFile.value = currentFile.value;
},
{
immediate: true,
}
);
function rotateX(direction) {
if (direction == "left") {