[webkit-changes] [WebKit/WebKit] 7ad0df: [GameController] Correctly handle magnitude values...
Chris Dumez
noreply at github.com
Tue Jan 17 09:39:41 PST 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7ad0df2f473f50c09f2782e7cd12fdb44111d66f
https://github.com/WebKit/WebKit/commit/7ad0df2f473f50c09f2782e7cd12fdb44111d66f
Author: Chris Dumez <cdumez at apple.com>
Date: 2023-01-17 (Tue, 17 Jan 2023)
Changed paths:
M Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEffect.mm
Log Message:
-----------
[GameController] Correctly handle magnitude values passed to GamepadHapticActuator.playEffect()
https://bugs.webkit.org/show_bug.cgi?id=250616
Reviewed by Youenn Fablet.
Correctly handle magnitude values passed to GamepadHapticActuator.playEffect()
when passing them to the GameController framework.
We noticed different Gamepad vibration results between Safari and Chrome for
the same magnitude values. One obvious difference was that values below 0.1
didn't result in any vibration in Safari but did in Chrome.
In 258874 at main, I made an attempt to address this by scaling the input
magnitude (in the range [0; 1]) to be in the range [0.1; 1] in order to
always get a vibration if the magnitude value is not zero.
However, I have since heard back from GameController developers who have
indicating that we should be using the square root of the magnitude,
instead of the raw magnitude value. This is due to the fact that the
GameController framework doesn't use the input value as-is internally.
I am therefore updating our code to use the suggested approach. I have
validated on XBox Cloud that the level of vibration feels similar between
Safari and Chrome.
* Source/WebCore/platform/gamepad/cocoa/GameControllerHapticEffect.mm:
(WebCore::magnitudeToIntensity):
Canonical link: https://commits.webkit.org/258988@main
More information about the webkit-changes
mailing list