Skip to content

Commit

Permalink
chore(web): drops alignInputs, hideInputs
Browse files Browse the repository at this point in the history
  • Loading branch information
jahorton committed Sep 27, 2022
1 parent 2855922 commit e579530
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 89 deletions.
4 changes: 2 additions & 2 deletions web/source/kmwbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ namespace com.keyman {
getKeyboardPath(f, p?){return f;}
KC_(n, ln, Pelem){return '';}
handleRotationEvents(){}
// Will serve as an API function for a workaround, in case of future touch-alignment issues.
// Legacy API function for touch-alias issue workarounds
// Touch-aliases have been eliminated, though.
['alignInputs'](eleList?: HTMLElement[]){}
hideInputs() {};
namespaceID(Pstub) {};
preserveID(Pk) {};

Expand Down
8 changes: 0 additions & 8 deletions web/source/kmwembedded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,6 @@ namespace com.keyman.text {
*/
keymanweb.domManager._SetTargDir = function(Ptarg){};

/**
* Align input fields (should not be needed with KMEI, KMEA)
*
* @param {object} eleList A list of specific elements to align. If nil, selects all elements.
*
**/
keymanweb.alignInputs = function(eleList: HTMLElement[]) {};

/**
* Use rotation events to adjust OSK element positions and scaling if necessary
*/
Expand Down
20 changes: 0 additions & 20 deletions web/source/kmwnative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,6 @@ if(!window['keyman']['initialized']) {
return (rx.test(Lfilename) ? '' : keymanweb.options['keyboards']) + Lfilename;
}

/**
* Align input fields (should not be needed with KMEI, KMEA), making them visible if previously hidden.
*
* @param {object} eleList A list of specific elements to align. If nil, selects all elements.
*
**/
keymanweb.alignInputs = function(eleList: HTMLElement[]) {
// no-op
}

/**
* Programatically hides all input fields with underlying elements. Restore with .alignInputs.
*
* @param {boolean} align align and make visible, else hide
*
**/
keymanweb.hideInputs = function() {
// no-op.
}

/**
* Test if caret position is determined from the active element, or
* from the synthesized overlay element (touch devices)
Expand Down
2 changes: 0 additions & 2 deletions web/source/kmwrotation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ namespace com.keyman {
}

resolve() {
this.keyman.alignInputs();

var osk = this.keyman.osk;
osk.hideLanguageMenu();

Expand Down
3 changes: 0 additions & 3 deletions web/source/osk/oskView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,6 @@ namespace com.keyman.osk {
bs.height = 'auto';
bs.maxWidth = bs.maxHeight = '';
}

let keyman = com.keyman.singleton;
keyman.alignInputs();
}

public refreshLayoutIfNeeded(pending?: boolean) {
Expand Down
53 changes: 0 additions & 53 deletions web/source/osk/visualKeyboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1349,9 +1349,6 @@ namespace com.keyman.osk {
util.addFontFaceStyleSheet(kfd);
util.addFontFaceStyleSheet(ofd);

// Temporarily hide duplicated elements on non-desktop browsers
keymanweb.hideInputs();

// Build the style string and append (or replace) the font style sheet
// Note: Some browsers do not download the font-face font until it is applied,
// so must apply style before testing for font availability
Expand All @@ -1361,11 +1358,6 @@ namespace com.keyman.osk {
customStyle = customStyle + activeKeyboard.oskStyling;

this.styleSheet = util.addStyleSheet(customStyle); //Build 360

// Wait until font is loaded then align duplicated input elements with page elements
if (this.waitForFonts(kfd, ofd)) {
keymanweb.alignInputs();
}
}

/**
Expand Down Expand Up @@ -1718,51 +1710,6 @@ namespace com.keyman.osk {
}
};

/**
* Wait until font is loaded before applying stylesheet - test each 100 ms
* @param {Object} kfd main font descriptor
* @param {Object} ofd secondary font descriptor (OSK only)
* @return {boolean}
*/
waitForFonts(kfd, ofd) {
let keymanweb = com.keyman.singleton;
let util = keymanweb.util;

let fontDefined = !!(kfd && kfd['files']);
kfd = fontDefined ? kfd : undefined;

let oskFontDefined = !!(ofd && ofd['files']);
ofd = oskFontDefined ? ofd : undefined;

// Automatically 'ready' if the descriptor is explicitly `undefined`.
// Thus, also covers the case where both are undefined.
var kReady = util.checkFontDescriptor(kfd), oReady = util.checkFontDescriptor(ofd);
if (kReady && oReady) {
return true;
}

keymanweb.fontCheckTimer = window.setInterval(function () {
if (util.checkFontDescriptor(kfd) && util.checkFontDescriptor(ofd)) {
window.clearInterval(keymanweb.fontCheckTimer);
keymanweb.fontCheckTimer = null;
keymanweb.alignInputs();
}
}, 100);

// Align anyway as best as can if font appears to remain uninstalled after 5 seconds
window.setTimeout(function () {
if (keymanweb.fontCheckTimer) {
window.clearInterval(keymanweb.fontCheckTimer);
keymanweb.fontCheckTimer = null;
keymanweb.alignInputs();
// Don't notify - this is a management issue, not anything the user needs to deal with
// TODO: Consider having an icon in the OSK with a bubble that indicates missing font
//util.alert('Unable to download the font normally used with '+ks['KN']+'.');
}
}, 5000);
return false;
};

shutdown() {
let keyman = com.keyman.singleton;

Expand Down
1 change: 0 additions & 1 deletion web/testing/inline-osk/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
document.getElementById('KeymanWebControl').appendChild(newOSK.element);
keyman.osk = newOSK;
newOSK.activeKeyboard = keyman.core.activeKeyboard;
keyman.alignInputs();
document.getElementById('ta1').focus();
}

Expand Down

0 comments on commit e579530

Please sign in to comment.