comments panel : fix comments when active track is single file

This commit is contained in:
isUnknown 2025-02-07 17:34:23 +01:00
parent 41ae744d08
commit 037fad871a
2 changed files with 55 additions and 35 deletions

View file

@ -55,9 +55,8 @@ import { useDialogStore } from '../../../stores/dialog';
import { useVirtualSampleStore } from '../../../stores/virtualSample';
const { page } = storeToRefs(usePageStore());
const { isCommentsOpen, isCommentPanelEnabled, activeTracks } = storeToRefs(
useDialogStore()
);
const { isCommentsOpen, isCommentPanelEnabled, activeTracks, openedFile } =
storeToRefs(useDialogStore());
const { isCompareModeEnabled } = storeToRefs(useVirtualSampleStore());
@ -67,6 +66,27 @@ const tracks = computed(
.dynamic
);
const isSingleImage = computed(() => {
return (
activeTracks.value?.length === 1 &&
activeTracks.value[0]?.files.length === 1
);
});
const singleFile = computed(() => {
return isSingleImage.value && activeTracks.value[0].files[0];
});
watch(
singleFile,
(newValue) => {
if (newValue) {
openedFile.value = singleFile;
}
},
{ immediate: true }
);
watch(isCompareModeEnabled, (newValue) => {
if (newValue) {
isCommentsOpen.value = false;