You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-18 14:21:41 +00:00
Merge pull request #22742 from YeldhamDev/textedit_margin_scroll
Fix TextEdit margin start spacing with two scrollbars
This commit is contained in:
@@ -334,15 +334,12 @@ void TextEdit::_update_scrollbars() {
|
|||||||
h_scroll->set_begin(Point2(0, size.height - hmin.height));
|
h_scroll->set_begin(Point2(0, size.height - hmin.height));
|
||||||
h_scroll->set_end(Point2(size.width - vmin.width, size.height));
|
h_scroll->set_end(Point2(size.width - vmin.width, size.height));
|
||||||
|
|
||||||
int hscroll_rows = ((hmin.height - 1) / get_row_height()) + 1;
|
|
||||||
int visible_rows = get_visible_rows();
|
int visible_rows = get_visible_rows();
|
||||||
|
|
||||||
int total_rows = get_total_visible_rows();
|
int total_rows = get_total_visible_rows();
|
||||||
if (scroll_past_end_of_file_enabled) {
|
if (scroll_past_end_of_file_enabled) {
|
||||||
total_rows += visible_rows - 1;
|
total_rows += visible_rows - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vscroll_pixels = v_scroll->get_combined_minimum_size().width;
|
|
||||||
int visible_width = size.width - cache.style_normal->get_minimum_size().width;
|
int visible_width = size.width - cache.style_normal->get_minimum_size().width;
|
||||||
int total_width = text.get_max_width(true) + vmin.x;
|
int total_width = text.get_max_width(true) + vmin.x;
|
||||||
|
|
||||||
@@ -367,12 +364,12 @@ void TextEdit::_update_scrollbars() {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (total_rows > visible_rows && total_width <= visible_width - vscroll_pixels) {
|
if (total_rows > visible_rows && total_width <= visible_width) {
|
||||||
//thanks yessopie for this clever bit of logic
|
//thanks yessopie for this clever bit of logic
|
||||||
use_hscroll = false;
|
use_hscroll = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (total_rows <= visible_rows - hscroll_rows && total_width > visible_width) {
|
if (total_rows <= visible_rows && total_width > visible_width) {
|
||||||
//thanks yessopie for this clever bit of logic
|
//thanks yessopie for this clever bit of logic
|
||||||
use_vscroll = false;
|
use_vscroll = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user