From 452044c6a991d7acd83c69fb47696380ef90528b Mon Sep 17 00:00:00 2001 From: MattApril Date: Thu, 27 Sep 2018 10:21:59 -0400 Subject: [PATCH 1/3] Attempt to fix 0 height bug --- PictureInput.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PictureInput.vue b/PictureInput.vue index 41267c1..eb0c509 100644 --- a/PictureInput.vue +++ b/PictureInput.vue @@ -227,9 +227,7 @@ export default { this.$emit('click') }, onResize () { - this.resizeCanvas() - - if (this.imageObject) { + if (this.resizeCanvas() && this.imageObject) { this.drawImage(this.imageObject) } }, @@ -410,13 +408,15 @@ export default { }, resizeCanvas () { let previewRatio = this.canvasWidth / this.canvasHeight - let newWidth = this.$refs.container.clientWidth + let newWidth = this.$refs.container.clientWidthl + if( !newWidth ) return false; if (!this.toggleAspectRatio && newWidth === this.containerWidth) { - return + return false; } this.containerWidth = newWidth this.previewWidth = Math.min(this.containerWidth - this.margin * 2, this.canvasWidth) this.previewHeight = this.previewWidth / previewRatio + return true; }, getOrientation (width, height) { let orientation = 'square' From b594bf64bc9742a89a912fb8c72401be2083f583 Mon Sep 17 00:00:00 2001 From: MattApril Date: Thu, 27 Sep 2018 10:49:50 -0400 Subject: [PATCH 2/3] Second attempt at providing some brute fix to 0 height issue --- PictureInput.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PictureInput.vue b/PictureInput.vue index eb0c509..314b03a 100644 --- a/PictureInput.vue +++ b/PictureInput.vue @@ -199,6 +199,10 @@ export default { this.canvasWidth = this.width this.canvasHeight = this.height + if( this.width != Number.MAX_SAFE_INTEGER && this.height != Number.MAX_SAFE_INTEGER ) { + this.previewWidth = this.width + this.previewHeight = this.height + } this.$on('error', this.onError) }, From b6237494f9464a5682d5ab51881ae2e08ac372c8 Mon Sep 17 00:00:00 2001 From: Alessio Maffeis Date: Tue, 3 May 2022 17:57:49 +0200 Subject: [PATCH 3/3] Fix typo --- PictureInput.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PictureInput.vue b/PictureInput.vue index 314b03a..9044b4e 100644 --- a/PictureInput.vue +++ b/PictureInput.vue @@ -412,7 +412,7 @@ export default { }, resizeCanvas () { let previewRatio = this.canvasWidth / this.canvasHeight - let newWidth = this.$refs.container.clientWidthl + let newWidth = this.$refs.container.clientWidth if( !newWidth ) return false; if (!this.toggleAspectRatio && newWidth === this.containerWidth) { return false;