fix(web): niche-case handling - subkey from released modipress

This commit is contained in:
Joshua A. Horton 2023-10-27 14:58:44 +07:00
parent facafe3855
commit 0ae48cc64e
2 changed files with 16 additions and 1 deletions

View file

@ -35,6 +35,8 @@ export default class SubkeyPopup implements GestureHandler {
private source: GestureSequence<KeyElement>;
private readonly gestureParams: GestureParams;
readonly shouldLockLayer: boolean = false;
constructor(
source: GestureSequence<KeyElement, string>,
configChanger: ConfigChangeClosure<KeyElement>,
@ -46,6 +48,10 @@ export default class SubkeyPopup implements GestureHandler {
this.source = source;
this.gestureParams = gestureParams;
if(vkbd.layerLocked) {
this.shouldLockLayer = true;
}
source.on('complete', () => {
this.currentSelection?.key.highlight(false);
this.clear();

View file

@ -523,7 +523,16 @@ export default class VisualKeyboard extends EventEmitter<EventMap> implements Ke
}
// Once the best coord to use for fat-finger calculations has been determined:
keyResult = this.modelKeyClick(gestureStage.item, coord);
const shouldLockLayer = handlers && (handlers[0] instanceof SubkeyPopup) && handlers[0].shouldLockLayer;
try {
if(shouldLockLayer) {
this.lockLayer(true);
}
keyResult = this.modelKeyClick(gestureStage.item, coord);
} finally {
this.lockLayer(false);
}
}
// Outside of passing keys along... the handling of later stages is delegated