single track selector working

This commit is contained in:
isUnknown 2025-05-27 15:29:57 +02:00
parent df53bf0267
commit 62a716495b
2 changed files with 169 additions and 20 deletions

View file

@ -2,18 +2,11 @@
<div class="dialog__inner">
<header class="tracks-header | flex">
<div class="tracks">
<button
v-for="(track, index) in tracks"
class="btn btn--image"
:aria-pressed="activeTracks.includes(track) ? true : false"
:aria-controls="track.slug"
:id="track.slug"
:style="`--btn-image: url(${getFrontViewUrl(track)});`"
@click="selectTrack(track)"
:data-comments="getCommentsCount(track)"
>
<span>{{ track.title }}</span>
</button>
<Selector
:label="'piste'"
:items="tracks"
@update:selectedItems="selectTrack"
/>
</div>
<button
v-if="tracks.length > 1"
@ -55,6 +48,7 @@ import { useVirtualSampleStore } from '../../../stores/virtualSample';
import { useRoute } from 'vue-router';
import Interactive360 from './Interactive360.vue';
import SingleImage from './SingleImage.vue';
import Selector from '../../Selector.vue';
const route = useRoute();
@ -122,14 +116,6 @@ watch(isCompareModeEnabled, (newValue) => {
}
});
function getFrontViewUrl(track) {
if (track.files.length > 1) {
return track.files[7].url;
} else {
return track.files[0].url;
}
}
function selectTrack(track) {
if (!isCompareModeEnabled.value) {
activeTracks.value = [track];