Closed xgpt closed 2 years ago
"""
# Send multiple reports if necessary to move or scroll requested amounts.
while x != 0 or y != 0 or wheel != 0:
partial_x = self._limit(x)
partial_y = self._limit(y)
partial_wheel = self._limit(wheel)
self.report[1] = partial_x & 0xFF
self.report[2] = partial_y & 0xFF
self.report[3] = partial_wheel & 0xFF
self._mouse_device.send_report(self.report)
x -= partial_x
y -= partial_y
wheel -= partial_wheel
def _send_no_move(self) -> None:
"""Send a button-only report."""
self.report[1] = 0
self.report[2] = 0
self.report[3] = 0
self._mouse_device.send_report(self.report)
@staticmethod
def _limit(dist: int) -> int:
return min(127, max(-127, dist))
I'm too n00b to understand what that block of _limit is all about, or if -= and a negative variable would do something weird...idk.
I made a mistake. Library works great!
Why?