diff options
Diffstat (limited to 'viewer/src/views/GalleryThumbnail.vue')
-rw-r--r-- | viewer/src/views/GalleryThumbnail.vue | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/viewer/src/views/GalleryThumbnail.vue b/viewer/src/views/GalleryThumbnail.vue index 4d8f604..7ceea4f 100644 --- a/viewer/src/views/GalleryThumbnail.vue +++ b/viewer/src/views/GalleryThumbnail.vue | |||
@@ -18,8 +18,15 @@ | |||
18 | --> | 18 | --> |
19 | 19 | ||
20 | <template> | 20 | <template> |
21 | <div> | 21 | <div class="forcedsize" :class="{preload: loading}"> |
22 | <img v-if="item.thumbnail" class="thumbnail" :src="pictureSrc" :title="item.path" /> | 22 | <v-lazy-image |
23 | v-if="item.thumbnail" | ||
24 | class="thumbnail" | ||
25 | :src="pictureSrc" | ||
26 | :title="item.path" | ||
27 | @intersect="loading=true" | ||
28 | @load="loading=false" | ||
29 | /> | ||
23 | <div v-else class="flex-column flex-center"> | 30 | <div v-else class="flex-column flex-center"> |
24 | <fa-icon icon="folder" class="fa-4x" /> | 31 | <fa-icon icon="folder" class="fa-4x" /> |
25 | {{item.path}} | 32 | {{item.path}} |
@@ -34,6 +41,8 @@ import { Component, Vue, Prop } from "vue-property-decorator"; | |||
34 | export default class GalleryThumbnail extends Vue { | 41 | export default class GalleryThumbnail extends Vue { |
35 | @Prop({ required: true }) readonly item!: Gallery.Item; | 42 | @Prop({ required: true }) readonly item!: Gallery.Item; |
36 | 43 | ||
44 | loading: boolean = false; | ||
45 | |||
37 | get pictureSrc() { | 46 | get pictureSrc() { |
38 | return `${process.env.VUE_APP_DATA_URL}${this.item.thumbnail}`; | 47 | return `${process.env.VUE_APP_DATA_URL}${this.item.thumbnail}`; |
39 | } | 48 | } |
@@ -41,8 +50,29 @@ export default class GalleryThumbnail extends Vue { | |||
41 | </script> | 50 | </script> |
42 | 51 | ||
43 | <style lang="scss"> | 52 | <style lang="scss"> |
53 | @import "@/assets/scss/theme.scss"; | ||
54 | |||
44 | .thumbnail { | 55 | .thumbnail { |
45 | max-width: 250px; | 56 | max-width: 250px; |
46 | max-height: 250px; | 57 | max-height: 250px; |
47 | } | 58 | } |
59 | .preload { | ||
60 | background: linear-gradient(to right, rgba(0, 0, 0, 0) 8%, $loader-color 18%, rgba(0, 0, 0, 0) 33%); | ||
61 | background-size: 200% 50px; | ||
62 | animation: preloadAnimation 2s infinite linear; | ||
63 | } | ||
64 | @keyframes preloadAnimation { | ||
65 | from { | ||
66 | background-position: -200px 0; | ||
67 | } | ||
68 | to { | ||
69 | background-position: 200px 0; | ||
70 | } | ||
71 | } | ||
72 | // Temporary size until we get the true thumbnail size | ||
73 | .forcedsize { | ||
74 | width: 250px; | ||
75 | height: 250px; | ||
76 | text-align: center; | ||
77 | } | ||
48 | </style> | 78 | </style> |