MultiSlider icon indicating copy to clipboard operation
MultiSlider copied to clipboard

Support for multiple snap step sizes

Open leovido opened this issue 2 years ago • 1 comments

Description:

Support for multiple snap step sizes on one slider, e.g 2 and 4 The x value represents a size of 2. The y value represents a size of 4.

image

Here, snap step size should be 2. [x] - [x] - [x] - [x] - [ ] - [y] - [ ] - [y]

Here, snap step size should be 4. Allowing the first thumb to move to the next y ignoring the blank node which would be a 2 step. [x] - [x] - [x] - [x] - [ ] - [y] - [ ] - [y]

At the moment, there's only support for one step size and we were wondering if it would be possible to snap onto bigger gaps.

Problems we encountered when trying to implement this myself:

We've added an if statement to change the snap step size to 2 or 4 depending on where the second thumb is. This has caused the following problems.

  1. When we try to move the first thumb onto the next y node, it snaps in between because it's making a size 2 step. [x] - [x] - [x] - [x] - [ ] - [y] - [ ] - [y] [x] - [x] - [x] - [x] - [!] - [y] - [ ] - [y]

  2. When moving the last y node to the previous y, the x moves as well.

[x] - [x] - [x] - [x] - [y] - [y] [x] - [x] - [x] - [x] - [y] - [y]

We wanted to check if there is a more efficient way of doing this as we've spent lots of time trying to achieve the desired behaviour and creating a new Slider from UIControl proves to be somehow tricky for our team.

Thank you, Christian

leovido avatar Jan 20 '22 20:01 leovido

Would you say more about what you are trying to achieve? Should the snap values be [2, 2, 2, 4, 4]? Or should they change when the rightmost thumb moves?

yonat avatar Jan 21 '22 19:01 yonat

Added snapValues in version 2.0.0.

yonat avatar Mar 12 '23 08:03 yonat