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) {
|
void RichTextLabel::_scroll_changed(double) {
|
||||||
|
|
||||||
if (updating_scroll || !scroll_active)
|
if (updating_scroll)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (scroll_follow && vscroll->get_value() >= (vscroll->get_max() - vscroll->get_page()))
|
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;
|
return;
|
||||||
|
|
||||||
scroll_active = p_active;
|
scroll_active = p_active;
|
||||||
|
vscroll->set_drag_node_enabled(p_active);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -545,6 +545,9 @@ void ScrollBar::_drag_node_exit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrollBar::_drag_node_input(const Ref<InputEvent> &p_input) {
|
void ScrollBar::_drag_node_input(const Ref<InputEvent> &p_input) {
|
||||||
|
if (!drag_node_enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Ref<InputEventMouseButton> mb = p_input;
|
Ref<InputEventMouseButton> mb = p_input;
|
||||||
|
|
||||||
|
@ -638,6 +641,10 @@ NodePath ScrollBar::get_drag_node() const {
|
||||||
return drag_node_path;
|
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) {
|
void ScrollBar::set_smooth_scroll_enabled(bool p_enable) {
|
||||||
smooth_scroll_enabled = p_enable;
|
smooth_scroll_enabled = p_enable;
|
||||||
}
|
}
|
||||||
|
@ -668,6 +675,7 @@ ScrollBar::ScrollBar(Orientation p_orientation) {
|
||||||
|
|
||||||
drag.active = false;
|
drag.active = false;
|
||||||
|
|
||||||
|
drag_node_enabled = true;
|
||||||
drag_node_speed = Vector2();
|
drag_node_speed = Vector2();
|
||||||
drag_node_touching = false;
|
drag_node_touching = false;
|
||||||
drag_node_touching_deaccel = false;
|
drag_node_touching_deaccel = false;
|
||||||
|
|
|
@ -53,7 +53,6 @@ class ScrollBar : public Range {
|
||||||
HighlightStatus highlight;
|
HighlightStatus highlight;
|
||||||
|
|
||||||
struct Drag {
|
struct Drag {
|
||||||
|
|
||||||
bool active;
|
bool active;
|
||||||
float pos_at_click;
|
float pos_at_click;
|
||||||
float value_at_click;
|
float value_at_click;
|
||||||
|
@ -70,6 +69,7 @@ class ScrollBar : public Range {
|
||||||
|
|
||||||
Node *drag_node;
|
Node *drag_node;
|
||||||
NodePath drag_node_path;
|
NodePath drag_node_path;
|
||||||
|
bool drag_node_enabled;
|
||||||
|
|
||||||
Vector2 drag_node_speed;
|
Vector2 drag_node_speed;
|
||||||
Vector2 drag_node_accum;
|
Vector2 drag_node_accum;
|
||||||
|
@ -101,6 +101,7 @@ public:
|
||||||
|
|
||||||
void set_drag_node(const NodePath &p_path);
|
void set_drag_node(const NodePath &p_path);
|
||||||
NodePath get_drag_node() const;
|
NodePath get_drag_node() const;
|
||||||
|
void set_drag_node_enabled(bool p_enable);
|
||||||
|
|
||||||
void set_smooth_scroll_enabled(bool p_enable);
|
void set_smooth_scroll_enabled(bool p_enable);
|
||||||
bool is_smooth_scroll_enabled() const;
|
bool is_smooth_scroll_enabled() const;
|
||||||
|
|
Loading…
Reference in New Issue