Fix help links with threaded RTL.
This commit is contained in:
parent
6bfea24695
commit
96cc3c74da
|
@ -73,6 +73,13 @@ void EditorHelp::_search(bool p_search_previous) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorHelp::_class_desc_finished() {
|
||||||
|
if (scroll_to >= 0) {
|
||||||
|
class_desc->scroll_to_paragraph(scroll_to);
|
||||||
|
}
|
||||||
|
scroll_to = -1;
|
||||||
|
}
|
||||||
|
|
||||||
void EditorHelp::_class_list_select(const String &p_select) {
|
void EditorHelp::_class_list_select(const String &p_select) {
|
||||||
_goto_desc(p_select);
|
_goto_desc(p_select);
|
||||||
}
|
}
|
||||||
|
@ -126,7 +133,11 @@ void EditorHelp::_class_desc_select(const String &p_select) {
|
||||||
// Case order is important here to correctly handle edge cases like Variant.Type in @GlobalScope.
|
// Case order is important here to correctly handle edge cases like Variant.Type in @GlobalScope.
|
||||||
if (table->has(link)) {
|
if (table->has(link)) {
|
||||||
// Found in the current page.
|
// Found in the current page.
|
||||||
|
if (class_desc->is_ready()) {
|
||||||
class_desc->scroll_to_paragraph((*table)[link]);
|
class_desc->scroll_to_paragraph((*table)[link]);
|
||||||
|
} else {
|
||||||
|
scroll_to = (*table)[link];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Look for link in @GlobalScope.
|
// Look for link in @GlobalScope.
|
||||||
// Note that a link like @GlobalScope.enum_name will not be found in this section, only enum_name will be.
|
// Note that a link like @GlobalScope.enum_name will not be found in this section, only enum_name will be.
|
||||||
|
@ -1469,7 +1480,11 @@ void EditorHelp::_help_callback(const String &p_topic) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (class_desc->is_ready()) {
|
||||||
class_desc->call_deferred(SNAME("scroll_to_paragraph"), line);
|
class_desc->call_deferred(SNAME("scroll_to_paragraph"), line);
|
||||||
|
} else {
|
||||||
|
scroll_to = line;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
|
static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt) {
|
||||||
|
@ -1824,7 +1839,11 @@ Vector<Pair<String, int>> EditorHelp::get_sections() {
|
||||||
void EditorHelp::scroll_to_section(int p_section_index) {
|
void EditorHelp::scroll_to_section(int p_section_index) {
|
||||||
_wait_for_thread();
|
_wait_for_thread();
|
||||||
int line = section_line[p_section_index].second;
|
int line = section_line[p_section_index].second;
|
||||||
|
if (class_desc->is_ready()) {
|
||||||
class_desc->scroll_to_paragraph(line);
|
class_desc->scroll_to_paragraph(line);
|
||||||
|
} else {
|
||||||
|
scroll_to = line;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditorHelp::popup_search() {
|
void EditorHelp::popup_search() {
|
||||||
|
@ -1877,6 +1896,7 @@ EditorHelp::EditorHelp() {
|
||||||
class_desc->set_v_size_flags(SIZE_EXPAND_FILL);
|
class_desc->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||||
class_desc->add_theme_color_override("selection_color", get_theme_color(SNAME("accent_color"), SNAME("Editor")) * Color(1, 1, 1, 0.4));
|
class_desc->add_theme_color_override("selection_color", get_theme_color(SNAME("accent_color"), SNAME("Editor")) * Color(1, 1, 1, 0.4));
|
||||||
|
|
||||||
|
class_desc->connect("finished", callable_mp(this, &EditorHelp::_class_desc_finished));
|
||||||
class_desc->connect("meta_clicked", callable_mp(this, &EditorHelp::_class_desc_select));
|
class_desc->connect("meta_clicked", callable_mp(this, &EditorHelp::_class_desc_select));
|
||||||
class_desc->connect("gui_input", callable_mp(this, &EditorHelp::_class_desc_input));
|
class_desc->connect("gui_input", callable_mp(this, &EditorHelp::_class_desc_input));
|
||||||
class_desc->connect("resized", callable_mp(this, &EditorHelp::_class_desc_resized), varray(false));
|
class_desc->connect("resized", callable_mp(this, &EditorHelp::_class_desc_resized), varray(false));
|
||||||
|
|
|
@ -140,6 +140,8 @@ class EditorHelp : public VBoxContainer {
|
||||||
Ref<Font> doc_title_font;
|
Ref<Font> doc_title_font;
|
||||||
Ref<Font> doc_code_font;
|
Ref<Font> doc_code_font;
|
||||||
|
|
||||||
|
int scroll_to = -1;
|
||||||
|
|
||||||
void _update_theme();
|
void _update_theme();
|
||||||
void _help_callback(const String &p_topic);
|
void _help_callback(const String &p_topic);
|
||||||
|
|
||||||
|
@ -152,6 +154,7 @@ class EditorHelp : public VBoxContainer {
|
||||||
|
|
||||||
void _add_bulletpoint();
|
void _add_bulletpoint();
|
||||||
|
|
||||||
|
void _class_desc_finished();
|
||||||
void _class_list_select(const String &p_select);
|
void _class_list_select(const String &p_select);
|
||||||
void _class_desc_select(const String &p_select);
|
void _class_desc_select(const String &p_select);
|
||||||
void _class_desc_input(const Ref<InputEvent> &p_input);
|
void _class_desc_input(const Ref<InputEvent> &p_input);
|
||||||
|
|
Loading…
Reference in New Issue