multiselect + sort table polish, sort table keybinds

This commit is contained in:
Tyfon
2024-07-22 13:54:45 -07:00
parent 41699a422f
commit 0a656a2c4b
7 changed files with 190 additions and 54 deletions

View File

@@ -25,6 +25,8 @@ public class DrawMultiSelect : MonoBehaviour
private bool drawing;
private bool secondary;
private static Vector2 Deadzone = new(5f, 5f);
public void Start()
{
selectTexture = new Texture2D(1, 1);
@@ -70,6 +72,21 @@ public class DrawMultiSelect : MonoBehaviour
selectOrigin = Input.mousePosition;
drawing = true;
secondary = shiftDown;
if (!secondary)
{
MultiSelect.Clear();
}
}
if (drawing && !Settings.SelectionBoxKey.Value.IsPressedIgnoreOthers())
{
drawing = false;
if (secondary)
{
MultiSelect.CombineSecondary();
secondary = false;
}
}
if (drawing)
@@ -77,6 +94,10 @@ public class DrawMultiSelect : MonoBehaviour
selectEnd = Input.mousePosition;
Rect selectRect = new(selectOrigin, selectEnd - selectOrigin);
if (Mathf.Abs(selectRect.size.x) < Deadzone.x && Mathf.Abs(selectRect.size.y) < Deadzone.y)
{
return;
}
// If not secondary, then we can kick out any non-rendered items, plus they won't be covered by the foreach below
if (!secondary)
@@ -119,16 +140,6 @@ public class DrawMultiSelect : MonoBehaviour
MultiSelect.Deselect(gridItemView, secondary);
}
}
if (drawing && !Settings.SelectionBoxKey.Value.IsPressedIgnoreOthers())
{
drawing = false;
if (secondary)
{
MultiSelect.CombineSecondary();
secondary = false;
}
}
}
public void OnGUI()