summaryrefslogtreecommitdiff
path: root/imgui_helper_widgets.cpp
diff options
context:
space:
mode:
authorFox Caminiti <fox@foxcam.net>2022-11-27 11:45:11 -0500
committerFox Caminiti <fox@foxcam.net>2022-11-27 11:45:11 -0500
commit36a51c19b411206213b27e30106fff161251b652 (patch)
tree14c4611b61fd9a48d26d543db3c5196f79ef7654 /imgui_helper_widgets.cpp
parentc5a60e71f9ed869467e2090f4b343641b021386a (diff)
graph fixes
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;
+ }
+}