From bf6eed4ea2af549dae31afae26acf61fd86a4ae4 Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Thu, 30 Apr 2026 14:42:22 +0300 Subject: [PATCH] fix canvas error --- app/javascript/draw.js | 2 +- app/javascript/elements/signature_form.js | 2 +- app/javascript/submission_form/signature_step.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/javascript/draw.js b/app/javascript/draw.js index 3b95b5ea..764c527c 100644 --- a/app/javascript/draw.js +++ b/app/javascript/draw.js @@ -89,7 +89,7 @@ window.customElements.define('draw-signature', class extends HTMLElement { } redrawCanvas (oldWidth, oldHeight) { - if (this.pad && !this.pad.isEmpty() && oldWidth > 0 && oldHeight > 0) { + if (this.pad && !this.pad.isEmpty() && oldWidth > 0 && oldHeight > 0 && this.canvas.width > 0 && this.canvas.height > 0) { const sx = this.canvas.width / oldWidth const sy = this.canvas.height / oldHeight diff --git a/app/javascript/elements/signature_form.js b/app/javascript/elements/signature_form.js index 5fc9af48..47d6f111 100644 --- a/app/javascript/elements/signature_form.js +++ b/app/javascript/elements/signature_form.js @@ -80,7 +80,7 @@ export default targetable(class extends HTMLElement { } redrawCanvas (oldWidth, oldHeight) { - if (this.pad && !this.pad.isEmpty() && oldWidth > 0 && oldHeight > 0) { + if (this.pad && !this.pad.isEmpty() && oldWidth > 0 && oldHeight > 0 && this.canvas.width > 0 && this.canvas.height > 0) { const sx = this.canvas.width / oldWidth const sy = this.canvas.height / oldHeight diff --git a/app/javascript/submission_form/signature_step.vue b/app/javascript/submission_form/signature_step.vue index c1f19be9..2f3ee83f 100644 --- a/app/javascript/submission_form/signature_step.vue +++ b/app/javascript/submission_form/signature_step.vue @@ -586,7 +586,7 @@ export default { redrawCanvas (oldWidth, oldHeight) { const canvas = this.$refs.canvas - if (this.pad && !this.isTextSignature && !this.pad.isEmpty() && oldWidth > 0 && oldHeight > 0) { + if (this.pad && !this.isTextSignature && !this.pad.isEmpty() && oldWidth > 0 && oldHeight > 0 && canvas.width > 0 && canvas.height > 0) { const sx = canvas.width / oldWidth const sy = canvas.height / oldHeight