Browse Source

Disable scroll when dragging at edges of TextEdit

kobewi 3 years ago
parent
commit
053fdb8872
1 changed files with 6 additions and 4 deletions
  1. 6 4
      scene/gui/text_edit.cpp

+ 6 - 4
scene/gui/text_edit.cpp

@@ -2764,10 +2764,12 @@ void TextEdit::_gui_input(const Ref<InputEvent> &p_gui_input) {
 			_get_mouse_pos(Point2i(mp.x, mp.y), row, col);
 			_get_mouse_pos(Point2i(mp.x, mp.y), row, col);
 			cursor_set_line(row, true);
 			cursor_set_line(row, true);
 			cursor_set_column(col);
 			cursor_set_column(col);
-			if (row <= get_first_visible_line()) {
-				_scroll_lines_up();
-			} else if (row >= get_last_full_visible_line()) {
-				_scroll_lines_down();
+			if (!scroll_past_end_of_file_enabled) {
+				if (row <= get_first_visible_line()) {
+					_scroll_lines_up();
+				} else if (row >= get_last_full_visible_line()) {
+					_scroll_lines_down();
+				}
 			}
 			}
 			dragging_selection = true;
 			dragging_selection = true;
 			update();
 			update();