mirror of
https://github.com/godotengine/godot
synced 2024-09-15 23:56:57 +00:00
Merge pull request #92557 from kitbdev/dont-scroll-too-high
Fix minimap error when moving to the top
This commit is contained in:
commit
517b674c91
|
@ -4393,13 +4393,7 @@ int TextEdit::get_minimap_line_at_pos(const Point2i &p_pos) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row < 0) {
|
row = CLAMP(row, 0, text.size() - 1);
|
||||||
row = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (row >= text.size()) {
|
|
||||||
row = text.size() - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
@ -7991,7 +7985,7 @@ void TextEdit::_update_minimap_click() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Point2i next_line = get_next_visible_line_index_offset_from(row, 0, -get_visible_line_count() / 2);
|
Point2i next_line = get_next_visible_line_index_offset_from(row, 0, -get_visible_line_count() / 2);
|
||||||
int first_line = row - next_line.x + 1;
|
int first_line = MAX(0, row - next_line.x + 1);
|
||||||
double delta = get_scroll_pos_for_line(first_line, next_line.y) - get_v_scroll();
|
double delta = get_scroll_pos_for_line(first_line, next_line.y) - get_v_scroll();
|
||||||
if (delta < 0) {
|
if (delta < 0) {
|
||||||
_scroll_up(-delta, true);
|
_scroll_up(-delta, true);
|
||||||
|
|
Loading…
Reference in a new issue