settings: Widen the joystick deadzone slider to the supported range - #336
Merged
Merged
Conversation
PTZControls::setJoystickDeadzone() already clamps the value to the range 0.0 - 0.5, but the settings slider was constrained to a maximum of 0.15, so anything above that was unreachable from the UI. Users with worn or drifting analogue sticks need a larger deadzone than that. The narrower slider range also silently overwrote a larger value that had been set by editing the configuration by hand. DoubleSlider maps the double onto an integer range, so setDoubleConstraints(0.01, 0.15, 0.01, 0.20) calls setValue(19) on a slider whose maximum is 14. QSlider clamps that to 14, emits valueChanged(), and the resulting doubleValChanged(0.15) feeds straight back into setJoystickDeadzone(). Merely opening the settings page was therefore enough to reset the value, which is what the reporter of glikely#329 observed. Raise the slider maximum to 0.5 so that the UI exposes the range the implementation already supports, rather than introducing another arbitrary limit. Minimum and step size are unchanged. Closes glikely#329 Signed-off-by: Eddy Weiz <eddyweiz@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #329.
PTZControls::setJoystickDeadzone()already clamps to 0.0 - 0.5, but the settings slider was constrained to a maximum of 0.15, so the upper half of the supported range was unreachable from the UI.The narrow slider range also silently overwrote a larger value set by editing
config.jsonby hand, which is what the reporter of #329 observed.DoubleSlidermaps the double onto an integer range, andint(total / minStep)truncates:int((0.15 - 0.01) / 0.01)is 13, not 14, because the division yields 13.999999999999998. Opening the settings page therefore calledsetValue(49)on a slider whose maximum is 13, QSlider clamped it, and the resultingdoubleValChanged()fed 0.14 straight back intosetJoystickDeadzone(). That also explains the reporter's "previous max of .14" — the effective maximum really was 0.14, not the 0.15 in the source.Testing
Built from source and run against OBS Studio 32.2.1 (Qt 6.11.1) on Windows. Both builds are this branch and current
main, so the only difference is this one line. The plugin logs its version on load, which I checked before each measurement.joystick_deadzoneinconfig.jsonafterwardsv0.18.3-rc1-65-g7da2f7d0.5main,v0.18.3-rc1-64-g1b9fda20.14The second row is the counter-proof and the reported bug at the same time: I did not touch the slider. The stored
0.5was overwritten with0.14merely by opening the settings page, and persisted on exit.One limitation: I have no controller with a drifting stick here, so what I verified is the range and the persistence, not that a deadzone of 0.5 cures a particular device.