summaryrefslogtreecommitdiff
path: root/imgui_helper_widgets.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'imgui_helper_widgets.cpp')
-rw-r--r--imgui_helper_widgets.cpp19
1 files changed, 19 insertions, 0 deletions
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;
+ }
+}