Refactor for nicer pointing device axes handling

This commit is contained in:
xs5871
2023-02-11 21:23:03 +00:00
committed by xs5871
parent ca800331de
commit 9e5d2c24e1
4 changed files with 35 additions and 23 deletions

View File

@@ -43,8 +43,18 @@ class Axis:
return f'Axis(code={self.code}, delta={self.delta})'
def move(self, keyboard: Keyboard, delta: int):
keyboard.hid_pending = True
self.delta += delta
if self.delta:
keyboard.axes.add(self)
keyboard.hid_pending = True
else:
keyboard.axes.discard(self)
class AX:
W = Axis(2)
X = Axis(0)
Y = Axis(1)
def maybe_make_key(