added missing NaN check fixes: #13255
This commit is contained in:
parent
33a5999394
commit
c3d9094140
1 changed files with 5 additions and 4 deletions
|
@ -171,13 +171,14 @@ void Slider::_notification(int p_what) {
|
||||||
Ref<StyleBox> grabber_area = get_stylebox("grabber_area");
|
Ref<StyleBox> grabber_area = get_stylebox("grabber_area");
|
||||||
Ref<Texture> grabber = get_icon(editable ? ((mouse_inside || has_focus()) ? "grabber_highlight" : "grabber") : "grabber_disabled");
|
Ref<Texture> grabber = get_icon(editable ? ((mouse_inside || has_focus()) ? "grabber_highlight" : "grabber") : "grabber_disabled");
|
||||||
Ref<Texture> tick = get_icon("tick");
|
Ref<Texture> tick = get_icon("tick");
|
||||||
|
double ratio = Math::is_nan(get_as_ratio()) ? 0 : get_as_ratio();
|
||||||
|
|
||||||
if (orientation == VERTICAL) {
|
if (orientation == VERTICAL) {
|
||||||
|
|
||||||
int widget_width = style->get_minimum_size().width + style->get_center_size().width;
|
int widget_width = style->get_minimum_size().width + style->get_center_size().width;
|
||||||
float areasize = size.height - grabber->get_size().height;
|
float areasize = size.height - grabber->get_size().height;
|
||||||
style->draw(ci, Rect2i(Point2i(size.width / 2 - widget_width / 2, 0), Size2i(widget_width, size.height)));
|
style->draw(ci, Rect2i(Point2i(size.width / 2 - widget_width / 2, 0), Size2i(widget_width, size.height)));
|
||||||
grabber_area->draw(ci, Rect2i(Point2i((size.width - widget_width) / 2, size.height - areasize * get_as_ratio() - grabber->get_size().height / 2), Size2i(widget_width, areasize * get_as_ratio() + grabber->get_size().width / 2)));
|
grabber_area->draw(ci, Rect2i(Point2i((size.width - widget_width) / 2, size.height - areasize * ratio - grabber->get_size().height / 2), Size2i(widget_width, areasize * ratio + grabber->get_size().width / 2)));
|
||||||
/*
|
/*
|
||||||
if (mouse_inside||has_focus())
|
if (mouse_inside||has_focus())
|
||||||
focus->draw(ci,Rect2i(Point2i(),Size2i(style->get_minimum_size().width+style->get_center_size().width,size.height)));
|
focus->draw(ci,Rect2i(Point2i(),Size2i(style->get_minimum_size().width+style->get_center_size().width,size.height)));
|
||||||
|
@ -190,14 +191,14 @@ void Slider::_notification(int p_what) {
|
||||||
tick->draw(ci, Point2i((size.width - widget_width) / 2, ofs));
|
tick->draw(ci, Point2i((size.width - widget_width) / 2, ofs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
grabber->draw(ci, Point2i(size.width / 2 - grabber->get_size().width / 2, size.height - get_as_ratio() * areasize - grabber->get_size().height));
|
grabber->draw(ci, Point2i(size.width / 2 - grabber->get_size().width / 2, size.height - ratio * areasize - grabber->get_size().height));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
int widget_height = style->get_minimum_size().height + style->get_center_size().height;
|
int widget_height = style->get_minimum_size().height + style->get_center_size().height;
|
||||||
float areasize = size.width - grabber->get_size().width;
|
float areasize = size.width - grabber->get_size().width;
|
||||||
|
|
||||||
style->draw(ci, Rect2i(Point2i(0, (size.height - widget_height) / 2), Size2i(size.width, widget_height)));
|
style->draw(ci, Rect2i(Point2i(0, (size.height - widget_height) / 2), Size2i(size.width, widget_height)));
|
||||||
grabber_area->draw(ci, Rect2i(Point2i(0, (size.height - widget_height) / 2), Size2i(areasize * get_as_ratio() + grabber->get_size().width / 2, widget_height)));
|
grabber_area->draw(ci, Rect2i(Point2i(0, (size.height - widget_height) / 2), Size2i(areasize * ratio + grabber->get_size().width / 2, widget_height)));
|
||||||
/*
|
/*
|
||||||
if (mouse_inside||has_focus())
|
if (mouse_inside||has_focus())
|
||||||
focus->draw(ci,Rect2i(Point2i(),Size2i(size.width,style->get_minimum_size().height+style->get_center_size().height)));
|
focus->draw(ci,Rect2i(Point2i(),Size2i(size.width,style->get_minimum_size().height+style->get_center_size().height)));
|
||||||
|
@ -211,7 +212,7 @@ void Slider::_notification(int p_what) {
|
||||||
tick->draw(ci, Point2i(ofs, (size.height - widget_height) / 2));
|
tick->draw(ci, Point2i(ofs, (size.height - widget_height) / 2));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
grabber->draw(ci, Point2i(get_as_ratio() * areasize, size.height / 2 - grabber->get_size().height / 2));
|
grabber->draw(ci, Point2i(ratio * areasize, size.height / 2 - grabber->get_size().height / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
Loading…
Reference in a new issue