don't start selection box on clickables

This commit is contained in:
Tyfon
2024-06-20 00:42:20 -07:00
parent bf6f63c73f
commit 4700ff5aa3
2 changed files with 6 additions and 3 deletions

View File

@@ -68,12 +68,15 @@ namespace UIFixes
foreach (GameObject gameObject in results.Select(r => r.gameObject)) foreach (GameObject gameObject in results.Select(r => r.gameObject))
{ {
var dragInterfaces = gameObject.GetComponents<MonoBehaviour>() var draggables = gameObject.GetComponents<MonoBehaviour>()
.Where(c => c is IDragHandler || c is IBeginDragHandler) .Where(c => c is IDragHandler || c is IBeginDragHandler)
.Where(c => c is not ScrollRectNoDrag) // this disables scrolling, it doesn't add it .Where(c => c is not ScrollRectNoDrag) // this disables scrolling, it doesn't add it
.Where(c => c.name != "Inner"); // there's a random DragTrigger sitting in ItemInfoWindows .Where(c => c.name != "Inner"); // there's a random DragTrigger sitting in ItemInfoWindows
if (dragInterfaces.Any()) var clickables = gameObject.GetComponents<MonoBehaviour>()
.Where(c => c is IPointerClickHandler || c is IPointerDownHandler || c is IPointerUpHandler);
if (draggables.Any() || clickables.Any())
{ {
return; return;
} }

View File

@@ -177,7 +177,7 @@ namespace UIFixes
public static void ShowDragCount(DraggedItemView draggedItemView) public static void ShowDragCount(DraggedItemView draggedItemView)
{ {
if (Count > 1) if (draggedItemView != null && Count > 1)
{ {
GameObject textOverlay = new("MultiSelectText", [typeof(RectTransform), typeof(TextMeshProUGUI)]); GameObject textOverlay = new("MultiSelectText", [typeof(RectTransform), typeof(TextMeshProUGUI)]);
textOverlay.transform.parent = draggedItemView.transform; textOverlay.transform.parent = draggedItemView.transform;