BeppiMenozzi / Knob

A seekbar, in form of a fully customizable rotating knob selector with discrete values for Android. Replaces radio buttons, seekbars, integer value inputs, progress bars and even ViewPager indicators.
143 stars 50 forks source link

When using minAngle and maxAngle, snap behaviour is odd #11

Open thalisvilela opened 7 years ago

thalisvilela commented 7 years ago

when setting kMaxAngle and kMinAngle, snapping to minAngle is OK, and when you go "before" the min angle, it tolerates quite well, but when just past the maxAngle, it snaps back to min angle with no tolerance.

thalisvilela commented 7 years ago

If i set the kNumberOfStates = 100 for example, when i scroll it to the end, and it hits 100, it moves to the initial position, if i setState(100) programmatically, it moves to the initial position as well

faxinadu commented 6 years ago

same issue here... any workaround?

faxinadu commented 6 years ago

hmmm nothing yet? such a wonderful library but with this issue i can not use it :(

moskito-s commented 4 years ago

Quick and dirty workaround to keep knob from snapping back to 0 if it hits 100

 int lastState = 0;
 public void onState(int state) {
                if(state < 10 && lastState > 90) {
                    lastState = state;
                    knob.setState(100);
                }
                else lastState = state;
            }