From 6d3e3bb418f3623edaac460ae5b8d5fd8d268a0b Mon Sep 17 00:00:00 2001 From: Gordon McCann Date: Tue, 8 Nov 2022 13:48:40 -0500 Subject: [PATCH] Fix Drag utils to work with updated ImGui (as done in commits to master) --- implot.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/implot.cpp b/implot.cpp index eeb1356..bf6eae0 100644 --- a/implot.cpp +++ b/implot.cpp @@ -619,6 +619,7 @@ bool ShowLegendEntries(ImPlotItemGroup& items, const ImRect& legend_bb, bool hov ImRect button_bb(icon_bb.Min, label_bb.Max); + ImGui::KeepAliveID(item->ID); bool item_hov = false; bool item_hld = false; @@ -3684,6 +3685,7 @@ bool DragPoint(int n_id, double* x, double* y, const ImVec4& col, float radius, ImRect rect(pos.x-grab_half_size,pos.y-grab_half_size,pos.x+grab_half_size,pos.y+grab_half_size); bool hovered = false, held = false; + ImGui::KeepAliveID(id); if (input) ImGui::ButtonBehavior(rect,id,&hovered,&held); @@ -3728,6 +3730,7 @@ bool DragLineX(int n_id, double* value, const ImVec4& col, float thickness, ImPl ImRect rect(x-grab_half_size,yt,x+grab_half_size,yb); bool hovered = false, held = false; + ImGui::KeepAliveID(id); if (input) ImGui::ButtonBehavior(rect,id,&hovered,&held); @@ -3779,6 +3782,7 @@ bool DragLineY(int n_id, double* value, const ImVec4& col, float thickness, ImPl ImRect rect(xl,y-grab_half_size,xr,y+grab_half_size); bool hovered = false, held = false; + ImGui::KeepAliveID(id); if (input) ImGui::ButtonBehavior(rect,id,&hovered,&held); @@ -3849,6 +3853,7 @@ bool DragRect(int n_id, double* x_min, double* y_min, double* x_max, double* y_m bool hovered = false, held = false; ImRect b_rect(pc.x-DRAG_GRAB_HALF_SIZE,pc.y-DRAG_GRAB_HALF_SIZE,pc.x+DRAG_GRAB_HALF_SIZE,pc.y+DRAG_GRAB_HALF_SIZE); + ImGui::KeepAliveID(id); if (input) ImGui::ButtonBehavior(b_rect,id,&hovered,&held);