mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-15 08:24:50 +02:00
Add:Tap cover to show fullscreen cover image #224
This commit is contained in:
parent
0ca8de5916
commit
cd4c280950
3 changed files with 84 additions and 3 deletions
74
components/modals/FullscreenCover.vue
Normal file
74
components/modals/FullscreenCover.vue
Normal file
|
@ -0,0 +1,74 @@
|
|||
<template>
|
||||
<modals-modal v-model="show" width="100%" height="100%" max-width="100%">
|
||||
<div class="w-full h-full overflow-hidden absolute top-0 left-0 flex items-center justify-center" @click="show = false">
|
||||
<covers-book-cover :library-item="libraryItem" :width="width" :book-cover-aspect-ratio="bookCoverAspectRatio" />
|
||||
</div>
|
||||
</modals-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
value: Boolean,
|
||||
libraryItem: {
|
||||
type: Object,
|
||||
default: () => {}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
width: 0
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
show(val) {
|
||||
if (val) {
|
||||
this.setWidth()
|
||||
this.setListeners()
|
||||
} else {
|
||||
this.removeListeners()
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
show: {
|
||||
get() {
|
||||
return this.value
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('input', val)
|
||||
}
|
||||
},
|
||||
bookCoverAspectRatio() {
|
||||
return this.$store.getters['getBookCoverAspectRatio']
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
screenOrientationChange() {
|
||||
setTimeout(this.setWidth, 50)
|
||||
},
|
||||
setListeners() {
|
||||
screen.orientation.addEventListener('change', this.screenOrientationChange)
|
||||
},
|
||||
removeListeners() {
|
||||
screen.orientation.removeEventListener('change', this.screenOrientationChange)
|
||||
},
|
||||
setWidth() {
|
||||
if (window.innerHeight > window.innerWidth) {
|
||||
this.width = window.innerWidth
|
||||
} else {
|
||||
this.width = window.innerHeight / this.bookCoverAspectRatio
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.setWidth()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.filter-modal-wrapper {
|
||||
max-height: calc(100% - 320px);
|
||||
}
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue