Skip to content
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

Setting min, max, minValue, maxValue at time #77

Open
RafaRuiz opened this issue Jan 11, 2018 · 1 comment
Open

Setting min, max, minValue, maxValue at time #77

RafaRuiz opened this issue Jan 11, 2018 · 1 comment

Comments

@RafaRuiz
Copy link

Hello, I created a modal that tells me what's the minimum I can reach (min), maximum I can reach (max), minimum current value (thumbs[0].value) and maximum current value (thumbs[1].value).

I wasn't aware about the order, but I was doing the following:
multiSlider.min = filterModel.minPrice!!.toInt()
multiSlider.max = filterModel.maxPrice!!.toInt()

    multiSlider.getThumb(0).value = filterModel.minPriceChosen ?: multiSlider.min
    multiSlider.getThumb(1).value = filterModel.maxPriceChosen ?: multiSlider.max

which makes sense

in case min = 2, max = 2000, minimumCurrent = 200 and maximumCurrent = 1000 it was setting the minimumCurrent to 100 because the maximum is updated later and 200 would be greater than the max of the thumb.

I believe there should be a method for better understanding, code clean and etcetera that for 2 thumbs, you can set all these 4 vars.

The solution for me was doing it the opposite way:

    multiSlider.max = filterModel.maxPrice!!.toInt()
    multiSlider.min = filterModel.minPrice!!.toInt()

    multiSlider.getThumb(1).value = filterModel.maxPriceChosen ?: multiSlider.max
    multiSlider.getThumb(0).value = filterModel.minPriceChosen ?: multiSlider.min
@Sabboo
Copy link

Sabboo commented Oct 15, 2019

I debugged a lot trying to figure out what's going on until I found this solution.
It worked as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants