Pdf viewer : reload only on file change
This commit is contained in:
parent
94c35eadaf
commit
ad6f7736c0
2 changed files with 17 additions and 6 deletions
|
|
@ -14,7 +14,9 @@
|
|||
data-icon="comment"
|
||||
@click="isCommentsOpen = !isCommentsOpen"
|
||||
>
|
||||
<span class="sr-only">{{ isCommentsOpen ? 'Masquer' : 'Afficher' }} les commentaires</span>
|
||||
<span class="sr-only"
|
||||
>{{ isCommentsOpen ? "Masquer" : "Afficher" }} les commentaires</span
|
||||
>
|
||||
</button>
|
||||
<Comments v-if="isCommentsOpen" @show-draft-marker="showDraftMarker" />
|
||||
</template>
|
||||
|
|
@ -49,8 +51,8 @@ watch(isCommentsOpen, (newVal) => {
|
|||
}
|
||||
});
|
||||
|
||||
watch(openedFile, (newVal) => {
|
||||
if (!location.href.includes("virtual-sample")) return;
|
||||
watch(openedFile, (newVal, oldVal) => {
|
||||
if (newVal.url === oldVal.url) return;
|
||||
|
||||
isViewerDisabled.value = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -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") {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue