Commit graph

338 commits

Author SHA1 Message Date
Darcy Wong
19f1d4f5a7 chore(android): Merge remote-tracking branch 'origin/beta' into fix/android/subkey-move 2022-03-23 13:05:25 +07:00
Darcy Wong
70ec9b7096 fix(web): Don't update base key if popups displayed 2022-03-17 10:58:48 +07:00
Marc Durdin
ada527bd80 fix(web): bounding rect offset was incorrect
When embedding the On Screen Keyboard into a page, the calculation for
the bounding rectangle only took into account the first offsetParent,
which meant it would get the offset incorrect when there were multiple
layers of offsetParents.

Once I changed to using getAbsoluteX / getAbsoluteY, this also corrects
for scroll with window.pageOffsetY, so we can eliminate that special
case for fixed positioning.

This was observable in the Web Developer test window, where interaction
with the bottom row of the keyboard in touch mode was not working
correctly, in 15.0.210-beta.
2022-03-11 04:34:36 +11:00
Marc Durdin
44ddf1e9aa
Merge branch 'master' into feat/web/3620-caps-layer 2022-01-17 12:26:32 +11:00
Marc Durdin
5fbb1c1dfb chore(web): minor cleanup of pending longpress 2021-12-01 09:27:25 +11:00
Marc Durdin
62796e3489 feat(web): Caps Layer and double-tap gesture
Fixes #3620.

Implements the Caps Lock layer support and the double-tap gesture on the
shift key to access it.

The double-tap gesture has been implemented with a view to extension to
support other multi-tap gestures in the future. However, for now, it is
limited to supporting the Shift key, if and only if the keyboard
includes a Caps layer.

The reason for this v15 limitation is that multi-tap on regular keys
would involve either rewinding the previous keystroke (the first tap),
or forcing keyboard developers to consider 'rota' style rules in their
keyboards to support the multi-tap gestures, as we need to make sure
that the first tap is accepted and processed for immediate feedback.
This needs more design, to avoid unnecessary complexity in the keyboards
and/or the rewinding of the keystroke (even though that is conceptually
supported in Keyman Engine for Web already). Basically, we don't want to
constrain the way that a keyboard author may use the multi-tap gesture
by hard-coding the rewind, but neither do we want to make all multi-tap
gestures needlessly complex to author.

The shift key (and other modifiers, potentially in future) needs special
support for multi-tap as the key that is being tapped changes with the
layer change. This is currently managed through recognising `K_SHIFT` in
the key id.

I have tried to follow the `PendingGesture` pattern for multi-tap, and
the gesture itself supports a series of taps, not just a double-tap. The
maximum time to complete the tap series is 125msec * number-of-taps, so
for a double-tap is 250msec.

The changes to support a Caps Lock layer itself were minimal; just
adding the `text.KeyboardProcessor.getStateFromLayer` function and
calling it during `KeyEvent` construction. The remaining changes relate
to the multi-tap gesture.

Minor changes:
* I moved `constructNullKeyEvent` to `KeyEvent` in order to make it
  more accessible to other classes.
* The multi-tap gesture does not have a promise to complete, so that is
  now an optional member of the `PendingGesture` interface.
2021-12-01 08:59:43 +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
10a41c43cc fix(web): clear longpress timeout if user does a flick up
Fixes #5950.

If a user starts a longpress gesture and then flicks up, that
immediately brings up the longpress menu, and the timeout for display of
the menu should be cancelled -- otherwise the end result is a key that
stays 'stuck' on.
2021-11-19 15:43:27 +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
Marc Durdin
0cf4a3c512
Merge pull request #5723 from keymanapp/feat/developer/touch-layout-testing
feat(developer): touch layout testing 🎩
2021-10-05 17:40:26 +11:00
Joshua Horton
c008d16654
Merge pull request #5739 from keymanapp/feat/web/mouse-based-banner
feat(web): enables mouse interactivity for the predictive banner 🧵
2021-09-23 10:57:13 +07:00
jahorton
31ac1b7c1b chore(web): replaces literals with constants 2021-09-23 09:27:09 +07:00
jahorton
e87a277be8 refactor(web): first pass generalization for inputEventEngine 2021-09-22 12:37:31 +07:00
Darcy Wong
6240d305b4 fix(web): Check keyboard before marking layout calibrated 2021-09-22 11:02:53 +10:00
jahorton
48fe02023c fix(web): fixes unit test issue (event's 'buttons' property) 2021-09-20 14:39:27 +07:00
jahorton
49e0f2fc68 fix(web): partial fix for %-scaled OSK dimensions 2021-09-02 13:30:26 +07:00
jahorton
632642b6c2 feat(web): functional touch-subkeys on desktop 2021-09-02 12:30:37 +07:00
jahorton
6b248075d6 feat(web): partially-functional inlined OSK! 2021-09-01 15:31:01 +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
6971f09c4d refactor(web): activeElement, lastActiveElement as properties 2021-09-01 09:44:01 +07:00
jahorton
1587887acc fix(web): null check, hidden keyboard on first load 2021-08-23 16:13:18 +07:00
jahorton
8d8291609d chore(web): Merge branch 'refactor/web/vkbd-touch-events' into refactor/web/vkbd-mouse-events 2021-08-19 09:30:26 +07:00
jahorton
e05a23d0be refactor(web): splits detectWithinBounds as requested in review 2021-08-19 09:28:00 +07:00
jahorton
85167994ee fix(web): unit-test issue, TouchEvent compat for desktop 2021-08-17 13:35:39 +07:00
jahorton
b26ea21915 chore(web): Merge branch 'refactor/web/vkbd-touch-events' into refactor/web/vkbd-mouse-events 2021-08-17 10:22:36 +07:00
jahorton
7dd7adb323 chore(web): minor cleanup 2021-08-17 10:21:54 +07:00
jahorton
8656393478 chore(web): Merge branch 'master' into refactor/web/vkbd-touch-events 2021-08-17 08:46:20 +07:00
Joshua Horton
c35c003762
Merge pull request #5462 from keymanapp/refactor/web/vkbd-layout-key-calc-merger
refactor(web): overhaul of OSK key layout calcs + styling, merges desktop & touch logic 📐
2021-08-17 08:36:15 +07:00
Joshua Horton
b5789d2b6a
Merge pull request #5459 from keymanapp/refactor/web/vkbd-layout-calcs
refactor(web): reworks VisualKeyboard layout spec design 📐
2021-08-17 08:36:02 +07:00
Joshua Horton
4ccf48b678
Merge pull request #5451 from keymanapp/refactor/web/vkbd-layout-encapsulation
refactor(web): OSK layout hierarchy encapsulation 📐
2021-08-17 08:35:49 +07:00
Darcy Wong
457311b6cb fix(web): Blank spacebar text when displayName is empty string 2021-08-05 13:09:58 +07:00
jahorton
2d36215e2e chore(web): Merge branch 'refactor/web/vkbd-touch-events' into refactor/web/vkbd-mouse-events 2021-08-04 10:41:57 +07:00
jahorton
f9b038fae8 chore(web): Merge branch 'refactor/web/vkbd-layout-key-calc-merger' into refactor/web/vkbd-touch-events 2021-08-04 10:41:36 +07:00
jahorton
2b998d0b3d fix(web): base font-scaling during desktop osk-resize 2021-08-04 10:36:38 +07:00
jahorton
5021ac0dfe chore(web): Merge branch 'refactor/web/vkbd-layout-calcs' into refactor/web/vkbd-layout-key-calc-merger 2021-08-04 10:25:34 +07:00
jahorton
610ffd7e64 fix(web): desktop OSK resizing performance 2021-08-04 10:25:06 +07:00
jahorton
511f056383 chore(web): Merge branch 'refactor/web/vkbd-layout-calcs' into refactor/web/vkbd-layout-key-calc-merger 2021-08-02 09:20:26 +07:00
jahorton
b33e8eaf5d chore(web): Merge branch 'refactor/web/vkbd-layout-encapsulation' into refactor/web/vkbd-layout-calcs 2021-08-02 09:06:35 +07:00
jahorton
1038209e5c chore(web): Merge branch 'master' into refactor/web/vkbd-layout-encapsulation 2021-08-02 09:05:38 +07:00
Joshua Horton
a162253629
Merge pull request #5490 from keymanapp/fix/web/stuck-key-highlighting
fix(web): stuck key highlighting from touchpoint movement
2021-08-02 09:04:45 +07:00
jahorton
3a9cc742ca refactor(web): OSK mouse input abstraction 2021-07-30 14:50:46 +07:00
jahorton
53fc932f88 chore(web): cleanup per review notes, drops unref'd func 2021-07-30 09:44:15 +07:00
jahorton
b066ceb640 feat(web): screen-based 'fuzzy bounds' for OSK mouse/touch constraints 2021-07-30 08:15:15 +07:00
jahorton
6df759bfc1 feat(web): partial polishing 2021-07-30 08:15:15 +07:00
jahorton
a96d04cc4e refactor(web): abstraction for OSK touch-event input 2021-07-30 08:15:15 +07:00
jahorton
7d73659047 refactor(web): start of inputEventEngine 2021-07-30 08:15:15 +07:00
jahorton
27a15c01df refactor(web): findNearestKey does not need full Event obj 2021-07-30 08:15:14 +07:00
jahorton
14e1ce50da chore(web): Merge branch 'refactor/web/vkbd-layout-calcs' into refactor/web/vkbd-layout-key-calc-merger 2021-07-29 16:58:11 +07:00