diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/camera_3d.cpp | 6 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 25 |
2 files changed, 7 insertions, 24 deletions
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 8dc5cd4aba..7ffca4bd9e 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -754,9 +754,9 @@ void ClippedCamera3D::_notification(int p_what) { xf.origin = ray_from; xf.orthonormalize(); - float csafe, cunsafe; - if (dspace->cast_motion(pyramid_shape, xf, cam_pos - ray_from, margin, csafe, cunsafe, exclude, collision_mask, clip_to_bodies, clip_to_areas)) { - clip_offset = cam_pos.distance_to(ray_from + (cam_pos - ray_from) * csafe); + float closest_safe = 1.0f, closest_unsafe = 1.0f; + if (dspace->cast_motion(pyramid_shape, xf, cam_pos - ray_from, margin, closest_safe, closest_unsafe, exclude, collision_mask, clip_to_bodies, clip_to_areas)) { + clip_offset = cam_pos.distance_to(ray_from + (cam_pos - ray_from) * closest_safe); } _update_camera(); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index e050b3f174..c7fc8dbe43 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -366,26 +366,9 @@ void TextEdit::_update_scrollbars() { total_width += cache.minimap_width; } - bool use_hscroll = true; - bool use_vscroll = true; - - // Thanks yessopie for this clever bit of logic. - if (total_rows <= visible_rows && total_width <= visible_width) { - use_hscroll = false; - use_vscroll = false; - } else { - if (total_rows > visible_rows && total_width <= visible_width) { - use_hscroll = false; - } - - if (total_rows <= visible_rows && total_width > visible_width) { - use_vscroll = false; - } - } - updating_scrolls = true; - if (use_vscroll) { + if (total_rows > visible_rows) { v_scroll->show(); v_scroll->set_max(total_rows + get_visible_rows_offset()); v_scroll->set_page(visible_rows + get_visible_rows_offset()); @@ -403,7 +386,7 @@ void TextEdit::_update_scrollbars() { v_scroll->hide(); } - if (use_hscroll && !is_wrap_enabled()) { + if (total_width > visible_width && !is_wrap_enabled()) { h_scroll->show(); h_scroll->set_max(total_width); h_scroll->set_page(visible_width); @@ -2274,14 +2257,14 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) { if (mb->get_button_index() == BUTTON_WHEEL_UP && !mb->get_command()) { if (mb->get_shift()) { h_scroll->set_value(h_scroll->get_value() - (100 * mb->get_factor())); - } else { + } else if (v_scroll->is_visible()) { _scroll_up(3 * mb->get_factor()); } } if (mb->get_button_index() == BUTTON_WHEEL_DOWN && !mb->get_command()) { if (mb->get_shift()) { h_scroll->set_value(h_scroll->get_value() + (100 * mb->get_factor())); - } else { + } else if (v_scroll->is_visible()) { _scroll_down(3 * mb->get_factor()); } } |