Fixed an issue with adjusting SliderComponent values using the controller D-pad.

This commit is contained in:
Leon Styhre 2021-01-23 15:43:48 +01:00
parent d75d2f41d1
commit 0dfe52586c

View file

@ -40,21 +40,26 @@ SliderComponent::SliderComponent(
bool SliderComponent::input(InputConfig* config, Input input) bool SliderComponent::input(InputConfig* config, Input input)
{ {
if (config->isMappedLike("left", input)) { if (input.value != 0) {
if (input.value) if (config->isMappedLike("left", input)) {
setValue(mValue - mSingleIncrement); if (input.value)
setValue(mValue - mSingleIncrement);
mMoveRate = input.value ? -mSingleIncrement : 0; mMoveRate = input.value ? -mSingleIncrement : 0;
mMoveAccumulator = -MOVE_REPEAT_DELAY; mMoveAccumulator = -MOVE_REPEAT_DELAY;
return true; return true;
}
if (config->isMappedLike("right", input)) {
if (input.value)
setValue(mValue + mSingleIncrement);
mMoveRate = input.value ? mSingleIncrement : 0;
mMoveAccumulator = -MOVE_REPEAT_DELAY;
return true;
}
} }
if (config->isMappedLike("right", input)) { else {
if (input.value) mMoveRate = 0;
setValue(mValue + mSingleIncrement);
mMoveRate = input.value ? mSingleIncrement : 0;
mMoveAccumulator = -MOVE_REPEAT_DELAY;
return true;
} }
return GuiComponent::input(config, input); return GuiComponent::input(config, input);