Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions Runtime/Operators/UguiDragAndDropOperator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023-2025 Koji Hasegawa.
// Copyright (c) 2023-2026 Koji Hasegawa.
// This software is released under the MIT License.

using System;
Expand Down Expand Up @@ -207,10 +207,6 @@ public async UniTask OperateAsync(GameObject gameObject, Vector2 destination,
raycastResult = RaycastResultExtensions.CreateFrom(gameObject, GetScreenPoint);
}

var canvas = gameObject.GetComponentInParent<Canvas>();
var scaleFactor = canvas != null ? canvas.scaleFactor : 1f;
var scaledSpeed = (int)(_dragSpeed * scaleFactor);

// Output log before the operation, after the shown effects
var operationLogger = new OperationLogger(gameObject, this, Logger, ScreenshotOptions);
operationLogger.Properties.Add("position", raycastResult.screenPosition);
Expand All @@ -221,7 +217,7 @@ public async UniTask OperateAsync(GameObject gameObject, Vector2 destination,
using (var simulator = new PointerDragEventSimulator(gameObject, raycastResult, Logger))
{
simulator.BeginDrag();
await simulator.DragAsync(destination, scaledSpeed, cancellationToken);
await simulator.DragAsync(destination, _dragSpeed, cancellationToken);

Comment on lines 217 to 221
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Behavior change (drag speed no longer scaled by Canvas scale factor) isn’t covered by tests that use a non-default Canvas scale factor. Please add/update a test that configures the Canvas scale factor (e.g., via CanvasScaler) and asserts the drag duration/step size is unaffected.

Copilot uses AI. Check for mistakes.
// Wait for delay before drop
await UniTask.Delay(TimeSpan.FromSeconds(_delayBeforeDrop), ignoreTimeScale: true,
Expand Down
11 changes: 3 additions & 8 deletions Runtime/Operators/UguiSwipeOperator.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2023-2025 Koji Hasegawa.
// Copyright (c) 2023-2026 Koji Hasegawa.
// This software is released under the MIT License.

using System;
Expand Down Expand Up @@ -179,24 +179,19 @@ public async UniTask OperateAsync(GameObject gameObject, Vector2 direction,
raycastResult = RaycastResultExtensions.CreateFrom(gameObject, GetScreenPoint);
}

var canvas = gameObject.GetComponentInParent<Canvas>();
var scaleFactor = canvas != null ? canvas.scaleFactor : 1f;
var scaledDistance = _swipeDistance * scaleFactor;
var scaledSpeed = (int)(_swipeSpeed * scaleFactor);

// Log direction and distance
var operationLogger = new OperationLogger(gameObject, this, Logger, ScreenshotOptions);
operationLogger.Properties.Add("position", raycastResult.screenPosition);
operationLogger.Properties.Add("direction", direction);
await operationLogger.Log();

var normalizedDirection = direction.normalized;
var destination = raycastResult.screenPosition + normalizedDirection * scaledDistance;
var destination = raycastResult.screenPosition + normalizedDirection * _swipeDistance;

using (var simulator = new PointerDragEventSimulator(gameObject, raycastResult, Logger))
{
simulator.BeginDrag();
await simulator.DragAsync(destination, scaledSpeed, cancellationToken);
await simulator.DragAsync(destination, _swipeSpeed, cancellationToken);
simulator.EndDrag(out _, out _);
Comment on lines 191 to 195
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Behavior change (removing Canvas scale-factor adjustments for swipe speed/distance) isn’t covered by tests that exercise non-default Canvas scale factors. Please add/update tests to validate swipe duration/step size remains consistent when the Canvas scale factor differs (e.g., via CanvasScaler).

Copilot uses AI. Check for mistakes.
}
}
Expand Down
Loading