Przeglądaj źródła

Fix minimap selection offset

The minimap selection was shifted of 1 line too late.

(cherry picked from commit 72ab355945507cc3cbd9d7b16ad0b851e72b98b3)
etienne.frank 5 lat temu
rodzic
commit
46327d48a2
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      scene/gui/text_edit.cpp

+ 1 - 1
scene/gui/text_edit.cpp

@@ -933,7 +933,7 @@ void TextEdit::_notification(int p_what) {
 				// calculate viewport size and y offset
 				// calculate viewport size and y offset
 				int viewport_height = (draw_amount - 1) * minimap_line_height;
 				int viewport_height = (draw_amount - 1) * minimap_line_height;
 				int control_height = _get_control_height() - viewport_height;
 				int control_height = _get_control_height() - viewport_height;
-				int viewport_offset_y = round(get_scroll_pos_for_line(first_visible_line) * control_height) / ((v_scroll->get_max() <= minimap_visible_lines) ? (minimap_visible_lines - draw_amount) : (v_scroll->get_max() - draw_amount));
+				int viewport_offset_y = round(get_scroll_pos_for_line(first_visible_line + 1) * control_height) / ((v_scroll->get_max() <= minimap_visible_lines) ? (minimap_visible_lines - draw_amount) : (v_scroll->get_max() - draw_amount));
 
 
 				// calculate the first line.
 				// calculate the first line.
 				int num_lines_before = round((viewport_offset_y) / minimap_line_height);
 				int num_lines_before = round((viewport_offset_y) / minimap_line_height);