aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/components/LdPicture.vue
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/components/LdPicture.vue')
-rw-r--r--viewer/src/components/LdPicture.vue74
1 files changed, 74 insertions, 0 deletions
diff --git a/viewer/src/components/LdPicture.vue b/viewer/src/components/LdPicture.vue
new file mode 100644
index 0000000..b6a719f
--- /dev/null
+++ b/viewer/src/components/LdPicture.vue
@@ -0,0 +1,74 @@
1<!-- ldgallery - A static generator which turns a collection of tagged
2-- pictures into a searchable web gallery.
3--
4-- Copyright (C) 2019-2020 Guillaume FOUET
5--
6-- This program is free software: you can redistribute it and/or modify
7-- it under the terms of the GNU Affero General Public License as
8-- published by the Free Software Foundation, either version 3 of the
9-- License, or (at your option) any later version.
10--
11-- This program is distributed in the hope that it will be useful,
12-- but WITHOUT ANY WARRANTY; without even the implied warranty of
13-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-- GNU Affero General Public License for more details.
15--
16-- You should have received a copy of the GNU Affero General Public License
17-- along with this program. If not, see <https://www.gnu.org/licenses/>.
18-->
19
20<template>
21 <div
22 v-dragscroll
23 class="scrollbar"
24 :class="{'fit-to-screen': !$uiStore.fullscreen, 'original-size': $uiStore.fullscreen}"
25 @click="onClick"
26 @dragscrollstart="dragging=true"
27 >
28 <v-lazy-image :src="pictureSrc" />
29 </div>
30</template>
31
32<script lang="ts">
33import { Component, Vue, Prop } from "vue-property-decorator";
34
35@Component
36export default class LdPicture extends Vue {
37 @Prop({ required: true }) readonly picture!: Gallery.Picture;
38
39 dragging: boolean = false;
40
41 get pictureSrc() {
42 return `${process.env.VUE_APP_DATA_URL}${this.picture.properties.resource}`;
43 }
44
45 onClick() {
46 if (!this.dragging) this.$uiStore.toggleFullscreen();
47 this.dragging = false;
48 }
49}
50</script>
51
52<style lang="scss">
53.fit-to-screen {
54 display: flex;
55 justify-content: space-around;
56 height: 100%;
57 & > img {
58 object-fit: contain;
59 cursor: zoom-in;
60 }
61}
62.original-size {
63 display: block;
64 text-align: center;
65 cursor: grab;
66 height: 100%;
67 & > img {
68 max-width: unset;
69 max-height: unset;
70 object-fit: none;
71 cursor: zoom-out;
72 }
73}
74</style>