Make one pixel beyond the scrollbar thumb react correctly to clicks #505
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.
The detection of scrollbar track clicks used the scrollbar thumb's "raw" (floating-point) bounds. However, this misses the first pixel after the thumb, because, for example, the value
10
is in the floating point range0..10.0
, but the actual pixel bounds of the thumb for that range would not include the 10th pixel (the size of the thumb would be10px
, so its pixel range would be0px..9px
).Proposed Changes
Size the scrollbar in integer pixels and use that size when detecting clicks on the scrollbar track (outsize the thumb).
Testing
Test: Added a new unit test to test the last pixel (and one beyond) of the thumb, and fixed other tests which used to pass because the one-pixel-beyond the thumb was neither clickable nor draggable.