diff options
| author | Jules Aguillon | 2024-06-09 14:03:02 +0200 |
|---|---|---|
| committer | Jules Aguillon | 2024-06-09 14:03:02 +0200 |
| commit | 944ed32a377291e54d0093a1e864abf771d79bb8 (patch) | |
| tree | cdc447d1dcf793b11fe9f6ddfac2f90e0b20ab7e /srcs | |
| parent | 773147ab9c19d49a7958e07c50455204e49a2ecc (diff) | |
| download | unexpected-keyboard-944ed32a377291e54d0093a1e864abf771d79bb8.tar.gz unexpected-keyboard-944ed32a377291e54d0093a1e864abf771d79bb8.zip | |
Use preferred dir when placing a key next to an other
Diffstat (limited to 'srcs')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyboardData.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/srcs/juloo.keyboard2/KeyboardData.java b/srcs/juloo.keyboard2/KeyboardData.java index 225d8cc..604d7cc 100644 --- a/srcs/juloo.keyboard2/KeyboardData.java +++ b/srcs/juloo.keyboard2/KeyboardData.java @@ -67,8 +67,14 @@ public final class KeyboardData if (pos.next_to != null) { KeyPos next_to_pos = getKeys().get(pos.next_to); - if (next_to_pos != null - && add_key_to_pos(rows, kv, next_to_pos.with_dir(-1))) + // Use preferred direction if some preferred pos match + if (next_to_pos != null) + for (KeyPos p : pos.positions) + if ((p.row == -1 || p.row == next_to_pos.row) + && (p.col == -1 || p.col == next_to_pos.col) + && add_key_to_pos(rows, kv, next_to_pos.with_dir(p.dir))) + return true; + if (add_key_to_pos(rows, kv, next_to_pos.with_dir(-1))) return true; } for (KeyPos p : pos.positions) |
