mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-27 10:07:40 +00:00
Merge pull request #3718 from keymanapp/fix/web/remove-basekey-from-popup
fix(web): Remove base key from popup keys
This commit is contained in:
commit
f746ec61de
2 changed files with 5 additions and 46 deletions
|
|
@ -40,7 +40,7 @@ namespace com.keyman.osk {
|
|||
}
|
||||
};
|
||||
|
||||
// iOS now relies upon native-mode popup key management, so we only implement these hybrid-targetted
|
||||
// iOS now relies upon native-mode popup key management, so we only implement these hybrid-targeted
|
||||
// methods when embedding in Android.
|
||||
let device = com.keyman.singleton.util.device;
|
||||
|
||||
|
|
@ -56,10 +56,8 @@ namespace com.keyman.osk {
|
|||
if(key['subKeys'] && (typeof(window['oskCreatePopup']) == 'function')) {
|
||||
var xBase = dom.Utils.getAbsoluteX(key) - dom.Utils.getAbsoluteX(this.kbdDiv) + key.offsetWidth/2,
|
||||
yBase = dom.Utils.getAbsoluteY(key);
|
||||
|
||||
if(util.device.formFactor == 'phone') {
|
||||
this.prependBaseKey(key);
|
||||
}
|
||||
|
||||
// #3718: No longer prepend base key to subkey array
|
||||
|
||||
this.popupBaseKey = key;
|
||||
this.popupPending=true;
|
||||
|
|
|
|||
|
|
@ -1509,10 +1509,7 @@ namespace com.keyman.osk {
|
|||
subKeys.id='kmw-popup-keys';
|
||||
this.popupBaseKey = e;
|
||||
|
||||
// Does the popup array include the base key? *** condition for phone only ***
|
||||
if(device.formFactor == 'phone') {
|
||||
this.prependBaseKey(e);
|
||||
}
|
||||
// #3718: No longer prepend base key to popup array
|
||||
|
||||
// Must set position dynamically, not in CSS
|
||||
var ss=subKeys.style;
|
||||
|
|
@ -1599,43 +1596,7 @@ namespace com.keyman.osk {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepend the base key to the touch-hold key array (for phones)
|
||||
*
|
||||
* @param {Object} e base key object
|
||||
*/
|
||||
prependBaseKey(e: KeyElement) {
|
||||
// This is a tag we set on the key element during its construction.
|
||||
let subKeys: OSKKeySpec[] = e['subKeys'];
|
||||
let keyman = com.keyman.singleton;
|
||||
|
||||
if(e && typeof(e.id) != 'undefined') {
|
||||
//TODO: refactor this, it's pretty messy...
|
||||
var i,
|
||||
idx = e.id.split('-'),
|
||||
baseId = e['keyId'],
|
||||
layer = e['key'].spec['layer'],
|
||||
sp = e['key'].spec['sp'],
|
||||
nextlayer = e['key'].spec['nextlayer'];
|
||||
|
||||
if(typeof subKeys != 'undefined' && subKeys.length > 0 && (subKeys[0].id != baseId || subKeys[0].layer != layer)) {
|
||||
var eCopy = new OSKKeySpec(baseId, '', undefined, sp, nextlayer); // {'id':baseId,'layer':'','key':undefined};
|
||||
if(layer != '') {
|
||||
eCopy['layer'] = layer;
|
||||
}
|
||||
|
||||
for(i = 0; i < e.childNodes.length; i++) {
|
||||
if(keyman.util.hasClass(<HTMLElement> e.childNodes[i], 'kmw-key-text')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(i < e.childNodes.length) {
|
||||
eCopy['text'] = e.childNodes[i].textContent;
|
||||
}
|
||||
subKeys.splice(0, 0, eCopy);
|
||||
}
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
/**
|
||||
|
|
@ -2605,4 +2566,4 @@ namespace com.keyman.osk {
|
|||
return false;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue