From af61f49e2bbfc83f4af5aebab269298d1e4d5dda Mon Sep 17 00:00:00 2001 From: isUnknown Date: Tue, 17 Dec 2024 15:08:03 +0100 Subject: [PATCH] #56 - prepare compare logic --- .../project/virtual-sample/DynamicView.vue | 47 +++++++++++++------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/components/project/virtual-sample/DynamicView.vue b/src/components/project/virtual-sample/DynamicView.vue index 8918e70..3166b41 100644 --- a/src/components/project/virtual-sample/DynamicView.vue +++ b/src/components/project/virtual-sample/DynamicView.vue @@ -5,31 +5,32 @@ -
- -
- -
+
@@ -45,7 +46,9 @@ const tracks = computed( () => page.value.steps[page.value.steps.length - 1].files.dynamic ); -const activeTrack = ref(tracks.value[0]); +const isCompareModeEnabled = ref(false); + +const activeTracks = ref([tracks.value[0]]); function getFrontViewUrl(track) { if (track.files.length > 1) { @@ -54,6 +57,20 @@ function getFrontViewUrl(track) { return track.files[0].url; } } + +function selectTrack(track) { + if (isCompareModeEnabled.value) { + if (activeTracks.value.includes(track)) { + activeTracks.value = activeTracks.value.filter( + (item) => item.title !== track.title + ); + } else { + activeTracks.value.push(track); + } + } else { + activeTracks.value = [track]; + } +}