From 22cd0e267523a08ccf2a2ba9809d1436280de124 Mon Sep 17 00:00:00 2001 From: Marc Durdin Date: Wed, 17 Nov 2021 07:32:49 +1100 Subject: [PATCH] chore: avoid error when running in unit tests --- web/source/osk/visualKeyboard.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/source/osk/visualKeyboard.ts b/web/source/osk/visualKeyboard.ts index 0cbc0bfcbc..ed9f5b7703 100644 --- a/web/source/osk/visualKeyboard.ts +++ b/web/source/osk/visualKeyboard.ts @@ -2578,9 +2578,9 @@ namespace com.keyman.osk { } let r = key.getClientRects()[0]; - let xLeft = r.left, - xWidth = r.width, - xHeight = r.height, + let xLeft = r ? r.left : dom.Utils.getAbsoluteX(key), + xWidth = r ? r.width : key.offsetWidth, + xHeight = r ? r.height : key.offsetHeight, previewFontScale = 1.8; // Canvas dimensions must be set explicitly to prevent clipping