Bug Fix: Always fire rangeValueChanged event when thumb is dragged #6680
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.
Motivation for features / changes
The rangeInputComponent was not triggering the rangeValueChanged event when dragging the slider thumb. This fixes that bug.
Technical description of changes
The slider changes the value of lowerValue and upperValue while the thumb is being dragged. When dragging is stopped the component used to ensure the value sent in the event was different from the previous values by comparing it to the lowerValue and upperValue. This check always failed as the component now keeps these values up to date. It should be noted that if these values are not kept up to date the input fields do not update while dragging.
To solve I simply call the event every time without doing the check. If the value has not changed we update the state to the same value. This does cause an unnecessary repaint but that seems reasonable for when I user clicks the thumb and does not move it.
I decided I could simply ignore the value in the event as the lowerValue and upperValue properties are already updated. This simplifies the code by having one place to call no matter which thumb is dragged.