mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-28 19:27:44 +00:00
Merge pull request #5958 from keymanapp/fix/web/improve-keyboard-switch-performance
fix(web): improve keyboard switch performance
This commit is contained in:
commit
8bc61094c8
3 changed files with 8 additions and 7 deletions
|
|
@ -118,8 +118,7 @@
|
|||
//window.console.log('onStateChange change: ' + change);
|
||||
|
||||
// Refresh KMW OSK
|
||||
var kmw=window['keyman'];
|
||||
kmw['correctOSKTextSize']();
|
||||
keyman.correctOSKTextSize();
|
||||
|
||||
fragmentToggle = (fragmentToggle + 1) % 100;
|
||||
if(change != 'configured') { // doesn't change the display; only initiates suggestions.
|
||||
|
|
|
|||
|
|
@ -508,9 +508,6 @@ namespace com.keyman.osk {
|
|||
availableHeight -= this.bannerView.height + 5;
|
||||
}
|
||||
this.vkbd.setSize(this.computedWidth, availableHeight, pending);
|
||||
if(!pending) {
|
||||
this.vkbd.refreshLayout();
|
||||
}
|
||||
|
||||
const bs = this._Box.style;
|
||||
// OSK size settings can only be reliably applied to standard VisualKeyboard
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ namespace com.keyman.text.prediction {
|
|||
|
||||
// Allows for easy model lookup by language code; useful when switching keyboards.
|
||||
languageModelMap: {[language:string]: ModelSpec} = {};
|
||||
|
||||
|
||||
init() {
|
||||
let keyman = com.keyman.singleton;
|
||||
|
||||
|
||||
// Registers this module for keyboard (language) and model change events.
|
||||
keyman['addEventListener']('keyboardchange', this.onKeyboardChange.bind(this));
|
||||
}
|
||||
|
|
@ -46,6 +46,11 @@ namespace com.keyman.text.prediction {
|
|||
let keyman = com.keyman.singleton;
|
||||
let activeLanguage = keyman.keyboardManager.getActiveLanguage();
|
||||
|
||||
if(JSON.stringify(model) == JSON.stringify(this.registeredModels[model.id])) {
|
||||
// We are already registered, let's not go through and re-register
|
||||
// because we'll already have the correct model active
|
||||
return;
|
||||
}
|
||||
this.registeredModels[model.id] = model;
|
||||
|
||||
// Register the model for each targeted language code variant.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue