From f67dcfda909d1927c2c816f08fb009a3078d57aa Mon Sep 17 00:00:00 2001 From: CharlesDev Date: Thu, 11 Apr 2024 16:38:11 -0400 Subject: [PATCH] Fixed multiselect box visual bug --- Fushigi/ui/widgets/LevelViewport.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Fushigi/ui/widgets/LevelViewport.cs b/Fushigi/ui/widgets/LevelViewport.cs index 6ffe262..59913b6 100644 --- a/Fushigi/ui/widgets/LevelViewport.cs +++ b/Fushigi/ui/widgets/LevelViewport.cs @@ -1430,7 +1430,21 @@ Vector2[] GetPoints() } if (mMultiSelecting && mMultiSelectStartPos != null && mMultiSelectCurrentPos != null) - mDrawList.AddRect(mMultiSelectStartPos.Value, mMultiSelectCurrentPos.Value, MultiSelectBoxColor, 2f, ImDrawFlags.RoundCornersAll, MultiSelectBoxThickness); + { + Vector2 pMin = mMultiSelectStartPos.Value; + Vector2 pMax = mMultiSelectCurrentPos.Value; + if (mMultiSelectCurrentPos.Value.X < mMultiSelectStartPos.Value.X) + { + pMax.X = mMultiSelectStartPos.Value.X; + pMin.X = mMultiSelectCurrentPos.Value.X; + } + if (mMultiSelectCurrentPos.Value.Y < mMultiSelectStartPos.Value.Y) + { + pMax.Y = mMultiSelectStartPos.Value.Y; + pMin.Y = mMultiSelectCurrentPos.Value.Y; + } + mDrawList.AddRect(pMin, pMax, MultiSelectBoxColor, 2f, ImDrawFlags.RoundCornersAll, MultiSelectBoxThickness); + } mHoveredObject = newHoveredObject; }