Improve scrolling with the thumbstick
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ constexpr int font_size_small = 30;
|
|||||||
constexpr int font_size_large = 75;
|
constexpr int font_size_large = 75;
|
||||||
|
|
||||||
// Ratio between joystick position and scroll distance/s
|
// Ratio between joystick position and scroll distance/s
|
||||||
constexpr float scroll_ratio = 3;
|
constexpr float scroll_ratio = 10;
|
||||||
|
|
||||||
// Threshold on the trigger value to register a click
|
// Threshold on the trigger value to register a click
|
||||||
constexpr float trigger_click_thd = 0.8;
|
constexpr float trigger_click_thd = 0.8;
|
||||||
|
|||||||
@@ -711,7 +711,7 @@ void imgui_context::new_frame(XrTime display_time)
|
|||||||
ImPlot::SetCurrentContext(plot_context);
|
ImPlot::SetCurrentContext(plot_context);
|
||||||
|
|
||||||
if (last_display_time)
|
if (last_display_time)
|
||||||
io.DeltaTime = std::min((display_time - last_display_time) * 1e-9f, 0.1f);
|
io.DeltaTime = std::min((display_time - last_display_time) * 1e-9f, 0.0166f);
|
||||||
last_display_time = display_time;
|
last_display_time = display_time;
|
||||||
|
|
||||||
// Uses the window list from last frame
|
// Uses the window list from last frame
|
||||||
@@ -741,7 +741,10 @@ void imgui_context::new_frame(XrTime display_time)
|
|||||||
io.AddMousePosEvent(position->x, position->y);
|
io.AddMousePosEvent(position->x, position->y);
|
||||||
|
|
||||||
if (glm::length(scroll) > constants::gui::scroll_value_thd)
|
if (glm::length(scroll) > constants::gui::scroll_value_thd)
|
||||||
io.AddMouseWheelEvent(scroll.x, scroll.y);
|
{
|
||||||
|
io.MouseWheel = scroll.y;
|
||||||
|
io.MouseWheelH = scroll.x;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user