Skip to content

Commit 153cfc0

Browse files
committed
Fix gamepad thumbsticks being tracked incorrectly
The bug was introduced in v2.2.8.
1 parent 3e24c2e commit 153cfc0

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

mousetracks2/components/processing.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,13 @@ def _record_move(self, data: MovementMaps, position: tuple[int, int],
195195
moving, the downside being it will still record any jumps while
196196
moving, and will always skip the first frame of movement.
197197
"""
198-
# Convert logical to physical
199-
old_position = self.monitor_data.coordinate(position)
200-
if data.position is None:
201-
new_position = old_position
202-
else:
203-
new_position = self.monitor_data.coordinate(data.position)
198+
# Convert pixels from logical coordinates to physical
199+
if force_monitor is None:
200+
old_position = self.monitor_data.coordinate(position)
201+
if data.position is None:
202+
new_position = old_position
203+
else:
204+
new_position = self.monitor_data.coordinate(data.position)
204205

205206
# If the ticks match then overwrite the old data
206207
if self.tick == data.tick:

mousetracks2/gui/main_window.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,11 +2290,12 @@ def draw_pixmap_line(self, old_position: tuple[int, int] | None, new_position: t
22902290
if not self.isVisible() or not self.is_live or self._is_closing or self.ui.thumbnail.pixmap().isNull():
22912291
return
22922292

2293-
# Convert logical to physical
2294-
if old_position is not None:
2295-
old_position = self.monitor_data.coordinate(old_position)
2296-
if new_position is not None:
2297-
new_position = self.monitor_data.coordinate(new_position)
2293+
# Convert pixels from logical coordinates to physical
2294+
if force_monitor is None:
2295+
if old_position is not None:
2296+
old_position = self.monitor_data.coordinate(old_position)
2297+
if new_position is not None:
2298+
new_position = self.monitor_data.coordinate(new_position)
22982299

22992300
unique_pixels = set()
23002301
size = self.ui.thumbnail.pixmap_size()

0 commit comments

Comments
 (0)