mirror of
https://github.com/gwm17/implot.git
synced 2025-04-22 08:18:50 -04:00
fixed dragging issue where plots that were not mouse-clicked would be dragged
This commit is contained in:
parent
4be885bf57
commit
523ae3aef4
14
implot.cpp
14
implot.cpp
|
@ -1143,19 +1143,23 @@ bool BeginPlot(const char* title, const char* x_label, const char* y_label, cons
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (IO.MouseDragMaxDistanceSqr[0] > 5) {
|
||||||
if (direction == 0) {
|
if (direction == 0) {
|
||||||
ImGui::SetMouseCursor(ImGuiMouseCursor_NotAllowed);
|
ImGui::SetMouseCursor(ImGuiMouseCursor_NotAllowed);
|
||||||
} else if (direction == (1 << 1)) {
|
}
|
||||||
|
else if (direction == (1 << 1)) {
|
||||||
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW);
|
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeEW);
|
||||||
} else if (direction == (1 << 2)) {
|
}
|
||||||
|
else if (direction == (1 << 2)) {
|
||||||
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeNS);
|
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeNS);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeAll);
|
ImGui::SetMouseCursor(ImGuiMouseCursor_ResizeAll);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// start drag
|
// 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) {
|
if (hov_x_axis_region) {
|
||||||
plot.XAxis.Dragging = true;
|
plot.XAxis.Dragging = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -921,7 +921,6 @@ void ShowDemoWindow(bool* p_open) {
|
||||||
static BenchmarkItem items[n_items];
|
static BenchmarkItem items[n_items];
|
||||||
ImGui::BulletText("Make sure VSync is disabled.");
|
ImGui::BulletText("Make sure VSync is disabled.");
|
||||||
ImGui::BulletText("%d lines with %d points each @ %.3f FPS.",n_items,1000,ImGui::GetIO().Framerate);
|
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)) {
|
if (ImPlot::BeginPlot("##Bench",NULL,NULL,ImVec2(-1,0),ImPlotFlags_Default | ImPlotFlags_NoChild)) {
|
||||||
char buff[16];
|
char buff[16];
|
||||||
for (int i = 0; i < 100; ++i) {
|
for (int i = 0; i < 100; ++i) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user