From e0e227404f90d4d9d4e85612e9560b0843dec4e2 Mon Sep 17 00:00:00 2001 From: Karl Nilsson Date: Thu, 18 Nov 2021 11:36:20 +0100 Subject: [PATCH] Fix picking pixel on integer indices The QImage.pixel() function should only get integers. In theory an input position of -2,-2 would get rounded to 0 now. However that shouldn't occur because the user can't click outside of the window. And if it does occur, it's not really a problem either that it's theoretically picking a position inside of the window when you click slightly next to it. Fixes #10785. --- cura/PickingPass.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/PickingPass.py b/cura/PickingPass.py index 54e886fe62..4d6ef671df 100644 --- a/cura/PickingPass.py +++ b/cura/PickingPass.py @@ -72,8 +72,8 @@ class PickingPass(RenderPass): window_size = self._renderer.getWindowSize() - px = (0.5 + x / 2.0) * window_size[0] - py = (0.5 + y / 2.0) * window_size[1] + px = int((0.5 + x / 2.0) * window_size[0]) + py = int((0.5 + y / 2.0) * window_size[1]) if px < 0 or px > (output.width() - 1) or py < 0 or py > (output.height() - 1): return -1