Skip to content

Fix drag and swipe speed to not respect scale factor#292

Merged
nowsprinting merged 1 commit intomasterfrom
fix/not-respect-scale-factor
Feb 6, 2026
Merged

Fix drag and swipe speed to not respect scale factor#292
nowsprinting merged 1 commit intomasterfrom
fix/not-respect-scale-factor

Conversation

@nowsprinting
Copy link
Copy Markdown
Owner

Before

Drag and swipe speed respects the scale factor.

refs #256

After

Drag and swipe speed NOT respects the scale factor.
Because the duration should be constant regardless of resolution.

Copilot AI review requested due to automatic review settings February 6, 2026 21:24
@github-actions github-actions bot added the bug Something isn't working label Feb 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates uGUI drag-and-drop and swipe operators so drag/swipe motion timing no longer changes with the parent Canvas scale factor, keeping interaction duration consistent across different resolutions.

Changes:

  • Remove Canvas scaleFactor adjustments from swipe speed and distance calculations.
  • Remove Canvas scaleFactor adjustments from drag-and-drop speed.
  • Update copyright headers to 2026.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
Runtime/Operators/UguiSwipeOperator.cs Removes Canvas scale-factor-based scaling for swipe destination distance and DragAsync speed.
Runtime/Operators/UguiDragAndDropOperator.cs Removes Canvas scale-factor-based scaling for DragAsync speed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 191 to 195
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 _);
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.
Comment on lines 217 to 221
using (var simulator = new PointerDragEventSimulator(gameObject, raycastResult, Logger))
{
simulator.BeginDrag();
await simulator.DragAsync(destination, scaledSpeed, cancellationToken);
await simulator.DragAsync(destination, _dragSpeed, cancellationToken);

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.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 6, 2026

Code Metrics Report

master (9f29b44) #292 (e2d48f0) +/-
Code to Test Ratio 1:1.3 1:1.3 +0.0
Details
  |                    | master (9f29b44) | #292 (e2d48f0) | +/-  |
  |--------------------|------------------|----------------|------|
+ | Code to Test Ratio |            1:1.3 |          1:1.3 | +0.0 |
  |   Code             |             4628 |           4621 |   -7 |
  |   Test             |             6186 |           6186 |    0 |

Reported by octocov

@nowsprinting nowsprinting merged commit ed50f15 into master Feb 6, 2026
20 checks passed
@nowsprinting nowsprinting deleted the fix/not-respect-scale-factor branch February 6, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants