mirror of
https://github.com/gwm17/implot.git
synced 2024-11-26 12:18:52 -05:00
fixed dragging issue where plots that were not mouse-clicked would be dragged
This commit is contained in:
parent
4be885bf57
commit
523ae3aef4
24
implot.cpp
24
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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user