From 4be83def594d3ab9f75e3f3b2588e133562a3623 Mon Sep 17 00:00:00 2001 From: Evan Pezent Date: Wed, 28 Jul 2021 11:52:57 -0700 Subject: [PATCH] add IsSubplotsHovered --- implot.cpp | 6 ++++++ implot.h | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/implot.cpp b/implot.cpp index 2e0ddad..25a4ac6 100644 --- a/implot.cpp +++ b/implot.cpp @@ -3180,6 +3180,12 @@ void PopPlotClipRect() { ImGui::PopClipRect(); } +bool IsSubplotsHovered() { + ImPlotContext& gp = *GImPlot; + IM_ASSERT_USER_ERROR(gp.CurrentSubplot != NULL, "IsSubplotsHovered() needs to be called between BeginSubplots() and EndSubplots()!"); + return gp.CurrentSubplot->FrameHovered; +} + bool IsPlotHovered() { ImPlotContext& gp = *GImPlot; IM_ASSERT_USER_ERROR(gp.CurrentPlot != NULL, "IsPlotHovered() needs to be called between BeginPlot() and EndPlot()!"); diff --git a/implot.h b/implot.h index 316915b..33a64d7 100644 --- a/implot.h +++ b/implot.h @@ -419,7 +419,7 @@ IMPLOT_API void EndPlot(); // EndSubplots(); // } // -// Procudes: +// Produces: // // [0][1][2] // [3][4][5] @@ -651,8 +651,11 @@ IMPLOT_API ImPlotLimits GetPlotQuery(ImPlotYAxis y_axis = IMPLOT_AUTO); // Set the current plot query bounds. Query must be enabled with ImPlotFlags_Query. IMPLOT_API void SetPlotQuery(const ImPlotLimits& query, ImPlotYAxis y_axis = IMPLOT_AUTO); +// Returns true if the bounding frame of a subplot is hovered/ +IMPLOT_API bool IsSubplotsHovered(); + //----------------------------------------------------------------------------- -// Algined Plots +// Aligned Plots //----------------------------------------------------------------------------- // Consider using Begin/EndSubplots first. They are more feature rich and