Skip to content

Commit 230cfd6

Browse files
benoitalainduckets
andauthored
FIX: ISXB-808 scroll wheel event system different than ui builder (#1959)
* Fixed ISXB-766, ISXB-808, ISXB-704, conditional to trunk PR #49932. * Updated for latest trunk PR changes (5f81a20). * Reverted fix for ISXB-808 and partly ISXB-766. Kept ISBX-704 fix. * Added scroll wheel normalization tests for UI and InputForUI. * Recommended changes from @ekcoh. Added more #if UNITY_6000_0_OR_NEWER. * Added missing #if UNITY_6000_0_OR_NEWER in InputForUITests * Added changes to CHANGELOG.md * Override BaseInputModule.scrollWheelDeltaPerTick to 6 for InputSystem. * Improved Scroll Wheel Delta UI tooltip text * Improved API docs for ScrollDeltaBehavior * fixed bad xml tag * Replaced UNITY_6000_0_OR_NEWER by asmdef versionDefines >= 6000.0.9 * Added InputSystemUIInputModule.scrollDeltaPerTick for more flexibility. * Fixed missed #if replacement in UITests. * formatting * Fixed UNITY_INPUT_SYSTEM_INPUT_MODULE_SCROLL_DELTA unity version in asmdef. * Added changelog entry for new InputSystemUIInputModule.scrollDeltaPerTick. * Added changelog entry for ISXB-766 fix. * Added safety against division by 0 for scrollDeltaPerTick. Added test. * formatting * Recommended change from @Joao-Freire. Adjust minimal delta per tick. * Fixed compile error in InputSystemProvider when not on >= 6000.0.11f1. * Improved docs for scrollDeltaPerTick * fixed typo * formatting * Moved fixes in changelog to match [Unreleased] tag * Bump version to 1.10.0 * Fixed Editor_HelpUrlsPointToCurrentVersion --------- Co-authored-by: Ben Pitt <benp@unity3d.com>
1 parent da43b3c commit 230cfd6

15 files changed

Lines changed: 94 additions & 19 deletions

File tree

Assets/Samples/InGameHints/InGameHintsActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.9.1
4+
// version 1.10.0
55
// from Assets/Samples/InGameHints/InGameHintsActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Assets/Samples/SimpleDemo/SimpleControls.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.9.1
4+
// version 1.10.0
55
// from Assets/Samples/SimpleDemo/SimpleControls.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Assets/Tests/InputSystem/InputActionCodeGeneratorActions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputActionCodeGenerator
4-
// version 1.9.1
4+
// version 1.10.0
55
// from Assets/Tests/InputSystem/InputActionCodeGeneratorActions.inputactions
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Assets/Tests/InputSystem/Plugins/UITests.cs

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ public IEnumerator UI_CanDriveUIFromPointer(string deviceLayout, UIPointerType p
10371037
Assert.That(scene.rightChildReceiver.events[0].pointerData.pointerId, Is.EqualTo(pointerId));
10381038
Assert.That(scene.rightChildReceiver.events[0].pointerData.position, Is.EqualTo(thirdScreenPosition).Using(Vector2EqualityComparer.Instance));
10391039
Assert.That(scene.rightChildReceiver.events[0].pointerData.delta, Is.EqualTo(Vector2.zero));
1040-
Assert.That(scene.rightChildReceiver.events[0].pointerData.scrollDelta, Is.EqualTo(Vector2.one).Using(Vector2EqualityComparer.Instance));
1040+
Assert.That(scene.rightChildReceiver.events[0].pointerData.scrollDelta, Is.EqualTo(Vector2.one * scene.uiModule.scrollDeltaPerTick).Using(Vector2EqualityComparer.Instance));
10411041
Assert.That(scene.rightChildReceiver.events[0].pointerData.pointerEnter, Is.SameAs(scene.rightGameObject));
10421042
Assert.That(scene.rightChildReceiver.events[0].pointerData.pointerDrag, Is.Null);
10431043
Assert.That(scene.rightChildReceiver.events[0].pointerData.pointerPress, Is.Null);
@@ -1201,16 +1201,40 @@ public IEnumerator UI_ReceivesNormalizedScrollWheelDelta(float scrollWheelDeltaP
12011201
Set(mouse.scroll, new Vector2(0, scrollWheelDeltaPerTick));
12021202
yield return null;
12031203

1204-
// UI should receive scroll delta in the [-1, 1] range.
1204+
// UI should receive scroll delta in the range defined by InputSystemUIInputModule.
12051205
Assert.That(scene.leftChildReceiver.events,
12061206
EventSequence(
12071207
OneEvent("type", EventType.Scroll),
12081208
AllEvents("position", scene.From640x480ToScreen(100, 100)),
1209-
AllEvents("scrollDelta", Vector2.up)
1209+
AllEvents("scrollDelta", Vector2.up * scene.uiModule.scrollDeltaPerTick)
12101210
)
12111211
);
12121212
}
12131213

1214+
#endif
1215+
1216+
#if UNITY_INPUT_SYSTEM_INPUT_MODULE_SCROLL_DELTA
1217+
[TestCase(1)]
1218+
[TestCase(2)]
1219+
[Category("UI")]
1220+
public void UI_ConvertPointerEventScrollDeltaToTicks_AppliesScrollWheelMultiplier(float multiplier)
1221+
{
1222+
var scene = CreateTestUI();
1223+
scene.uiModule.scrollDeltaPerTick = multiplier;
1224+
var ticks = scene.uiModule.ConvertPointerEventScrollDeltaToTicks(Vector2.one);
1225+
Assert.That(ticks, Is.EqualTo(Vector2.one / multiplier).Within(0.001f));
1226+
}
1227+
1228+
[TestCase(0)]
1229+
[TestCase(1)]
1230+
[Category("UI")]
1231+
public void UI_ConvertPointerEventScrollDeltaToTicks_ReturnsZeroIfScrollDeltaPerTickIsZero(float delta)
1232+
{
1233+
var scene = CreateTestUI();
1234+
scene.uiModule.scrollDeltaPerTick = 0;
1235+
Assert.That(scene.uiModule.ConvertPointerEventScrollDeltaToTicks(Vector2.one * delta), Is.EqualTo(Vector2.zero));
1236+
}
1237+
12141238
#endif
12151239

12161240
[UnityTest]

Assets/Tests/InputSystem/Unity.InputSystem.Tests.asmdef

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
"name": "Unity",
5151
"expression": "6000.0.9",
5252
"define": "UNITY_INPUT_SYSTEM_PLATFORM_SCROLL_DELTA"
53+
},
54+
{
55+
"name": "Unity",
56+
"expression": "6000.0.11",
57+
"define": "UNITY_INPUT_SYSTEM_INPUT_MODULE_SCROLL_DELTA"
5358
}
5459
],
5560
"noEngineReferences": false

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ however, it has to be formatted properly to pass verification tests.
1010

1111
## [Unreleased] - yyyy-mm-dd
1212

13+
### Fixed
14+
- Fixed default scroll speed in uGUI being slower than before. [ISXB-766](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-766)
15+
16+
### Added
17+
- Added `InputSystemUIInputModule.scrollDeltaPerTick` property, a customizable multiplicative factor applied to the scroll wheel speed before it is sent to UI components. Note that this has no effect on UI Toolkit content, only uGUI.
18+
1319
## [1.9.0] - 2024-07-15
1420

1521
### Changed
@@ -40,16 +46,13 @@ however, it has to be formatted properly to pass verification tests.
4046
- Fixed deletion of last composite part raising an exception. [ISXB-804](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-804)
4147
- Fixed an issue related to Visualizers sample where exceptions would be thrown by InputActionVisualizer and InputControlVisualizer when entering play-mode if added as components to a new `GameObject`.
4248
- Fixed an issue with InputAction Asset editor where invalid ControlScheme names with only spaces could be entered. [ISXB-547](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-547).
49+
- Fixed deletion of last composite part raising an exception. [ISXB-804](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-804)
4350

4451
### Added
4552
- Added additional device information when logging the error due to exceeding the maximum number of events processed
4653
set by `InputSystem.settings.maxEventsBytesPerUpdate`. This additional information is available in development builds
4754
only.
48-
- Fixed deletion of last composite part raising an exception. [ISXB-804](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-804)
4955
- Expanded editor and build insight analytics to cover ``.inputactions` asset editor usage, `InputSettings` and common component configurations.
50-
51-
### Changed
52-
- Changed `DualSenseHIDInputReport` from internal to public visibility
5356
- Added Input Setting option allowing to keep platform-specific scroll wheel input values instead of automatically converting them to a normalized range.
5457

5558
## [1.8.2] - 2024-04-29

Packages/com.unity.inputsystem/InputSystem/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static partial class InputSystem
1616
// Keep this in sync with "Packages/com.unity.inputsystem/package.json".
1717
// NOTE: Unfortunately, System.Version doesn't use semantic versioning so we can't include
1818
// "-preview" suffixes here.
19-
internal const string kAssemblyVersion = "1.9.1";
20-
internal const string kDocUrl = "https://docs.unity3d.com/Packages/com.unity.inputsystem@1.9";
19+
internal const string kAssemblyVersion = "1.10.0";
20+
internal const string kDocUrl = "https://docs.unity3d.com/Packages/com.unity.inputsystem@1.10";
2121
}
2222
}

Packages/com.unity.inputsystem/InputSystem/Devices/Precompiled/FastKeyboard.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputLayoutCodeGenerator
4-
// version 1.9.1
4+
// version 1.10.0
55
// from "Keyboard" layout
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Packages/com.unity.inputsystem/InputSystem/Devices/Precompiled/FastMouse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputLayoutCodeGenerator
4-
// version 1.9.1
4+
// version 1.10.0
55
// from "Mouse" layout
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

Packages/com.unity.inputsystem/InputSystem/Devices/Precompiled/FastTouchscreen.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//------------------------------------------------------------------------------
22
// <auto-generated>
33
// This code was auto-generated by com.unity.inputsystem:InputLayoutCodeGenerator
4-
// version 1.9.1
4+
// version 1.10.0
55
// from "Touchscreen" layout
66
//
77
// Changes to this file may cause incorrect behavior and will be lost if

0 commit comments

Comments
 (0)