mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 01:17:00 +00:00
Demo: mouse dragging demo tweaks
This commit is contained in:
parent
fa179d0ad8
commit
8d8f4934fb
@ -1704,7 +1704,7 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
ImGui::Checkbox("io.MouseDrawCursor", &io.MouseDrawCursor);
|
||||
ImGui::SameLine(); ShowHelpMarker("Request ImGui to render a mouse cursor for you in software. Note that a mouse cursor rendered via regular GPU rendering will feel more laggy than hardware cursor, but will be more in sync with your other visuals.");
|
||||
ImGui::SameLine(); ShowHelpMarker("Request ImGui to render a mouse cursor for you in software. Note that a mouse cursor rendered via your application GPU rendering path will feel more laggy than hardware cursor, but will be more in sync with your other visuals.\n\nSome desktop applications may use both kinds of cursors (e.g. enable software cursor only when resizing/dragging something).");
|
||||
|
||||
ImGui::Text("WantCaptureMouse: %d", io.WantCaptureMouse);
|
||||
ImGui::Text("WantCaptureKeyboard: %d", io.WantCaptureKeyboard);
|
||||
@ -1823,7 +1823,8 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
{
|
||||
ImGui::TextWrapped("You can use ImGui::GetMouseDragDelta(0) to query for the dragged amount on any widget.");
|
||||
for (int button = 0; button < 3; button++)
|
||||
ImGui::Text("IsMouseDragging(%d) = %d", button, ImGui::IsMouseDragging(button));
|
||||
ImGui::Text("IsMouseDragging(%d):\n w/ default threshold: %d,\n w/ zero threshold: %d\n w/ large threshold: %d",
|
||||
button, ImGui::IsMouseDragging(button), ImGui::IsMouseDragging(button, 0.0f), ImGui::IsMouseDragging(button, 20.0f));
|
||||
ImGui::Button("Drag Me");
|
||||
if (ImGui::IsItemActive())
|
||||
{
|
||||
@ -1832,6 +1833,9 @@ void ImGui::ShowTestWindow(bool* p_open)
|
||||
draw_list->PushClipRectFullScreen();
|
||||
draw_list->AddLine(ImGui::CalcItemRectClosestPoint(io.MousePos, true, -2.0f), io.MousePos, ImColor(ImGui::GetStyle().Colors[ImGuiCol_Button]), 4.0f);
|
||||
draw_list->PopClipRect();
|
||||
|
||||
// Drag operations gets "unlocked" when the mouse has moved past a certain threshold (the default threshold is stored in io.MouseDragThreshold)
|
||||
// You can request a lower or higher threshold using the second parameter of IsMouseDragging() and GetMouseDragDelta()
|
||||
ImVec2 value_raw = ImGui::GetMouseDragDelta(0, 0.0f);
|
||||
ImVec2 value_with_lock_threshold = ImGui::GetMouseDragDelta(0);
|
||||
ImVec2 mouse_delta = io.MouseDelta;
|
||||
|
Loading…
Reference in New Issue
Block a user