Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions implot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3984,6 +3984,7 @@ bool DragPoint(int n_id, double* x, double* y, const ImVec4& col, float radius,

ImGui::KeepAliveID(id);
if (input) {
rect.ClipWithFull(GImPlot->CurrentPlot->PlotRect);
bool clicked = ImGui::ButtonBehavior(rect,id,&hovered,&held);
if (out_clicked) *out_clicked = clicked;
if (out_hovered) *out_hovered = hovered;
Expand Down Expand Up @@ -4033,6 +4034,7 @@ bool DragLineX(int n_id, double* value, const ImVec4& col, float thickness, ImPl

ImGui::KeepAliveID(id);
if (input) {
rect.ClipWithFull(GImPlot->CurrentPlot->PlotRect);
bool clicked = ImGui::ButtonBehavior(rect,id,&hovered,&held);
if (out_clicked) *out_clicked = clicked;
if (out_hovered) *out_hovered = hovered;
Expand Down Expand Up @@ -4089,6 +4091,7 @@ bool DragLineY(int n_id, double* value, const ImVec4& col, float thickness, ImPl

ImGui::KeepAliveID(id);
if (input) {
rect.ClipWithFull(GImPlot->CurrentPlot->PlotRect);
bool clicked = ImGui::ButtonBehavior(rect,id,&hovered,&held);
if (out_clicked) *out_clicked = clicked;
if (out_hovered) *out_hovered = hovered;
Expand Down Expand Up @@ -4143,6 +4146,7 @@ bool DragRect(int n_id, double* x_min, double* y_min, double* x_max, double* y_m
ImVec2 pc = PlotToPixels((*x_min+*x_max)/2,(*y_min+*y_max)/2,IMPLOT_AUTO,IMPLOT_AUTO);
ImRect rect(ImMin(p[0],p[2]),ImMax(p[0],p[2]));
ImRect rect_grab = rect; rect_grab.Expand(DRAG_GRAB_HALF_SIZE);
rect_grab.ClipWithFull(GImPlot->CurrentPlot->PlotRect);

ImGuiMouseCursor cur[4];
if (show_curs) {
Expand All @@ -4167,6 +4171,7 @@ bool DragRect(int n_id, double* x_min, double* y_min, double* x_max, double* y_m
if (input) {
// middle point
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);
b_rect.ClipWithFull(GImPlot->CurrentPlot->PlotRect);
clicked = ImGui::ButtonBehavior(b_rect,id,&hovered,&held);
if (out_clicked) *out_clicked = clicked;
if (out_hovered) *out_hovered = hovered;
Expand All @@ -4188,6 +4193,7 @@ bool DragRect(int n_id, double* x_min, double* y_min, double* x_max, double* y_m
for (int i = 0; i < 4; ++i) {
// points
ImRect b_rect(p[i].x - DRAG_GRAB_HALF_SIZE, p[i].y - DRAG_GRAB_HALF_SIZE, p[i].x + DRAG_GRAB_HALF_SIZE, p[i].y + DRAG_GRAB_HALF_SIZE);
b_rect.ClipWithFull(GImPlot->CurrentPlot->PlotRect);
ImGuiID p_id = id + i + 1;
ImGui::KeepAliveID(p_id);
if (input) {
Expand All @@ -4210,6 +4216,7 @@ bool DragRect(int n_id, double* x_min, double* y_min, double* x_max, double* y_m
ImVec2 e_max = ImMax(p[i],p[(i+1)%4]);
b_rect = h[i] ? ImRect(e_min.x + DRAG_GRAB_HALF_SIZE, e_min.y - DRAG_GRAB_HALF_SIZE, e_max.x - DRAG_GRAB_HALF_SIZE, e_max.y + DRAG_GRAB_HALF_SIZE)
: ImRect(e_min.x - DRAG_GRAB_HALF_SIZE, e_min.y + DRAG_GRAB_HALF_SIZE, e_max.x + DRAG_GRAB_HALF_SIZE, e_max.y - DRAG_GRAB_HALF_SIZE);
b_rect.ClipWithFull(GImPlot->CurrentPlot->PlotRect);
ImGuiID e_id = id + i + 5;
ImGui::KeepAliveID(e_id);
if (input) {
Expand Down