oli107 / material-range-bar

Android widget for selecting a range of values.
Apache License 2.0
1.68k stars 370 forks source link

Select the nearest thumb when thumbs overlap #188

Open nispr opened 4 years ago

nispr commented 4 years ago

Issue In a RangeBar, when thumb target zones overlap, there's always the left thumb selected. This results in an unpleasant user experience.

NearbyThumbsIssueDemonstration

Solution Simple: when a touch-down event has an x offset included in both target zones, check which thumb is nearer to the touch's x.

NearbyThumbsSolutionDemonstration