From 36a86cf95532705a536bcbce57fc2de384fa8437 Mon Sep 17 00:00:00 2001 From: jaswantp <40538987+jaswantp@users.noreply.github.com> Date: Wed, 19 Aug 2020 14:31:26 +0200 Subject: [PATCH] Draw query rect only when query enabled. --- implot.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/implot.cpp b/implot.cpp index 7c923d3..85e34e5 100644 --- a/implot.cpp +++ b/implot.cpp @@ -1345,20 +1345,23 @@ void EndPlot() { } } - if (plot.Querying || plot.Queried) { - if (plot.QueryRect.GetWidth() > 2 && plot.QueryRect.GetHeight() > 2) { - DrawList.AddRectFilled(plot.QueryRect.Min + gp.BB_Plot.Min, plot.QueryRect.Max + gp.BB_Plot.Min, gp.Col_QryBg); - DrawList.AddRect( plot.QueryRect.Min + gp.BB_Plot.Min, plot.QueryRect.Max + gp.BB_Plot.Min, gp.Col_QryBd); + if (ImHasFlag(plot.Flags, ImPlotFlags_Query)) // draw query rect only when query enabled. + { + if (plot.Querying || plot.Queried) { + if (plot.QueryRect.GetWidth() > 2 && plot.QueryRect.GetHeight() > 2) { + DrawList.AddRectFilled(plot.QueryRect.Min + gp.BB_Plot.Min, plot.QueryRect.Max + gp.BB_Plot.Min, gp.Col_QryBg); + DrawList.AddRect( plot.QueryRect.Min + gp.BB_Plot.Min, plot.QueryRect.Max + gp.BB_Plot.Min, gp.Col_QryBd); + } } - } - else if (plot.Queried) { - ImRect bb_query = plot.QueryRect; + else if (plot.Queried) { + ImRect bb_query = plot.QueryRect; - bb_query.Min += gp.BB_Plot.Min; - bb_query.Max += gp.BB_Plot.Min; + bb_query.Min += gp.BB_Plot.Min; + bb_query.Max += gp.BB_Plot.Min; - DrawList.AddRectFilled(bb_query.Min, bb_query.Max, gp.Col_QryBg); - DrawList.AddRect( bb_query.Min, bb_query.Max, gp.Col_QryBd); + DrawList.AddRectFilled(bb_query.Min, bb_query.Max, gp.Col_QryBg); + DrawList.AddRect( bb_query.Min, bb_query.Max, gp.Col_QryBd); + } } // render legend