feat: larger previewer content
This commit is contained in:
parent
5b28aa0848
commit
62fff5ca60
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="previewer">
|
<div id="previewer" @mousemove="toggleNavigation" @touchstart="toggleNavigation">
|
||||||
<div class="bar">
|
<div class="bar">
|
||||||
<button @click="back" class="action" :title="$t('files.closePreview')" :aria-label="$t('files.closePreview')" id="close">
|
<button @click="back" class="action" :title="$t('files.closePreview')" :aria-label="$t('files.closePreview')" id="close">
|
||||||
<i class="material-icons">close</i>
|
<i class="material-icons">close</i>
|
||||||
|
@ -28,18 +28,11 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="action" @click="prev" v-show="hasPrevious" :aria-label="$t('buttons.previous')" :title="$t('buttons.previous')">
|
|
||||||
<i class="material-icons">chevron_left</i>
|
|
||||||
</button>
|
|
||||||
<button class="action" @click="next" v-show="hasNext" :aria-label="$t('buttons.next')" :title="$t('buttons.next')">
|
|
||||||
<i class="material-icons">chevron_right</i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<template v-if="!loading">
|
<template v-if="!loading">
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
<ExtendedImage v-if="req.type == 'image'" :src="raw"></ExtendedImage>
|
<ExtendedImage v-if="req.type == 'image'" :src="raw"></ExtendedImage>
|
||||||
<audio v-else-if="req.type == 'audio'" :src="raw" autoplay controls></audio>
|
<audio v-else-if="req.type == 'audio'" :src="raw" controls></audio>
|
||||||
<video v-else-if="req.type == 'video'" :src="raw" autoplay controls>
|
<video v-else-if="req.type == 'video'" :src="raw" controls>
|
||||||
<track
|
<track
|
||||||
kind="captions"
|
kind="captions"
|
||||||
v-for="(sub, index) in subtitles"
|
v-for="(sub, index) in subtitles"
|
||||||
|
@ -57,6 +50,13 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<button @click="prev" @mouseover="hoverNav = true" @mouseleave="hoverNav = false" :class="{ hidden: !hasPrevious || !showNav }" :aria-label="$t('buttons.previous')" :title="$t('buttons.previous')">
|
||||||
|
<i class="material-icons">chevron_left</i>
|
||||||
|
</button>
|
||||||
|
<button @click="next" @mouseover="hoverNav = true" @mouseleave="hoverNav = false" :class="{ hidden: !hasNext || !showNav }" :aria-label="$t('buttons.next')" :title="$t('buttons.next')">
|
||||||
|
<i class="material-icons">chevron_right</i>
|
||||||
|
</button>
|
||||||
|
|
||||||
<div v-show="showMore" @click="resetPrompts" class="overlay"></div>
|
<div v-show="showMore" @click="resetPrompts" class="overlay"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -66,6 +66,7 @@ import { mapState } from 'vuex'
|
||||||
import url from '@/utils/url'
|
import url from '@/utils/url'
|
||||||
import { baseURL, resizePreview } from '@/utils/constants'
|
import { baseURL, resizePreview } from '@/utils/constants'
|
||||||
import { files as api } from '@/api'
|
import { files as api } from '@/api'
|
||||||
|
import throttle from 'lodash.throttle'
|
||||||
import PreviewSizeButton from '@/components/buttons/PreviewSize'
|
import PreviewSizeButton from '@/components/buttons/PreviewSize'
|
||||||
import InfoButton from '@/components/buttons/Info'
|
import InfoButton from '@/components/buttons/Info'
|
||||||
import DeleteButton from '@/components/buttons/Delete'
|
import DeleteButton from '@/components/buttons/Delete'
|
||||||
|
@ -97,7 +98,10 @@ export default {
|
||||||
listing: null,
|
listing: null,
|
||||||
name: '',
|
name: '',
|
||||||
subtitles: [],
|
subtitles: [],
|
||||||
fullSize: false
|
fullSize: false,
|
||||||
|
showNav: true,
|
||||||
|
navTimeout: null,
|
||||||
|
hoverNav: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -130,6 +134,7 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
$route: function () {
|
$route: function () {
|
||||||
this.updatePreview()
|
this.updatePreview()
|
||||||
|
this.toggleNavigation()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted () {
|
async mounted () {
|
||||||
|
@ -162,9 +167,11 @@ export default {
|
||||||
this.$router.push({ path: uri })
|
this.$router.push({ path: uri })
|
||||||
},
|
},
|
||||||
prev () {
|
prev () {
|
||||||
|
this.hoverNav = false
|
||||||
this.$router.push({ path: this.previousLink })
|
this.$router.push({ path: this.previousLink })
|
||||||
},
|
},
|
||||||
next () {
|
next () {
|
||||||
|
this.hoverNav = false
|
||||||
this.$router.push({ path: this.nextLink })
|
this.$router.push({ path: this.nextLink })
|
||||||
},
|
},
|
||||||
key (event) {
|
key (event) {
|
||||||
|
@ -232,7 +239,19 @@ export default {
|
||||||
},
|
},
|
||||||
toggleSize () {
|
toggleSize () {
|
||||||
this.fullSize = !this.fullSize
|
this.fullSize = !this.fullSize
|
||||||
}
|
},
|
||||||
|
toggleNavigation: throttle(function() {
|
||||||
|
this.showNav = true
|
||||||
|
|
||||||
|
if (this.navTimeout) {
|
||||||
|
clearTimeout(this.navTimeout)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.navTimeout = setTimeout(() => {
|
||||||
|
this.showNav = false || this.hoverNav
|
||||||
|
this.navTimeout = null
|
||||||
|
}, 1500);
|
||||||
|
}, 500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -152,10 +152,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
#previewer .preview {
|
#previewer .preview {
|
||||||
margin: 2em auto 4em;
|
|
||||||
max-width: 80%;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
height: calc(100vh - 9.7em);
|
height: calc(100vh - 3.7em);
|
||||||
}
|
}
|
||||||
|
|
||||||
#previewer .preview pre {
|
#previewer .preview pre {
|
||||||
|
@ -170,6 +168,10 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#previewer .preview video {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
#previewer .pdf {
|
#previewer .pdf {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -182,8 +184,25 @@
|
||||||
#previewer>button {
|
#previewer>button {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 50%;
|
top: calc(50% + 1.85em);
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
|
background-color: rgba(80, 80, 80, .5);
|
||||||
|
color: white;
|
||||||
|
border-radius: 50%;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
transition: 0.2s ease all;
|
||||||
|
}
|
||||||
|
|
||||||
|
#previewer>button.hidden {
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#previewer>button>i {
|
||||||
|
padding: 0.4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#previewer>button:first-of-type {
|
#previewer>button:first-of-type {
|
||||||
|
|
Loading…
Reference in New Issue