chore: avoid error when running in unit tests

This commit is contained in:
Marc Durdin 2021-11-17 07:32:49 +11:00
parent 09a7e19913
commit 22cd0e2675

View file

@ -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