Unity-Technologies / InputSystem

An efficient and versatile input system for Unity.
Other
1.43k stars 310 forks source link

FIX: ISXB-808 scroll wheel event system different than ui builder #1959

Closed benoitalain closed 3 months ago

benoitalain commented 3 months ago

Description

Fixes ISXB-808. Based on recently landed trunk PR.

Details of what was changed and the thought process can be found in these Google Documents:

Changes made

This PR makes scroll delta values reaching UI Toolkit as uniform as possible between different platforms and between editor or runtime. The standard used is that of the Windows Editor, i.e. the same text in an TextField should scroll by the same amount in an EditorWindow than in a runtime panel, with or without uGUI interoperability.

Since legacy input is still supported in Unity 6, we make the InputSystem match the scaling of the legacy input by default. However, we also introduce a new scrollDeltaPerTick property API to allow users to fall back on the scroll factor that we had in InputSystem package version <= 1.4, by setting it to a value of 6.

Testing

Manually tested the changes. Modified existing unit test and added one for the newly introduced API.

Risk

This PR yet again changes the scroll factor for existing user projects without any notification about it. Fortunately, they can very easily tweak it back to whatever they had, but this may still come as a surprise to them. On the other hand, the new setup is much much better for new projects, and for existing projects it's probably better too, allowing users to remove their workaround for the previously bad scroll factors.

Checklist

Before review:

During merge:

After merge:

unity-cla-assistant commented 3 months ago

CLA assistant check
All committers have signed the CLA.