Stick the index to the closest imgui window, register click only when the finger is 1cm inside the window

This commit is contained in:
Guillaume Meunier
2025-11-01 20:58:06 +01:00
parent aa3a1808f8
commit c0dc193247
4 changed files with 309 additions and 14 deletions
+5 -4
View File
@@ -26,7 +26,7 @@
namespace constants::gui
{
// Minimum distance between a GUI layer and a fingertip/controller to register a click
constexpr float min_pointer_distance = -0.1;
constexpr float min_pointer_distance = -0.02;
// Font to use (desktop only)
constexpr const char font_name[] = "Noto Sans";
@@ -41,9 +41,10 @@ constexpr float scroll_ratio = 10;
// Threshold on the trigger value to register a click
constexpr float trigger_click_thd = 0.8;
// Thresholds on the distance between the fingertip and GUI layers
constexpr float fingertip_distance_hovering_thd = 0.15;
constexpr float fingertip_distance_touching_thd = 0.0;
// Thresholds on the distance between the fingertip and GUI layers (positive: in front of the GUI, negative: behind the GUI)
constexpr float fingertip_distance_hovering_thd = 0.15; // Max distance to have the cursor hovering
constexpr float fingertip_distance_touching_thd = -0.01; // Max distance to register a click
constexpr float fingertip_distance_stick_thd = -0.02; // Max distance where the fingertip is moved to be on the GUI
// Minimum scroll value to enable a controller
constexpr float scroll_value_thd = 0.01;