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

Fix Drag utils to work with updated ImGui (as done in commits to master)

This commit is contained in:
Gordon McCann 2022-11-08 13:48:40 -05:00
parent d34204b5a7
commit 6d3e3bb418

View File

@ -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);