From a6fe5cae00c58365d3ca261783cc745006b2f117 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Fri, 3 Mar 2023 19:44:05 +0100 Subject: Allow 8 symbols per key 'Keyboard.Key' now contains an array of size 9, giving each keyvalue an index. The algorithm for finding the nearest key during a swipe now needs 16 segments, which are now calculated as an angle. The algorithm does one more interation instead of 2 more, slightly reducing the sensitivity of corner values. The 'getAtDirection' function is moved into the Pointers class to clearly separate the two systems. The 'edgekey' attribute is now obsolete but is kept for compatibility. The flag is removed internally, key index are simply translated. Similarly, the 'slider' attribute now act on keys at index 5 and 6 instead of 2 and 3. --- srcs/juloo.keyboard2/KeyValue.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'srcs/juloo.keyboard2/KeyValue.java') diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java index c4bd069..3e84ce8 100644 --- a/srcs/juloo.keyboard2/KeyValue.java +++ b/srcs/juloo.keyboard2/KeyValue.java @@ -202,7 +202,14 @@ final class KeyValue @Override public boolean equals(Object obj) { - KeyValue snd = (KeyValue)obj; + return sameKey((KeyValue)obj); + } + + /** Type-safe alternative to [equals]. */ + public boolean sameKey(KeyValue snd) + { + if (snd == null) + return false; return _symbol.equals(snd._symbol) && _code == snd._code; } -- cgit v1.2.3