change(web): adds a bit of dynamic resizing to help bubble

This commit is contained in:
Joshua A. Horton 2022-11-15 14:42:39 +07:00
parent 6e3a7baeac
commit 87fc6921af

View file

@ -83,7 +83,14 @@ namespace com.keyman.osk.embedded {
// Width dimensions must be set explicitly to prevent clipping.
// We'll assume that the globe key is always positioned on the bottom row.
let bubbleWidth = xWidth + Math.ceil(xWidth * 1) * 2;
let oskBaseFontSize = new ParsedLengthStyle(keyman.osk.baseFontSize);
let bubbleWidth = Math.ceil(xWidth * 3);
// The base OSK font-size is typically set in 'em', and we want to scale up
// the bubble accordingly for devices where it'd display too small otherwise.
if(!oskBaseFontSize.absolute) {
bubbleWidth *= oskBaseFontSize.val;
}
bubbleStyle.bottom = Math.floor(keyman.osk.computedHeight - y) + 'px';
// CSS already defines transform: translateX(-50%) - this centers the element.
@ -112,6 +119,10 @@ namespace com.keyman.osk.embedded {
this.tip.style.transform = 'translateX(-' + (xOverflow - rightEdgeMargin + 1) + 'px)';
}
if(!oskBaseFontSize.absolute) {
this.element.style.fontSize = keyman.osk.baseFontSize;
}
let capHeight = xHeight / 3;
this.cap.style.bottom = (rrow.height - capHeight) + 'px';