diff options
author | Karl Nilsson <karl.robert.nilsson@gmail.com> | 2021-11-18 13:36:20 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2021-11-18 13:36:20 +0300 |
commit | e0e227404f90d4d9d4e85612e9560b0843dec4e2 (patch) | |
tree | 57d1127d936b8acf98c55dafc891553b3e97c2a6 /cura/PickingPass.py | |
parent | 346640478227cb4e868d85ff37c4f5835cc5cc2f (diff) |
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.
Diffstat (limited to 'cura/PickingPass.py')
-rw-r--r-- | cura/PickingPass.py | 4 |
1 files 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 |