Merge pull request #27821 from mawenzy/pr_sliderfix

Fix slider handle being hard to select
This commit is contained in:
Rémi Verschelde 2019-04-17 09:03:30 +02:00 committed by GitHub
commit 6697fd9a05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -34,8 +34,15 @@
Size2 Slider::get_minimum_size() const {
Ref<StyleBox> style = get_stylebox("slider");
Size2i ms = style->get_minimum_size() + style->get_center_size();
return ms;
Size2i ss = style->get_minimum_size() + style->get_center_size();
Ref<Texture> grabber = get_icon("grabber");
Size2i rs = grabber->get_size();
if (orientation == HORIZONTAL)
return Size2i(ss.width, MAX(ss.height, rs.height));
else
return Size2i(MAX(ss.width, rs.width), ss.height);
}
void Slider::_gui_input(Ref<InputEvent> p_event) {
@ -134,7 +141,11 @@ void Slider::_gui_input(Ref<InputEvent> p_event) {
void Slider::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_THEME_CHANGED: {
minimum_size_changed();
update();
} break;
case NOTIFICATION_MOUSE_ENTER: {
mouse_inside = true;