Skip to content

RangeSelector StepFrequency doesn't behave properly at larger values #3476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
michael-hawker opened this issue Sep 14, 2020 · 1 comment
Open
Assignees
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior good first issue Issues identified as good for first-time contributors
Milestone

Comments

@michael-hawker
Copy link
Member

Describe the bug

In the sample app, with the example range between 0-100, values over 30 (40, 50) etc... don't act properly.

For instance, 30 snaps at 30 and 60 but not 90.
40 snaps at 40, but not 80
60 doesn't snap...

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to RangeSelector sample in sample app.
  2. Go to XAML tab
  3. Set StepFrequency to a custom value
  4. See behavior above

Expected behavior

30 should still snap at 30, 60, 90
40 should snap at 40 & 80
60 should snap at 60

Environment

Sample App

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [x] May 2020 Update (19041)
- [ ] Insider Build (build number: )

Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Additional context

Found when investigating #3473, FYI @hansmbakker

@michael-hawker michael-hawker added bug 🐛 An unexpected issue that highlights incorrect behavior help wanted Issues identified as good community contribution opportunities good first issue Issues identified as good for first-time contributors labels Sep 14, 2020
@michael-hawker michael-hawker added this to the 7.0 milestone Sep 14, 2020
@skendrot
Copy link
Contributor

I took a look and this is happening because of this line

            else if (newValue > Maximum || Maximum - newValue < StepFrequency)
            {
                return Maximum;
            }

For large values performing the Maximum - newValue will be less than StepFrequency.
Example: 100 - 90 = 10 which is less than 30.
I removed the or for the else statement and the values go up properly but then we see another issue. The max thumb doesn't calculate properly. Instead of going from 100 -> 70 -> 40 -> 10 it goes 100 -> 90 -> 60 -> 30. So we would need a new calculation method for finding the max thumb value as well.

@skendrot skendrot self-assigned this Sep 23, 2020
skendrot added a commit to skendrot/UWPCommunityToolkit that referenced this issue Sep 23, 2020
@ghost ghost removed the help wanted Issues identified as good community contribution opportunities label Feb 25, 2021
michael-hawker pushed a commit to michael-hawker/UWPCommunityToolkit that referenced this issue Mar 8, 2021
@ghost ghost removed the In-PR 🚀 label Mar 8, 2021
@michael-hawker michael-hawker modified the milestones: 7.0, 7.1 Mar 8, 2021
@ghost ghost removed the in progress 🚧 label Mar 8, 2021
@ghost ghost removed this from the 7.1 milestone Aug 31, 2021
@michael-hawker michael-hawker added this to the 7.2/8.0? milestone Aug 31, 2021
@Rosuavio Rosuavio removed their assignment Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An unexpected issue that highlights incorrect behavior good first issue Issues identified as good for first-time contributors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants