Skip to content

Commit cc5e1da

Browse files
committed
Fixes for 1.89.7 + new ImGuiButtonFlags_AllowOverlap behavior handled by ButtonBehavior() fixes other items from hovering while dragging plot.
1 parent 6dd8007 commit cc5e1da

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

implot.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ You can read releases logs https://github.com/epezent/implot/releases for more d
133133
#define ImDrawFlags_RoundCornersAll ImDrawCornerFlags_All
134134
#endif
135135

136+
// Support for pre-1.89.7 versions.
137+
#if (IMGUI_VERSION_NUM < 18966)
138+
#define ImGuiButtonFlags_AllowOverlap ImGuiButtonFlags_AllowItemOverlap
139+
#endif
140+
136141
// Visual Studio warnings
137142
#ifdef _MSC_VER
138143
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
@@ -1808,7 +1813,7 @@ bool UpdateInput(ImPlotPlot& plot) {
18081813

18091814
// BUTTON STATE -----------------------------------------------------------
18101815

1811-
const ImGuiButtonFlags plot_button_flags = ImGuiButtonFlags_AllowItemOverlap
1816+
const ImGuiButtonFlags plot_button_flags = ImGuiButtonFlags_AllowOverlap
18121817
| ImGuiButtonFlags_PressedOnClick
18131818
| ImGuiButtonFlags_PressedOnDoubleClick
18141819
| ImGuiButtonFlags_MouseButtonLeft
@@ -1818,7 +1823,9 @@ bool UpdateInput(ImPlotPlot& plot) {
18181823
| plot_button_flags;
18191824

18201825
const bool plot_clicked = ImGui::ButtonBehavior(plot.PlotRect,plot.ID,&plot.Hovered,&plot.Held,plot_button_flags);
1821-
ImGui::SetItemAllowOverlap();
1826+
#if (IMGUI_VERSION_NUM < 18966)
1827+
ImGui::SetItemAllowOverlap(); // Handled by ButtonBehavior()
1828+
#endif
18221829

18231830
if (plot_clicked) {
18241831
if (!ImHasFlag(plot.Flags, ImPlotFlags_NoBoxSelect) && IO.MouseClicked[gp.InputMap.Select] && ImHasFlag(IO.KeyMods, gp.InputMap.SelectMod)) {

0 commit comments

Comments
 (0)