From 8ed7980fd4f6ff8293a33e471f3ba90d26edff2d Mon Sep 17 00:00:00 2001 From: Martin Heistermann Date: Mon, 26 Feb 2024 19:49:50 +0100 Subject: [PATCH] Bugfix in mouse-based picking example code: Take scaling into account. --- cpp/source/features/callbacks_and_UIs.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpp/source/features/callbacks_and_UIs.md b/cpp/source/features/callbacks_and_UIs.md index 246e985b..94ff1e67 100644 --- a/cpp/source/features/callbacks_and_UIs.md +++ b/cpp/source/features/callbacks_and_UIs.md @@ -140,7 +140,9 @@ if (io.MouseClicked[0]) { // if the left mouse button was clicked glm::vec3 worldRay = polyscope::view::screenCoordsToWorldRay(screenCoords); glm::vec3 worldPos = polyscope::view::screenCoordsToWorldPosition(screenCoords); std::pair pickPair = - polyscope::pick::evaluatePickQuery(screenCoords.x, screenCoords.y); + polyscope::pick::evaluatePickQuery( + io.DisplayFramebufferScale.x * screenCoords.x, + io.DisplayFramebufferScale.y * screenCoords.y); // print some values std::cout << " io.MousePos.x: " << io.MousePos.x << " io.MousePos.y: " << io.MousePos.y << std::endl;