aboutsummaryrefslogtreecommitdiff
path: root/scene/gui/slider.cpp
diff options
context:
space:
mode:
authorJuan Linietsky2017-01-13 14:08:30 -0300
committerJuan Linietsky2017-01-13 14:08:30 -0300
commitde8cc309d66641d52a6832ad65f26ce73378fb88 (patch)
tree0ae019462739e97ba4ae562ba527696fe8c2f253 /scene/gui/slider.cpp
parente53c247cb16b25b828461f32533da64f4fab0e0b (diff)
downloadgodot-de8cc309d66641d52a6832ad65f26ce73378fb88.tar.gz
godot-de8cc309d66641d52a6832ad65f26ce73378fb88.tar.zst
godot-de8cc309d66641d52a6832ad65f26ce73378fb88.zip
Diffstat (limited to 'scene/gui/slider.cpp')
-rw-r--r--scene/gui/slider.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/scene/gui/slider.cpp b/scene/gui/slider.cpp
index dacfc644e..a7cc38846 100644
--- a/scene/gui/slider.cpp
+++ b/scene/gui/slider.cpp
@@ -53,11 +53,11 @@ void Slider::_gui_input(InputEvent p_event) {
double grab_height = (double)grabber->get_size().height;
double max = orientation==VERTICAL ? get_size().height - grab_height : get_size().width - grab_width;
if (orientation==VERTICAL)
- set_unit_value( 1 - (((double)grab.pos - (grab_height / 2.0)) / max) );
+ set_as_ratio( 1 - (((double)grab.pos - (grab_height / 2.0)) / max) );
else
- set_unit_value(((double)grab.pos - (grab_width/2.0)) / max);
+ set_as_ratio(((double)grab.pos - (grab_width/2.0)) / max);
grab.active=true;
- grab.uvalue=get_unit_value();
+ grab.uvalue=get_as_ratio();
} else {
grab.active=false;
}
@@ -81,7 +81,7 @@ void Slider::_gui_input(InputEvent p_event) {
if (areasize<=0)
return;
float umotion = motion / float(areasize);
- set_unit_value( grab.uvalue + umotion );
+ set_as_ratio( grab.uvalue + umotion );
}
} else {
@@ -176,7 +176,7 @@ void Slider::_notification(int p_what) {
}
}
- grabber->draw(ci,Point2i(size.width/2-grabber->get_size().width/2,size.height - get_unit_value()*areasize - grabber->get_size().height));
+ grabber->draw(ci,Point2i(size.width/2-grabber->get_size().width/2,size.height - get_as_ratio()*areasize - grabber->get_size().height));
} else {
style->draw(ci,Rect2i(Point2i(),Size2i(size.width,style->get_minimum_size().height+style->get_center_size().height)));
//if (mouse_inside||has_focus())
@@ -192,7 +192,7 @@ void Slider::_notification(int p_what) {
}
}
- grabber->draw(ci,Point2i(get_unit_value()*areasize,size.height/2-grabber->get_size().height/2));
+ grabber->draw(ci,Point2i(get_as_ratio()*areasize,size.height/2-grabber->get_size().height/2));
}
} break;