浏览代码

Merge pull request #91275 from ajreckof/Fix-RichTextLabel-Scroll-Following-randomly-stops-working

Fix RichTextLabel "Scroll Following" randomly stops working.
Rémi Verschelde 1 年之前
父节点
当前提交
c1f8d24f18
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      scene/gui/rich_text_label.cpp

+ 2 - 2
scene/gui/rich_text_label.cpp

@@ -1803,7 +1803,7 @@ void RichTextLabel::_scroll_changed(double) {
 		return;
 	}
 
-	if (scroll_follow && vscroll->get_value() >= (vscroll->get_max() - Math::round(vscroll->get_page()))) {
+	if (scroll_follow && vscroll->get_value() > (vscroll->get_max() - vscroll->get_page() - 1)) {
 		scroll_following = true;
 	} else {
 		scroll_following = false;
@@ -4121,7 +4121,7 @@ bool RichTextLabel::is_scroll_active() const {
 
 void RichTextLabel::set_scroll_follow(bool p_follow) {
 	scroll_follow = p_follow;
-	if (!vscroll->is_visible_in_tree() || vscroll->get_value() >= (vscroll->get_max() - vscroll->get_page())) {
+	if (!vscroll->is_visible_in_tree() || vscroll->get_value() > (vscroll->get_max() - vscroll->get_page() - 1)) {
 		scroll_following = true;
 	}
 }