Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GetLastItemHidden() to allow application to see whether a line has been hidden #295

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions implot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//-----------------------------------------------------------------------------
Expand Down
2 changes: 2 additions & 0 deletions implot.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down