From 7b6ad0c4755b19509f977345f0d98f30d7b5148a Mon Sep 17 00:00:00 2001 From: MarcZierle Date: Fri, 21 Jan 2022 22:16:52 +0100 Subject: [PATCH] add timeout for refreshing loading spinner --- src/views/CameraCapture.vue | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/views/CameraCapture.vue b/src/views/CameraCapture.vue index 1ad0711..0ca0462 100644 --- a/src/views/CameraCapture.vue +++ b/src/views/CameraCapture.vue @@ -213,21 +213,23 @@ export default { takePhoto() { this.isPhotoTaken = true - this.photo.height = document.getElementById('camera_preview').offsetHeight + setTimeout(() => { + this.photo.height = document.getElementById('camera_preview').offsetHeight - this.$refs.canvas.width = this.stream.width - this.$refs.canvas.height = this.stream.height + this.$refs.canvas.width = this.stream.width + this.$refs.canvas.height = this.stream.height - const context = this.$refs.canvas.getContext('2d') - context.drawImage( - this.$refs.camera, - 0, 0, - this.stream.width, - this.stream.height) + const context = this.$refs.canvas.getContext('2d') + context.drawImage( + this.$refs.camera, + 0, 0, + this.stream.width, + this.stream.height) - this.photo.src = this.$refs.canvas.toDataURL('image/png')//.replace('image/png', 'image/octet-stream') - - this.showPhotoTakenModal = true + this.photo.src = this.$refs.canvas.toDataURL('image/png')//.replace('image/png', 'image/octet-stream') + + this.showPhotoTakenModal = true + }, 50) }, uploadPhoto() { this.isUploading = true