Commit graph

68 commits

Author SHA1 Message Date
Marc Durdin
da5d00c284 fix(web): Non-integer OSK sizes
If the OSK had a non-integer width or height stored in the OSK cookie,
then the width and height would be parsed incorrectly and the OSK would
fail to be sized correctly on first load; this also caused a script
error and made the OSK impossible to interact with.
2022-02-12 19:06:12 +07:00
Marc Durdin
0c0bb420b5
Merge pull request #5963 from keymanapp/feat/web/3621-newcontext-group
feat(web): Start of Sentence support - part 1 🕊
2022-01-17 12:04:29 +11:00
Marc Durdin
3f35cc0bf8 chore(web): Merge branch 'master' into feat/web/3621-newcontext-group 2021-11-29 10:22:22 +11:00
Marc Durdin
e98930dedb
Merge branch 'master' into fix/web/5779-font-scaling-in-osk 2021-11-29 09:12:15 +11:00
Marc Durdin
45821fcb1b fix(web): adjust tablet font scaling
This makes two corrections:

1. Removed an obsolete test for screen size based on dpi, which is
   unreliable, meant that we had been treating many Android tablets as
   phones (domManager.ts).
2. Font scale for Android tablets had some incorrect assumptions around
   keyboard height and devicePixelRatio, which I was able to simplify
   into a fixed ratio, and was much better across all devices I
   tested (however, all emulated in Chrome).
2021-11-29 08:56:41 +11:00
Marc Durdin
8bc61094c8
Merge pull request #5958 from keymanapp/fix/web/improve-keyboard-switch-performance
fix(web): improve keyboard switch performance
2021-11-29 06:34:55 +11:00
Marc Durdin
bbbf1afce7 feat(web): basic support for newContext
Relates to #3621.

Adds basic support for `begin newContext`.
2021-11-23 15:00:47 +11:00
Marc Durdin
909d833474 fix(web): improve keyboard switch performance
Summary of these changes:

Two targeted improvements; more optimization is possible but IMO this is
a significant enough improvement to go through test:

1. In oskView.ts, avoid calling `VisualKeyboard.refreshLayout` twice
   from `OSKView.refreshLayout`. This roughly halves the time spent in
   `VisualKeyboard.refreshLayout` for a keyboard switch.
2. In modelManager.ts, we avoid a very expensive `unloadModel` /
   `loadModel` sequence from `registerModel` by checking to see if the
   model spec we are passed is already registered. This avoids an
   expensive callback to Keyman for Android which causes the banner to
   'bounce'.

Longer notes:

So `VisualKeyboard.refreshLayout` is called 20+ times during a keyboard
switch. It is a very expensive call. It is the bulk of the time spent
when you press the globe key in Keyman for Android. This seems ripe for
optimization; see the following functions in keyboard.html:

* `setKeymanLanguage` -> `setActiveKeyboard` -> 6 calls
* `enableSuggestions` -> `registerModel` -> 8 calls
* `stateChange` -> 6+ calls

`OSKView.refreshLayout` always seems to call
`VisualKeyboard.refreshLayout` twice: first with `setSize`, and then
again itself.

Keyman for Android and KeymanWeb seem to fight over who is responsible
for selecting models (KMW first calls `loadModel`, then Keyman for
Android calls `unloadModel`, `loadModel`, through `enableSuggestions`).

The fix for rotation (`correctOSKTextSize()`), as called from
`stateChange()`, is expensive as well, because it rebuilds the entire
keyboard from scratch.

Along with that, we have the size of the webview changing as the model
is unloaded and reloaded and lots of back-and-forth between the
KeymanWeb and KMEA which seems unnecessary.

Shouldn't KeymanWeb be responsible for loading and unloading models,
once they are all registered? We should only need to register the models
once at page load time (when config changes, do we just reload the
page?).
2021-11-22 10:47:05 +11:00
Marc Durdin
3b948a5254 fix(web): simplify hide transition
Fixes #5907.

The state machine for the Hide transition for the OSK was very complex,
and had some peculiarities which caused it to sometimes fail to
correctly hide. Once I simplified the state machine, it seems that those
edge cases have gone away, and the keyboard always hides correctly.

There is an unrelated issue with focus timeout which can be confusing
when testing this; see #5909.
2021-11-15 16:09:14 +11:00
Marc Durdin
9da4ffa77a fix(web): font size was not consistently set
Fixes #5779.
Fixes #5731 (I believe mitigation is sufficient to close this issue).

A variety of interrelated font and font size display issues resolved:
1. KVK font was not applied early enough for size calculations, which
   meant that we were calculating font scaling per key based on a
   default font when transforming from the KVK data for desktop devices
   (defaultLayout.ts)
2. Font scaling for non-default layers was calculated when elements were
   not visible and had no size information, giving incorrect values. To
   resolve this, font scaling is now calculated when a layer is made
   visible, which had performance impacts; resolved by reducing
   unnecessary `layer.refreshLayout()` calls; see performance point 1
   below (oskView.ts:layerChangeHandler())
3. `getViewportScale()` would return an incorrect scaled value when
   emulating touch devices on a desktop browser (kmwutils.ts)
4. After switching keyboards, the device-specific scaling factor was not
   maintained (oskView.ts:refreshLayout())

Related performance improvements:
1. Multiple calls to `layer.refreshLayout()` in `refreshLayout()` have
   been eliminated, and only the currently visible layer is now
   refreshed. This dramatically reduces the number of calls to
   `getIdealFontSize()` which was the primary concern of #5731.
   (visualKeyboards.ts)
2. Unnecessary use of `innerHTML` replaced with `innerText`
   (oskBaseKey.ts)

Minor Keyman Developer performance improvement:
1. The web debugger no longer recalculates the OSK twice (test.js)
2021-11-15 10:08:18 +11:00
jahorton
f53df318dc feat(web): functional banner mouse interactions 2021-09-22 12:37:33 +07:00
jahorton
595984c813 fix(web): desktop sil_euro_latin patchup 2021-09-22 09:20:09 +07:00
jahorton
202377e79b fix(web): should not use _Box.style.maxWidth 2021-09-22 08:52:19 +07:00
jahorton
354e852130 feat(web): inlined OSK - target device hotswap 2021-09-21 14:04:10 +07:00
jahorton
c7ba56c23a feat(web): input alignment on layout refresh 2021-09-21 13:44:29 +07:00
jahorton
0640b60e3e chore(web): Merge branch 'refactor/web/osk-activation-and-visibility' into feat/web/inlined-osk 2021-09-21 12:51:29 +07:00
jahorton
ebd673fdb2 fix(web): osk dismissal after focus timer 2021-09-21 12:19:11 +07:00
jahorton
f7dc8e1140 chore(web): Merge branch 'refactor/web/osk-activation-and-visibility' into feat/web/inlined-osk 2021-09-17 15:26:03 +07:00
jahorton
3f48ae7e99 fix(web): more polish, fixes pinned position management 2021-09-17 15:15:53 +07:00
jahorton
09de360789 fix(web): missed bits of last commit, adds some polish 2021-09-17 15:02:43 +07:00
jahorton
8826bec8fe fix(web): incorporates some review suggestions 2021-09-17 14:58:18 +07:00
jahorton
ffc381fcb6 chore(web): Merge branch 'refactor/web/active-element-integrations' into refactor/web/osk-activation-and-visibility 2021-09-17 08:38:49 +07:00
jahorton
f95f732297 chore(web): Merge branch 'refactor/web/specialized-osk-views' into refactor/web/active-element-integrations 2021-09-16 14:52:45 +07:00
jahorton
e2c2084380 chore(web): adds default value for optional chain 2021-09-14 13:10:52 +07:00
jahorton
11ee389a24 chore(web): copyright tweak 2021-09-14 13:08:46 +07:00
jahorton
0eef0cb580 chore(web): Merge branch 'refactor/web/osk-activation-and-visibility' into feat/web/inlined-osk 2021-09-03 15:09:36 +07:00
jahorton
881a2759f2 chore(web): Merge branch 'refactor/web/active-element-integrations' into refactor/web/osk-activation-and-visibility 2021-09-03 12:45:51 +07:00
jahorton
68425763c6 fix(web): fixes touch-mode focusing issue in unit tests 2021-09-03 12:42:34 +07:00
jahorton
49e0f2fc68 fix(web): partial fix for %-scaled OSK dimensions 2021-09-02 13:30:26 +07:00
jahorton
6cc94649d7 fix(web): propagation-prevention listener setup 2021-09-02 09:03:08 +07:00
jahorton
330b55245f fix(web): gesture hang with desktop host device, glitchy width 2021-09-02 08:45:19 +07:00
jahorton
6b248075d6 feat(web): partially-functional inlined OSK! 2021-09-01 15:31:01 +07:00
jahorton
b420987ff2 fix(web): issues from adjustments in parent branches 2021-09-01 12:10:10 +07:00
jahorton
127197db95 feat(web): starts InlinedOSKView 2021-09-01 11:49:23 +07:00
jahorton
825cdd5507 chore(web): Merge branch 'refactor/web/active-element-integrations' into refactor/web/osk-activation-and-visibility 2021-09-01 11:49:06 +07:00
jahorton
79acb98b66 chore(web): Merge branch 'refactor/web/specialized-osk-views' into refactor/web/active-element-integrations 2021-09-01 11:48:47 +07:00
jahorton
e0694d4258 refactor(web): setBoxStyling 2021-09-01 11:48:26 +07:00
jahorton
32d650ee41 fix(web): osk font size init 2021-09-01 10:59:06 +07:00
jahorton
fb5a751e07 chore(web): Merge branch 'refactor/web/specialized-osk-views' into refactor/web/osk-activation-and-visibility 2021-09-01 10:30:07 +07:00
jahorton
12f3b6b43f chore(web): Merge branch 'refactor/web/specialized-osk-views' into refactor/web/active-element-integrations 2021-09-01 10:29:14 +07:00
jahorton
d9a51b7ab0 fix(web): layout bug from prior commits; did not show before b/c Chrome caching 2021-09-01 10:17:54 +07:00
jahorton
863674f475 docs(web): documents the new presentation & activation modeling props / methods 2021-09-01 09:44:36 +07:00
jahorton
707a7ec745 refactor(web): nixes refit() method 2021-09-01 09:44:36 +07:00
jahorton
e8afd71491 refactor(web): _Show -> present(), presentAtPosition() 2021-09-01 09:44:34 +07:00
jahorton
f070df079d refactor(web): osk._Hide -> osk.startHide 2021-09-01 09:44:34 +07:00
jahorton
7547c93019 refactor(web): _Show modularization 2021-09-01 09:44:33 +07:00
jahorton
ef90da4659 chore(web): minor cleanup 2021-09-01 09:44:32 +07:00
jahorton
09790c1134 refactor(web): separates hide() functionality into clearer components 2021-09-01 09:44:31 +07:00
jahorton
ffef7c2bd4 chore(web): mild cleanup 2021-09-01 09:44:31 +07:00
jahorton
fe797fe657 refactor(web): osk now controls own display state 2021-09-01 09:44:30 +07:00