From ffef7c2bd4fbb8b4e938b586e650223603a2c07c Mon Sep 17 00:00:00 2001 From: jahorton Date: Tue, 31 Aug 2021 08:25:16 +0700 Subject: [PATCH] chore(web): mild cleanup --- web/source/dom/domManager.ts | 22 ---------------------- web/source/osk/anchoredOskView.ts | 8 ++++++-- web/source/osk/oskView.ts | 28 +++++++++++----------------- 3 files changed, 17 insertions(+), 41 deletions(-) diff --git a/web/source/dom/domManager.ts b/web/source/dom/domManager.ts index 36852e9125..189d9941a0 100644 --- a/web/source/dom/domManager.ts +++ b/web/source/dom/domManager.ts @@ -1268,28 +1268,6 @@ namespace com.keyman.dom { // Do not unset the field if the UI is activated. osk.activeTarget = target; } - - // if(!Pelem) { - // if(osk && !isActivating) { - // osk._Hide(false); - // } - // } else { - // // Force display of OSK for touch input device, or if a CJK keyboard, to ensure visibility of pick list - // if(device.touchable) { - // osk.displayIfActive = true; - // osk._Show(); - // } else { - // // Conditionally show the OSK when control receives the focus - // if(this.keyman.isCJK()) { - // osk.displayIfActive = true; - // } - // if(osk.displayIfActive) { - // osk._Show(); - // } else { - // osk._Hide(false); - // } - // } - // } } } diff --git a/web/source/osk/anchoredOskView.ts b/web/source/osk/anchoredOskView.ts index 51c77b60b0..8ab123e086 100644 --- a/web/source/osk/anchoredOskView.ts +++ b/web/source/osk/anchoredOskView.ts @@ -32,6 +32,11 @@ namespace com.keyman.osk { super(modeledDevice); document.body.appendChild(this._Box); + + let keymanweb = com.keyman.singleton; + if(keymanweb.isEmbedded) { + this.activationMode == ActivationMode.manual; + } } /** @@ -241,8 +246,7 @@ namespace com.keyman.osk { // Once picklist functionality is separated out, this will no longer be needed. // Logic is: execute always if hidden on lost focus, but if requested by user, only if not CJK - if(keymanweb.isEmbedded) { - // We never hide the keyboard in embedded mode + if(this.activationMode != 'conditional' && this.displayIfActive) { return; } diff --git a/web/source/osk/oskView.ts b/web/source/osk/oskView.ts index 669bc8b956..90ef96a03c 100644 --- a/web/source/osk/oskView.ts +++ b/web/source/osk/oskView.ts @@ -18,8 +18,8 @@ namespace com.keyman.osk { }; export enum ActivationMode { - disabled = "disabled", - permanent = "permanent", + static = "static", // For use by documentation keyboards, eventually. + manual = "manual", conditional = "conditional" } @@ -77,6 +77,7 @@ namespace com.keyman.osk { // private _activationMode: ActivationMode = ActivationMode.conditional; private _displayIfActive: boolean = true; + private _manualShouldDisplay: boolean = true; private _currentlyBuffering: boolean = false; constructor(deviceSpec: com.keyman.utils.DeviceSpec, hostDevice?: com.keyman.utils.DeviceSpec) { @@ -201,10 +202,10 @@ namespace com.keyman.osk { get activationConditionsMet(): boolean { switch(this.activationMode) { - case 'permanent': + case 'manual': + return true; + case 'static': return true; - case 'disabled': - return false; case 'conditional': return !!this.activeTarget; default: @@ -225,6 +226,10 @@ namespace com.keyman.osk { } else if(this.hostDevice.touchable && !flag) { console.warn("Cannot hide display of OSK when hosted on touch-based devices."); flag = true; + } else if(this.activationMode == 'static') { + // Silently fail; it's a documentation keyboard. + // This is the primary difference between 'manual' and 'static'. + flag = true; } this._displayIfActive = flag; @@ -796,22 +801,11 @@ namespace com.keyman.osk { */ ['show'](bShow: boolean) { if(arguments.length > 0) { - this.displayIfActive=bShow; - // if(bShow) { - // this._Show(); - // } else { - // this._Hide(true); - // } + this.displayIfActive = bShow; } else { if(this.activationConditionsMet) { this.displayIfActive = !this.displayIfActive; } - - // // if(this._Visible) { - // this._Hide(true); - // // } else { - // this._Show(); - // // } } }