SliderBuilder intial value wrong

Hello, i have the problem that a nifty-slider doesn’t use the initial value that i want it to use.

control(new SliderBuilder("sldLaenge", false){{  
    initial(1035f);
    min(375f);
    max(4665f);
    stepSize(330.0f);
    buttonStepSize(330.0f);
}});

So when I move the slider to the next value, the return value should be 1035+330=1365. But I get 1320 an I don’t know why. I read the value like this:

@NiftyEventSubscriber(id="sldLaenge")
public void onSliderChange(final String id,final SliderChangedEvent event) {
    System.out.println("event.getValue= " + event.getSlider().getValue());
}

What am i doing wrong? Changing the min and max doesn’t have any effect.

well 1320 is a multiple of 330 and lookig at the code of

you can see in line 116 that when setting a new value, it’s first ensured to be in range min - max, and afterwards ensured to be a multiple of the stepsize. however the second check is not offset by the min value so the steps dont begin at min but at 0 instead, meaning in a case like yours you cannot actually get the min value that you set because its not a multiple of the stepsize and also cannot get 1365 but get 1320 instead.

Thank you. I understand this. But in my eyes this is a unnecessary limitation of the slider. What if I need the values 121,131,141,151 for example. I will have to use 0,1,2,3 and do a mapping.

well one could consider it a bug, when they expect the stepSize to start at the specified minValue. on the other hand, if you want a stepSize of say 100, but for some reason the value should not go below 50, you would still expect values like 100 and 200 to appear instead of 50, 150 etc
i never really used nifty but im sure you can provide a custom control that is basically a copy and paste of the original slider and adjust it to behave as you want