diff --git a/implot.cpp b/implot.cpp index f242d39..85a5c2d 100644 --- a/implot.cpp +++ b/implot.cpp @@ -1143,19 +1143,23 @@ bool BeginPlot(const char* title, const char* x_label, const char* y_label, cons break; } } - - if (direction == 0) { - ImGui::SetMouseCursor(ImGuiMouseCursor_NotAllowed); - } else if (direction == (1 << 1)) { - ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW); - } else if (direction == (1 << 2)) { - ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeNS); - } else { - ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeAll); + if (IO.MouseDragMaxDistanceSqr[0] > 5) { + if (direction == 0) { + ImGui::SetMouseCursor(ImGuiMouseCursor_NotAllowed); + } + else if (direction == (1 << 1)) { + ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW); + } + else if (direction == (1 << 2)) { + ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeNS); + } + else { + ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeAll); + } } } // start drag - if (!drag_in_progress && gp.Hov_Frame && IO.MouseDragMaxDistanceSqr[0] > 5 && !plot.Selecting && !hov_legend && !hov_query && !plot.DraggingQuery) { + if (!drag_in_progress && gp.Hov_Frame && IO.MouseClicked[0] && !plot.Selecting && !hov_legend && !hov_query && !plot.DraggingQuery) { if (hov_x_axis_region) { plot.XAxis.Dragging = true; } diff --git a/implot_demo.cpp b/implot_demo.cpp index 95c0e65..3231854 100644 --- a/implot_demo.cpp +++ b/implot_demo.cpp @@ -921,7 +921,6 @@ void ShowDemoWindow(bool* p_open) { static BenchmarkItem items[n_items]; ImGui::BulletText("Make sure VSync is disabled."); ImGui::BulletText("%d lines with %d points each @ %.3f FPS.",n_items,1000,ImGui::GetIO().Framerate); - SetNextPlotLimits(0,1,0,1, ImGuiCond_Always); if (ImPlot::BeginPlot("##Bench",NULL,NULL,ImVec2(-1,0),ImPlotFlags_Default | ImPlotFlags_NoChild)) { char buff[16]; for (int i = 0; i < 100; ++i) {