diff --git a/arc-core/src/arc/scene/ui/ProgressBar.java b/arc-core/src/arc/scene/ui/ProgressBar.java index 4720c83b9..170a70793 100644 --- a/arc-core/src/arc/scene/ui/ProgressBar.java +++ b/arc-core/src/arc/scene/ui/ProgressBar.java @@ -234,12 +234,12 @@ protected float getKnobPosition(){ /** * Sets the progress bar position, rounded to the nearest step size and clamped to the minimum and maximum values. - * {@link #clamp(float)} can be overridden to allow values outside of the progress bar's min/max range. * @return false if the value was not changed because the progress bar already had the value or it was canceled by a * listener. */ - public boolean setValue(float value){ - value = clamp(Math.round(value / stepSize) * stepSize); + public boolean setValue(float value, boolean clampValue){ + float val = Math.round(value / stepSize) * stepSize; + value = clampValue ? clamp(val) : val; float oldValue = this.value; if(value == oldValue) return false; float oldVisualValue = getVisualValue(); @@ -255,10 +255,13 @@ else if(animateDuration > 0){ Pools.free(changeEvent); return !cancelled; } + + public boolean setValue(float value){ + return setValue(value, true); + } /** - * Clamps the value to the progress bar's min/max range. This can be overridden to allow a range different from the progress - * bar knob's range. + * Clamps the value to the progress bar's min/max range. */ protected float clamp(float value){ return Mathf.clamp(value, min, max);