sliderPos = Math.max(0, sliderPos);\r
sliderPos = Math.min(sliderPosHeight - knobHeight, sliderPos) + bg.getBottomHeight();\r
}\r
+\r
float knobHeightHalf = knobHeight * 0.5f;\r
if (knobBefore != null) {\r
knobBefore.draw(batch, x + (int)((width - knobBefore.getMinWidth()) * 0.5f), y, knobBefore.getMinWidth(),\r
sliderPos = Math.max(0, sliderPos);\r
sliderPos = Math.min(sliderPosWidth - knobWidth, sliderPos) + bg.getLeftWidth();\r
}\r
+\r
float knobHeightHalf = knobHeight * 0.5f;\r
if (knobBefore != null) {\r
knobBefore.draw(batch, x, y + (int)((height - knobBefore.getMinHeight()) * 0.5f), (int)(sliderPos + knobHeightHalf),\r
\r
/** If {@link #setAnimateDuration(float) animating} the slider value, this returns the value current displayed. */\r
public float getVisualValue () {\r
- if (animateTime > 0) return animateInterpolation.apply(animateFromValue, value, animateTime / animateDuration);\r
+ if (animateTime > 0) return animateInterpolation.apply(animateFromValue, value, 1 - animateTime / animateDuration);\r
return value;\r
}\r
\r
value = MathUtils.clamp(Math.round(value / stepSize) * stepSize, min, max);\r
float oldValue = this.value;\r
if (value == oldValue) return;\r
+ float oldVisualValue = getVisualValue();\r
this.value = value;\r
ChangeEvent changeEvent = Pools.obtain(ChangeEvent.class);\r
if (fire(changeEvent))\r
this.value = oldValue;\r
else if (animateDuration > 0) {\r
+ animateFromValue = oldVisualValue;\r
animateTime = animateDuration;\r
- animateFromValue = getVisualValue();\r
}\r
Pools.free(changeEvent);\r
}\r
this.knob = style.knob;\r
}\r
}\r
-}\r
+}
\ No newline at end of file