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"
|
data-icon="comment"
|
||||||
@click="isCommentsOpen = !isCommentsOpen"
|
@click="isCommentsOpen = !isCommentsOpen"
|
||||||
>
|
>
|
||||||
<span class="sr-only">{{ isCommentsOpen ? 'Masquer' : 'Afficher' }} les commentaires</span>
|
<span class="sr-only"
|
||||||
|
>{{ isCommentsOpen ? "Masquer" : "Afficher" }} les commentaires</span
|
||||||
|
>
|
||||||
</button>
|
</button>
|
||||||
<Comments v-if="isCommentsOpen" @show-draft-marker="showDraftMarker" />
|
<Comments v-if="isCommentsOpen" @show-draft-marker="showDraftMarker" />
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -49,8 +51,8 @@ watch(isCommentsOpen, (newVal) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(openedFile, (newVal) => {
|
watch(openedFile, (newVal, oldVal) => {
|
||||||
if (!location.href.includes("virtual-sample")) return;
|
if (newVal.url === oldVal.url) return;
|
||||||
|
|
||||||
isViewerDisabled.value = true;
|
isViewerDisabled.value = true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,14 @@ import throttle from "lodash/throttle";
|
||||||
import { ref, computed, watch } from "vue";
|
import { ref, computed, watch } from "vue";
|
||||||
import { useVirtualSampleStore } from "../../../stores/virtualSample";
|
import { useVirtualSampleStore } from "../../../stores/virtualSample";
|
||||||
import { storeToRefs } from "pinia";
|
import { storeToRefs } from "pinia";
|
||||||
|
import { useDialogStore } from "../../../stores/dialog";
|
||||||
|
|
||||||
const { activeTrack } = defineProps({
|
const { activeTrack } = defineProps({
|
||||||
activeTrack: Object,
|
activeTrack: Object,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Helper
|
// Helper
|
||||||
|
const { openedFile } = storeToRefs(useDialogStore());
|
||||||
const virtualSampleStore = useVirtualSampleStore();
|
const virtualSampleStore = useVirtualSampleStore();
|
||||||
const isHelperHidden = ref(localStorage.getItem("isHelperHidden"));
|
const isHelperHidden = ref(localStorage.getItem("isHelperHidden"));
|
||||||
localStorage.setItem("isHelperHidden", true);
|
localStorage.setItem("isHelperHidden", true);
|
||||||
|
|
@ -56,9 +58,16 @@ const currentFileIndex = computed(() => currentY.value + "_" + currentX.value);
|
||||||
const currentFile = computed(() =>
|
const currentFile = computed(() =>
|
||||||
activeTrack.files.find((file) => file.name.includes(currentFileIndex.value))
|
activeTrack.files.find((file) => file.name.includes(currentFileIndex.value))
|
||||||
);
|
);
|
||||||
watch(currentFile, () => (virtualSampleStore.currentFile = currentFile.value), {
|
watch(
|
||||||
|
currentFile,
|
||||||
|
() => {
|
||||||
|
virtualSampleStore.currentFile = currentFile.value;
|
||||||
|
openedFile.value = currentFile.value;
|
||||||
|
},
|
||||||
|
{
|
||||||
immediate: true,
|
immediate: true,
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
function rotateX(direction) {
|
function rotateX(direction) {
|
||||||
if (direction == "left") {
|
if (direction == "left") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue