Allow scroll_to_line when scroll_active is 'false'
Fix #36134
(cherry picked from commit 8f11a91917
)
This commit is contained in:
parent
26c617654e
commit
d15e9c2126
|
@ -870,7 +870,7 @@ int RichTextLabel::_process_line(ItemFrame *p_frame, const Vector2 &p_ofs, int &
|
|||
|
||||
void RichTextLabel::_scroll_changed(double) {
|
||||
|
||||
if (updating_scroll || !scroll_active)
|
||||
if (updating_scroll)
|
||||
return;
|
||||
|
||||
if (scroll_follow && vscroll->get_value() >= (vscroll->get_max() - vscroll->get_page()))
|
||||
|
@ -2009,6 +2009,7 @@ void RichTextLabel::set_scroll_active(bool p_active) {
|
|||
return;
|
||||
|
||||
scroll_active = p_active;
|
||||
vscroll->set_drag_node_enabled(p_active);
|
||||
update();
|
||||
}
|
||||
|
||||
|
|
|
@ -545,6 +545,9 @@ void ScrollBar::_drag_node_exit() {
|
|||
}
|
||||
|
||||
void ScrollBar::_drag_node_input(const Ref<InputEvent> &p_input) {
|
||||
if (!drag_node_enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<InputEventMouseButton> mb = p_input;
|
||||
|
||||
|
@ -638,6 +641,10 @@ NodePath ScrollBar::get_drag_node() const {
|
|||
return drag_node_path;
|
||||
}
|
||||
|
||||
void ScrollBar::set_drag_node_enabled(bool p_enable) {
|
||||
drag_node_enabled = p_enable;
|
||||
}
|
||||
|
||||
void ScrollBar::set_smooth_scroll_enabled(bool p_enable) {
|
||||
smooth_scroll_enabled = p_enable;
|
||||
}
|
||||
|
@ -668,6 +675,7 @@ ScrollBar::ScrollBar(Orientation p_orientation) {
|
|||
|
||||
drag.active = false;
|
||||
|
||||
drag_node_enabled = true;
|
||||
drag_node_speed = Vector2();
|
||||
drag_node_touching = false;
|
||||
drag_node_touching_deaccel = false;
|
||||
|
|
|
@ -53,7 +53,6 @@ class ScrollBar : public Range {
|
|||
HighlightStatus highlight;
|
||||
|
||||
struct Drag {
|
||||
|
||||
bool active;
|
||||
float pos_at_click;
|
||||
float value_at_click;
|
||||
|
@ -70,6 +69,7 @@ class ScrollBar : public Range {
|
|||
|
||||
Node *drag_node;
|
||||
NodePath drag_node_path;
|
||||
bool drag_node_enabled;
|
||||
|
||||
Vector2 drag_node_speed;
|
||||
Vector2 drag_node_accum;
|
||||
|
@ -101,6 +101,7 @@ public:
|
|||
|
||||
void set_drag_node(const NodePath &p_path);
|
||||
NodePath get_drag_node() const;
|
||||
void set_drag_node_enabled(bool p_enable);
|
||||
|
||||
void set_smooth_scroll_enabled(bool p_enable);
|
||||
bool is_smooth_scroll_enabled() const;
|
||||
|
|
Loading…
Reference in New Issue