diff --git a/Runtime/Operators/UguiDragAndDropOperator.cs b/Runtime/Operators/UguiDragAndDropOperator.cs index ba60e8e..bf38c60 100644 --- a/Runtime/Operators/UguiDragAndDropOperator.cs +++ b/Runtime/Operators/UguiDragAndDropOperator.cs @@ -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; @@ -207,10 +207,6 @@ public async UniTask OperateAsync(GameObject gameObject, Vector2 destination, raycastResult = RaycastResultExtensions.CreateFrom(gameObject, GetScreenPoint); } - var canvas = gameObject.GetComponentInParent(); - 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); @@ -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); // Wait for delay before drop await UniTask.Delay(TimeSpan.FromSeconds(_delayBeforeDrop), ignoreTimeScale: true, diff --git a/Runtime/Operators/UguiSwipeOperator.cs b/Runtime/Operators/UguiSwipeOperator.cs index a7ddfc9..8c7b10a 100644 --- a/Runtime/Operators/UguiSwipeOperator.cs +++ b/Runtime/Operators/UguiSwipeOperator.cs @@ -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; @@ -179,11 +179,6 @@ public async UniTask OperateAsync(GameObject gameObject, Vector2 direction, raycastResult = RaycastResultExtensions.CreateFrom(gameObject, GetScreenPoint); } - var canvas = gameObject.GetComponentInParent(); - 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); @@ -191,12 +186,12 @@ public async UniTask OperateAsync(GameObject gameObject, Vector2 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 _); } }