summaryrefslogtreecommitdiff
path: root/scene/gui/slider.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/slider.cpp')
-rw-r--r--scene/gui/slider.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index b6292c544b..78b5dabeb4 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -50,9 +50,9 @@ void Slider::_input_event(InputEvent p_event) {
grab.pos=orientation==VERTICAL?mb.y:mb.x;
double max = orientation==VERTICAL ? get_size().height : get_size().width ;
if (orientation==VERTICAL)
- set_val( ( ( -(double)grab.pos / max) * ( get_max() - get_min() ) ) + get_max() );
+ set_unit_value( 1 - ((double)grab.pos / max) );
else
- set_val( ( ( (double)grab.pos / max) * ( get_max() - get_min() ) ) + get_min() );
+ set_unit_value((double)grab.pos / max);
grab.active=true;
grab.uvalue=get_unit_value();
} else {