Skip to content

Commit

Permalink
Merge pull request epezent#1 from jaswantp/SkipDrawQuery
Browse files Browse the repository at this point in the history
Draw query rect only when ImPlotFlags_Query is set.
  • Loading branch information
jspanchu authored Aug 19, 2020
2 parents 5da2b3e + 18847f8 commit fe9108c
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions implot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fe9108c

Please sign in to comment.