First MVP of sorting minigame (#60)

Co-authored-by: Michal Pikulski <michal.a.pikulski@gmail.com>
Co-authored-by: Michal Pikulski <michal@foolhardyhorizons.com>
Reviewed-on: #60
This commit is contained in:
2025-11-19 13:56:10 +00:00
parent f878521dab
commit fee5515bbd
91 changed files with 9205 additions and 178 deletions

View File

@@ -130,8 +130,9 @@ namespace UI.DragAndDrop.Core
SmoothMoveTowardPointer();
}
// Only clamp for non-overlay canvases (WorldSpace/ScreenSpaceCamera)
if (_canvas != null && _canvas.renderMode != RenderMode.ScreenSpaceOverlay)
// Only clamp when actively being dragged (prevent dragging off-screen)
// Don't clamp when just sitting idle - allow objects to move freely off-screen
if (_isDragging && _canvas != null && _canvas.renderMode != RenderMode.ScreenSpaceOverlay)
{
ClampToScreen();
}

View File

@@ -45,6 +45,10 @@ namespace UI.DragAndDrop.Core
public Vector3 WorldPosition => transform.position;
public RectTransform RectTransform => transform as RectTransform;
// Support for both UI and world-space slots
public bool IsUISlot => transform is RectTransform;
public Vector3 SlotPosition => transform.position; // Works for both Transform types
private void Start()
{
if (hideImageOnPlay)
@@ -78,6 +82,7 @@ namespace UI.DragAndDrop.Core
switch (occupantSizeMode)
{
case OccupantSizeMode.MatchSlotSize:
// Only works for UI slots with RectTransform
if (draggable.RectTransform != null && RectTransform != null)
{
Vector2 targetSize = RectTransform.sizeDelta;
@@ -85,6 +90,7 @@ namespace UI.DragAndDrop.Core
(val) => draggable.RectTransform.sizeDelta = val,
scaleTransitionDuration, 0f, Tween.EaseOutBack);
}
// World-space slots (no RectTransform) skip size matching
break;
case OccupantSizeMode.Scale: