summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2022-01-30 11:54:30 +0300
committerGitHub <noreply@github.com>2022-01-30 11:54:30 +0300
commit78e3e65e7c38d18128524e0822a106ac76e38800 (patch)
treed49cb848431b4a8fba617f220f5d7197a1f4f024
parente4265e86ceee1bf08bd92b85b51e969310a08bd6 (diff)
parent6e2c9f398c74b8d73d02814e5e9e6d09ad0ef51c (diff)
Merge pull request #57412 from Chaosus/fix_doc_panel_theming
-rw-r--r--editor/editor_help.cpp10
-rw-r--r--editor/editor_help.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp
index 6d5e56184a..6421d88780 100644
--- a/editor/editor_help.cpp
+++ b/editor/editor_help.cpp
@@ -163,14 +163,14 @@ void EditorHelp::_class_desc_select(const String &p_select) {
void EditorHelp::_class_desc_input(const Ref<InputEvent> &p_input) {
}
-void EditorHelp::_class_desc_resized() {
+void EditorHelp::_class_desc_resized(bool p_force_update_theme) {
// Add extra horizontal margins for better readability.
// The margins increase as the width of the editor help container increases.
Ref<Font> doc_code_font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts"));
int font_size = get_theme_font_size(SNAME("doc_source_size"), SNAME("EditorFonts"));
real_t char_width = doc_code_font->get_char_size('x', 0, font_size).width;
const int new_display_margin = MAX(30 * EDSCALE, get_parent_anchorable_rect().size.width - char_width * 120 * EDSCALE) * 0.5;
- if (display_margin != new_display_margin) {
+ if (display_margin != new_display_margin || p_force_update_theme) {
display_margin = new_display_margin;
Ref<StyleBox> class_desc_stylebox = EditorNode::get_singleton()->get_theme_base()->get_theme_stylebox(SNAME("normal"), SNAME("RichTextLabel"))->duplicate();
@@ -1772,7 +1772,7 @@ void EditorHelp::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
if (is_inside_tree()) {
- _class_desc_resized();
+ _class_desc_resized(true);
}
update_toggle_scripts_button();
} break;
@@ -1876,8 +1876,8 @@ EditorHelp::EditorHelp() {
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("resized", callable_mp(this, &EditorHelp::_class_desc_resized));
- _class_desc_resized();
+ class_desc->connect("resized", callable_mp(this, &EditorHelp::_class_desc_resized), varray(false));
+ _class_desc_resized(false);
// Added second so it opens at the bottom so it won't offset the entire widget.
find_bar = memnew(FindBar);
diff --git a/editor/editor_help.h b/editor/editor_help.h
index 237cf4f347..10281a764c 100644
--- a/editor/editor_help.h
+++ b/editor/editor_help.h
@@ -155,7 +155,7 @@ class EditorHelp : public VBoxContainer {
void _class_list_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_resized();
+ void _class_desc_resized(bool p_force_update_theme);
int display_margin = 0;
Error _goto_desc(const String &p_class, int p_vscr = -1);