From 32b72048778bcc3638fb7d6796014f679364df48 Mon Sep 17 00:00:00 2001 From: Pavel Rybalko Date: Wed, 17 Nov 2021 12:10:13 +0700 Subject: [PATCH] fix #76 add default passphrase canvas width --- src/components/CanvasText.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/CanvasText.vue b/src/components/CanvasText.vue index 9e499ac..8ce1a37 100644 --- a/src/components/CanvasText.vue +++ b/src/components/CanvasText.vue @@ -19,8 +19,8 @@ export default Vue.extend({ context.clearRect(0, 0, canvasElement.width, canvasElement.height); context.fillStyle = "black"; context.font = "20px Arial"; - const textSize = context.measureText(binding.value); - canvasElement.setAttribute("width", textSize.width + 20 + "px"); + const textWidth = context.measureText(binding.value).width || 450; + canvasElement.setAttribute("width", textWidth + 20 + "px"); context.font = "20px Arial"; context.fillText(binding.value, 15, 20); }