Merge pull request #93764 from patwork/fix-aspect-div-by-zero
Fix division by zero in aspect ratio calculation
This commit is contained in:
commit
f9474f0925
|
@ -1796,7 +1796,7 @@ bool CanvasItemEditor::_gui_input_resize(const Ref<InputEvent> &p_event) {
|
||||||
bool symmetric = m->is_alt_pressed();
|
bool symmetric = m->is_alt_pressed();
|
||||||
|
|
||||||
Rect2 local_rect = ci->_edit_get_rect();
|
Rect2 local_rect = ci->_edit_get_rect();
|
||||||
real_t aspect = local_rect.get_size().y / local_rect.get_size().x;
|
real_t aspect = local_rect.has_area() ? (local_rect.get_size().y / local_rect.get_size().x) : (local_rect.get_size().y + 1.0) / (local_rect.get_size().x + 1.0);
|
||||||
Point2 current_begin = local_rect.get_position();
|
Point2 current_begin = local_rect.get_position();
|
||||||
Point2 current_end = local_rect.get_position() + local_rect.get_size();
|
Point2 current_end = local_rect.get_position() + local_rect.get_size();
|
||||||
Point2 max_begin = (symmetric) ? (current_begin + current_end - ci->_edit_get_minimum_size()) / 2.0 : current_end - ci->_edit_get_minimum_size();
|
Point2 max_begin = (symmetric) ? (current_begin + current_end - ci->_edit_get_minimum_size()) / 2.0 : current_end - ci->_edit_get_minimum_size();
|
||||||
|
|
Loading…
Reference in New Issue