mirror of
https://github.com/gwm17/implot.git
synced 2024-11-26 20:28:50 -05:00
IsPlotItemHighlight
Returns true if plot item is highlight
This commit is contained in:
parent
4d4cac629b
commit
140dd2bd8a
14
implot.cpp
14
implot.cpp
|
@ -195,6 +195,9 @@ inline T Remap(T x, T x0, T x1, T y0, T y1) {
|
|||
|
||||
// Returns always positive modulo
|
||||
inline int PosMod(int l, int r) {
|
||||
if (r == 0)
|
||||
return 0;
|
||||
else
|
||||
return (l % r + r) % r;
|
||||
}
|
||||
|
||||
|
@ -1935,6 +1938,17 @@ ImPlotLimits GetPlotQuery(int y_axis_in) {
|
|||
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
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
2
implot.h
2
implot.h
|
@ -298,6 +298,8 @@ ImPlotLimits GetPlotLimits(int y_axis = -1);
|
|||
bool IsPlotQueried();
|
||||
// Returns the current or most recent plot query bounds.
|
||||
ImPlotLimits GetPlotQuery(int y_axis = -1);
|
||||
// Returns true if plot item is highlight
|
||||
bool IsPlotItemHighlight(const char* label_id);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Plot Input Mapping
|
||||
|
|
Loading…
Reference in New Issue
Block a user