From 36a51c19b411206213b27e30106fff161251b652 Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Sun, 27 Nov 2022 11:45:11 -0500 Subject: graph fixes --- imgui_helper_widgets.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'imgui_helper_widgets.cpp') diff --git a/imgui_helper_widgets.cpp b/imgui_helper_widgets.cpp index c27e947..e55a5e7 100644 --- a/imgui_helper_widgets.cpp +++ b/imgui_helper_widgets.cpp @@ -84,3 +84,22 @@ ImGui_Brush_CalcMousePos(project_state *State, ImGuiIO &io, ImVec2 MouseDelta, i } return MousePos; } + +static void +ImGui_TestBoxSelection_Point(ImVec2 Pos, ImGuiIO &io, bool32 *Test) +{ + real32 Y_Top = (io.MouseClickedPos[0].y < io.MousePos.y) ? io.MouseClickedPos[0].y : io.MousePos.y; + real32 Y_Bottom = (io.MouseClickedPos[0].y > io.MousePos.y) ? io.MouseClickedPos[0].y : io.MousePos.y; + real32 X_Left = (io.MouseClickedPos[0].x < io.MousePos.x) ? io.MouseClickedPos[0].x : io.MousePos.x; + real32 X_Right = (io.MouseClickedPos[0].x > io.MousePos.x) ? io.MouseClickedPos[0].x : io.MousePos.x; + + if (Pos.y >= Y_Top && Pos.y <= Y_Bottom && + Pos.x >= X_Left && Pos.x <= X_Right) + { + if (!(*Test)) { + *Test = 1; + } + } else if (!io.KeyShift) { + *Test = 0; + } +} -- cgit v1.2.3