Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(cu): CU v2 geometry — per-frame CoordinateMapper + thread DPI pin

Ruben Lütke974944d73823
diff --git a/jarvis/cu/geometry.py b/jarvis/cu/geometry.py
index 3e455a832f..4bb862e138 100644
--- a/jarvis/cu/geometry.py
+++ b/jarvis/cu/geometry.py
@@ -273,12 +273,18 @@ class CoordinateMapper:
# -- screen space -> image space ------------------------------------
def screen_to_image(self, sx: float, sy: float) -> tuple[int, int]:
- """Inverse mapping, clamped to the image (for verification crops)."""
- ix = (float(sx) - self.capture_left) * self.image_width / self.capture_width
- iy = (float(sy) - self.capture_top) * self.image_height / self.capture_height
- ix = min(max(ix, 0.0), float(self.image_width - 1))
- iy = min(max(iy, 0.0), float(self.image_height - 1))
- return (int(ix), int(iy))
+ """Inverse mapping, clamped to the image (for verification crops).
+
+ The local offset is clamped non-negative before flooring, so negative
+ capture origins never truncate toward zero.
+ """
+ lx = max(0.0, float(sx) - self.capture_left)
+ ly = max(0.0, float(sy) - self.capture_top)
+ ix = int(lx * self.image_width / self.capture_width)
+ iy = int(ly * self.image_height / self.capture_height)
+ ix = min(ix, self.image_width - 1)
+ iy = min(iy, self.image_height - 1)
+ return (ix, iy)
# -- helpers ----------------------------------------------------------