From 5a0ad977eef8c9fb24bc6067a03427b0814fcc4c Mon Sep 17 00:00:00 2001 From: Forrest Voight Date: Fri, 22 Oct 2021 10:35:28 -0500 Subject: [PATCH] add GetLastItemHidden --- implot.cpp | 7 +++++++ implot.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/implot.cpp b/implot.cpp index 234f2e91..40cd3387 100644 --- a/implot.cpp +++ b/implot.cpp @@ -3558,6 +3558,13 @@ void HideNextItem(bool hidden, ImPlotCond cond) { gp.NextItemData.HiddenCond = cond; } +bool GetLastItemHidden() { + ImPlotContext& gp = *GImPlot; + if (gp.PreviousItem) + return !gp.PreviousItem->Show; + return false; +} + //----------------------------------------------------------------------------- // [SECTION] Plot Tools //----------------------------------------------------------------------------- diff --git a/implot.h b/implot.h index 693e14e7..39883b88 100644 --- a/implot.h +++ b/implot.h @@ -825,6 +825,8 @@ IMPLOT_API void CancelPlotSelection(); // Hides or shows the next plot item (i.e. as if it were toggled from the legend). // Use ImPlotCond_Always if you need to forcefully set this every frame. IMPLOT_API void HideNextItem(bool hidden = true, ImPlotCond cond = ImPlotCond_Once); +// Returns true if the last plot item was hidden +IMPLOT_API bool GetLastItemHidden(); // Use the following around calls to Begin/EndPlot to align l/r/t/b padding. // Consider using Begin/EndSubplots first. They are more feature rich and