mirror of
https://github.com/godotengine/godot.git
synced 2025-01-30 21:33:18 +08:00
Fix for inverted VSlider
VSlider would get set at the inverted position when receiving a mouse click Dragging the slider worked correct
This commit is contained in:
parent
7d6b160a44
commit
5cd174586a
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user