Image now porperly scaled on any image aspect ratio

This commit is contained in:
EisiBaer 2023-07-30 21:15:20 +02:00
parent be8aab0986
commit e21793ada4
3 changed files with 8 additions and 7 deletions

View File

@ -185,3 +185,7 @@ $utilities: map-merge(
.buzzer-answering:active{ .buzzer-answering:active{
background-color: shade-color( $green-active, 10% ); background-color: shade-color( $green-active, 10% );
} }
.image-contain{
object-fit: contain;
}

View File

@ -54,12 +54,12 @@ watch(
<div class="d-flex justify-content-center align-items-center position-absolute bottom-0 start-0 h-100 w-100 bg-dark-primary"> <div class="d-flex justify-content-center align-items-center position-absolute bottom-0 start-0 h-100 w-100 bg-dark-primary">
<template v-if="route.path.includes('create') && getImageInGameCreationStore !== undefined"> <template v-if="route.path.includes('create') && getImageInGameCreationStore !== undefined">
<div class="h-75 w-100 text-center"> <div class="h-75 w-100 text-center">
<img class="h-100" :src="getImageInGameCreationStore.url" /> <img class="image-contain h-100 w-100" :src="getImageInGameCreationStore.url" loading="eager" />
</div> </div>
</template> </template>
<template v-else-if="answer.filename"> <template v-else-if="answer.filename">
<div class="h-75 w-100 text-center"> <div class="h-75 w-100 text-center">
<img ref="imageRef" class="h-100" src="" /> <img ref="imageRef" class="image-contain h-100 w-100" src="" loading="eager" />
</div> </div>
</template> </template>
<div class="d-flex justify-content-center align-items-center position-absolute bottom-0 start-50 translate-middle mt-5"> <div class="d-flex justify-content-center align-items-center position-absolute bottom-0 start-50 translate-middle mt-5">
@ -77,6 +77,3 @@ watch(
</div> </div>
</template> </template>
</template> </template>
<style scoped>
</style>

View File

@ -76,12 +76,12 @@ watch(
<template v-if="question.questionType === 'imageQuestion'"> <template v-if="question.questionType === 'imageQuestion'">
<template v-if="route.path.includes('create') && getImageInGameCreationStore !== undefined"> <template v-if="route.path.includes('create') && getImageInGameCreationStore !== undefined">
<div class="h-75 w-100 text-center"> <div class="h-75 w-100 text-center">
<img class="h-100" :src="getImageInGameCreationStore.url" /> <img class="image-contain h-100 w-100" :src="getImageInGameCreationStore.url" loading="eager" />
</div> </div>
</template> </template>
<template v-else-if="question.filename"> <template v-else-if="question.filename">
<div class="h-75 w-100 text-center"> <div class="h-75 w-100 text-center">
<img ref="imageRef" class="h-100" src="" /> <img ref="imageRef" class="image-contain h-100 w-100" src="" loading="eager" />
</div> </div>
</template> </template>
</template> </template>