summaryrefslogtreecommitdiff
path: root/src/client/components/image-viewer.vue
blob: c78112b98896f750f0612ef11660093f1ef8a6f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<template>
<x-modal ref="modal" @closed="() => { $emit('closed'); destroyDom(); }">
	<img class="xubzgfga" ref="img" :src="image.url" :alt="image.name" :title="image.name" @click="close" tabindex="-1"/>
</x-modal>
</template>

<script lang="ts">
import Vue from 'vue';
import XModal from './modal.vue';

export default Vue.extend({
	components: {
		XModal,
	},

	props: {
		image: {
			type: Object,
			required: true
		},
	},

	mounted() {
		this.$nextTick(() => {
			this.$refs.img.focus();
		});
	},

	methods: {
		close() {
			this.$refs.modal.close();
		},
	}
});
</script>

<style lang="scss" scoped>
.xubzgfga {
	position: fixed;
	z-index: 2;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	max-width: 100%;
	max-height: 100%;
	margin: auto;
	cursor: zoom-out;
	image-orientation: from-image;
}
</style>