From 3d2cb838d111ee61047599f49e76de80c821f341 Mon Sep 17 00:00:00 2001 From: Ramires Viana <59319979+ramiresviana@users.noreply.github.com> Date: Tue, 18 Aug 2020 13:08:58 +0000 Subject: [PATCH] feat: preview size button --- .../src/components/buttons/PreviewSize.vue | 22 +++++++++++++++++++ .../src/components/files/ExtendedImage.vue | 7 ++++++ frontend/src/components/files/Preview.vue | 16 +++++++++++--- frontend/src/utils/constants.js | 4 +++- http/static.go | 1 + 5 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 frontend/src/components/buttons/PreviewSize.vue diff --git a/frontend/src/components/buttons/PreviewSize.vue b/frontend/src/components/buttons/PreviewSize.vue new file mode 100644 index 00000000..3183b56f --- /dev/null +++ b/frontend/src/components/buttons/PreviewSize.vue @@ -0,0 +1,22 @@ + + + diff --git a/frontend/src/components/files/ExtendedImage.vue b/frontend/src/components/files/ExtendedImage.vue index aeb27981..4cfe247e 100644 --- a/frontend/src/components/files/ExtendedImage.vue +++ b/frontend/src/components/files/ExtendedImage.vue @@ -77,6 +77,13 @@ export default { window.removeEventListener('resize', this.onResize) document.removeEventListener('mouseup', this.onMouseUp) }, + watch: { + src: function () { + this.scale = 1 + this.setZoom() + this.setCenter() + } + }, methods: { onLoad() { let img = this.$refs.imgex diff --git a/frontend/src/components/files/Preview.vue b/frontend/src/components/files/Preview.vue index 519e259a..7a2ded1b 100644 --- a/frontend/src/components/files/Preview.vue +++ b/frontend/src/components/files/Preview.vue @@ -9,6 +9,7 @@ {{ this.name }} + @@ -65,8 +66,9 @@