1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-03 16:55:53 +00:00

Merge pull request #3049 from eska014/fix-exp-slider

Fix setting Sliders in exponential mode
This commit is contained in:
Rémi Verschelde
2015-12-13 10:10:25 +01:00

View File

@@ -50,9 +50,9 @@ void Slider::_input_event(InputEvent p_event) {
grab.pos=orientation==VERTICAL?mb.y:mb.x; grab.pos=orientation==VERTICAL?mb.y:mb.x;
double max = orientation==VERTICAL ? get_size().height : get_size().width ; double max = orientation==VERTICAL ? get_size().height : get_size().width ;
if (orientation==VERTICAL) if (orientation==VERTICAL)
set_val( ( ( -(double)grab.pos / max) * ( get_max() - get_min() ) ) + get_max() ); set_unit_value( 1 - ((double)grab.pos / max) );
else else
set_val( ( ( (double)grab.pos / max) * ( get_max() - get_min() ) ) + get_min() ); set_unit_value((double)grab.pos / max);
grab.active=true; grab.active=true;
grab.uvalue=get_unit_value(); grab.uvalue=get_unit_value();
} else { } else {