diff options
author | Ralf Hölzemer <r.hoelzemer@posteo.de> | 2014-09-19 00:52:05 +0200 |
---|---|---|
committer | Ralf Hölzemer <r.hoelzemer@posteo.de> | 2014-09-19 00:52:05 +0200 |
commit | 5cd174586afd51c1fc0091bc2235d0cfd7e14539 (patch) | |
tree | 1441951e7c12cb8d4f189ac29e3199584f8c46ad | |
parent | 7d6b160a444079fd6856b648ed077bf698b3b70c (diff) |
Fix for inverted VSlider
VSlider would get set at the inverted position when receiving a mouse click
Dragging the slider worked correct
-rw-r--r-- | scene/gui/slider.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp index 68525cf464..39d0ccfd10 100644 --- a/scene/gui/slider.cpp +++ b/scene/gui/slider.cpp @@ -49,7 +49,10 @@ void Slider::_input_event(InputEvent p_event) { if (mb.pressed) { grab.pos=orientation==VERTICAL?mb.y:mb.x; double max = orientation==VERTICAL ? get_size().height : get_size().width ; - set_val( ( ( (double)grab.pos / max) * ( get_max() - get_min() ) ) + get_min() ); + if (orientation==VERTICAL) + set_val( ( ( -(double)grab.pos / max) * ( get_max() - get_min() ) ) + get_max() ); + else + set_val( ( ( (double)grab.pos / max) * ( get_max() - get_min() ) ) + get_min() ); grab.active=true; grab.uvalue=get_unit_value(); } else { |