1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-30 05:58:52 -05:00

IsPlotItemHighlight

Returns true if plot item is highlight
This commit is contained in:
ozlb 2020-07-13 06:44:51 +02:00 committed by GitHub
parent 4d4cac629b
commit 140dd2bd8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -195,6 +195,9 @@ inline T Remap(T x, T x0, T x1, T y0, T y1) {
// Returns always positive modulo // Returns always positive modulo
inline int PosMod(int l, int r) { inline int PosMod(int l, int r) {
if (r == 0)
return 0;
else
return (l % r + r) % r; return (l % r + r) % r;
} }
@ -1935,6 +1938,17 @@ ImPlotLimits GetPlotQuery(int y_axis_in) {
return result; return result;
} }
bool IsPlotItemHighlight(const char* label_id) {
IM_ASSERT_USER_ERROR(gp.CurrentPlot != NULL, "IsPlotItemHighlight() needs to be called between BeginPlot() and EndPlot()!");
ImGuiID id = ImGui::GetID(label_id);
ImPlotItem* item = gp.CurrentPlot->Items.GetOrAddByKey(id);
if (item && item->Highlight)
return true;
else
return false;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// STYLING // STYLING
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -298,6 +298,8 @@ ImPlotLimits GetPlotLimits(int y_axis = -1);
bool IsPlotQueried(); bool IsPlotQueried();
// Returns the current or most recent plot query bounds. // Returns the current or most recent plot query bounds.
ImPlotLimits GetPlotQuery(int y_axis = -1); ImPlotLimits GetPlotQuery(int y_axis = -1);
// Returns true if plot item is highlight
bool IsPlotItemHighlight(const char* label_id);
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Plot Input Mapping // Plot Input Mapping