adapt kanban images show to new structure
This commit is contained in:
parent
73c78b7658
commit
92007f7161
5 changed files with 48 additions and 16 deletions
|
|
@ -9,8 +9,13 @@
|
|||
<script setup>
|
||||
import Images from './Images.vue';
|
||||
import { computed } from 'vue';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { useVirtualSampleStore } from '../../../stores/virtualSample';
|
||||
|
||||
const { step } = defineProps({ step: Object });
|
||||
|
||||
const { allVariations } = storeToRefs(useVirtualSampleStore());
|
||||
|
||||
const images = computed(() => {
|
||||
if (!step.files.dynamic) {
|
||||
return [
|
||||
|
|
@ -19,20 +24,20 @@ const images = computed(() => {
|
|||
},
|
||||
];
|
||||
}
|
||||
return step.files?.dynamic?.map((track) => getFrontView(track)) ?? [];
|
||||
return allVariations.value.map((variation) => getFrontView(variation)) ?? [];
|
||||
});
|
||||
|
||||
const uri = '/' + step.uri;
|
||||
|
||||
function getFrontView(track) {
|
||||
if (track.files.length === 1) return track.files[0];
|
||||
function getFrontView(variation) {
|
||||
if (variation.files.length === 1) return variation.files[0];
|
||||
const xMax = parseInt(
|
||||
track.files[track.files.length - 1].name.split('_')[1].split('.')[0]
|
||||
variation.files[variation.files.length - 1].name.split('_')[1].split('.')[0]
|
||||
);
|
||||
const xFrontView = (xMax + 1) / 2;
|
||||
const extension = track.files[0].name.split('.')[1];
|
||||
const extension = variation.files[0].name.split('.')[1];
|
||||
const frontViewName = '0_' + xFrontView + '.' + extension;
|
||||
const frontView = track.files.find((file) => file.name === frontViewName);
|
||||
const frontView = variation.files.find((file) => file.name === frontViewName);
|
||||
return frontView;
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue