mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-28 18:47:41 +00:00
Merge pull request #12240 from keymanapp/fix/web/cherry-pick/doc-keyboard-spacebar-scaling
fix(web): fix documentation-keyboard spacebar-text scaling 🍒 🏠
This commit is contained in:
commit
0726c50587
1 changed files with 15 additions and 3 deletions
|
|
@ -1260,6 +1260,7 @@ export default class VisualKeyboard extends EventEmitter<EventMap> implements Ke
|
|||
const groupStyle = getComputedStyle(this.layerGroup.element);
|
||||
|
||||
const isInDOM = computedStyle.height != '' && computedStyle.height != 'auto';
|
||||
const isGroupInDOM = groupStyle.height != '' && groupStyle.height != 'auto';
|
||||
|
||||
if (computedStyle.border) {
|
||||
this._borderWidth = new ParsedLengthStyle(computedStyle.borderWidth).val;
|
||||
|
|
@ -1272,10 +1273,11 @@ export default class VisualKeyboard extends EventEmitter<EventMap> implements Ke
|
|||
this._computedHeight = this.height;
|
||||
} else if (isInDOM) {
|
||||
this._computedWidth = parseInt(computedStyle.width, 10);
|
||||
if (!this._computedWidth) {
|
||||
this._computedWidth = parseInt(groupStyle.width, 10);
|
||||
}
|
||||
this._computedHeight = parseInt(computedStyle.height, 10);
|
||||
} else if (isGroupInDOM) {
|
||||
// May occur for documentation-keyboards, which are detached from their VisualKeyboard base.
|
||||
this._computedWidth = parseInt(groupStyle.width, 10);
|
||||
this._computedHeight = parseInt(groupStyle.height, 10);
|
||||
} else {
|
||||
// Cannot perform layout operations!
|
||||
return;
|
||||
|
|
@ -1612,6 +1614,16 @@ export default class VisualKeyboard extends EventEmitter<EventMap> implements Ke
|
|||
// the page.
|
||||
kbdObj.appendStyleSheet();
|
||||
|
||||
// Unset the width + height we used thus far; this method's consumer may choose to rescale
|
||||
// the returned element. If so, we don't want to use our outdated value by mistake.
|
||||
//
|
||||
// While `kbdObj.setSize()` could be used in theory, it _also_ unsets the element styling.
|
||||
// We actually wish to _leave_ this styling in place - one of our parameters is `height`, and
|
||||
// it should remain in place in the styling on the output element as the default in case
|
||||
// the consumer _doesn't_ add styling afterward.
|
||||
delete kbdObj._width;
|
||||
delete kbdObj._height;
|
||||
|
||||
return classWrapper;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue