mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-10 10:55:33 +00:00
fix(web): publish restorePosition() function
This makes the `osk.restorePosition()` function public and makes it work even if the OSK is not presently visible. Also DRY out the repeated implementation.
This commit is contained in:
parent
ec9a68cd24
commit
ffdf71f6ed
1 changed files with 17 additions and 21 deletions
|
|
@ -354,6 +354,7 @@ namespace com.keyman.osk {
|
|||
* Create a control bar with title and buttons for the desktop OSK
|
||||
*/
|
||||
controlBar(): HTMLDivElement {
|
||||
// TODO: merge with _TitleBarInterior?
|
||||
let keymanweb = com.keyman.singleton;
|
||||
let util = keymanweb.util;
|
||||
|
||||
|
|
@ -413,20 +414,7 @@ namespace com.keyman.osk {
|
|||
Limg.id='kmw-pin-image';
|
||||
Limg.className='kmw-title-bar-image';
|
||||
Limg.title='Pin the On Screen Keyboard to its default location on the active text box';
|
||||
Limg.onclick=function(this: OSKManager) {
|
||||
this.loadCookie();
|
||||
this.userPositioned=false;
|
||||
this.saveCookie();
|
||||
this._Show();
|
||||
this.doResizeMove(); //allow the UI to respond to OSK movements
|
||||
if(this.pinImg) {
|
||||
this.pinImg.style.display='none';
|
||||
}
|
||||
if(window.event) {
|
||||
window.event.returnValue=false;
|
||||
}
|
||||
return false;
|
||||
}.bind(this);
|
||||
Limg.onclick=this.restorePosition;
|
||||
Limg.onmousedown=util._CancelMouse;
|
||||
bar.appendChild(Limg);
|
||||
|
||||
|
|
@ -482,17 +470,25 @@ namespace com.keyman.osk {
|
|||
}
|
||||
|
||||
/**
|
||||
* Move OSK back to default position
|
||||
* Function restorePosition
|
||||
* Scope Public
|
||||
* Description Move OSK back to default position, floating under active input element
|
||||
*/
|
||||
restorePosition: () => void = function(this: OSKManager) {
|
||||
if(this._Visible) {
|
||||
let isVisible = this._Visible;
|
||||
if(isVisible) {
|
||||
com.keyman.singleton.domManager.focusLastActiveElement(); // I2036 - OSK does not unpin to correct location
|
||||
this.loadCookie();
|
||||
this.userPositioned=false;
|
||||
this.saveCookie();
|
||||
this._Show();
|
||||
this.doResizeMove(); //allow the UI to respond to OSK movements
|
||||
}
|
||||
|
||||
this.loadCookie();
|
||||
this.userPositioned=false;
|
||||
this.saveCookie();
|
||||
|
||||
if(isVisible) {
|
||||
this._Show();
|
||||
}
|
||||
|
||||
this.doResizeMove(); //allow the UI to respond to OSK movements
|
||||
if(this.pinImg) {
|
||||
this.pinImg.style.display='none';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue