Recalculate margin based on help source font size
This commit is contained in:
parent
982774e639
commit
69c5d637f2
1 changed files with 3 additions and 1 deletions
|
@ -172,7 +172,9 @@ void EditorHelp::_class_desc_input(const Ref<InputEvent> &p_input) {
|
||||||
void EditorHelp::_class_desc_resized() {
|
void EditorHelp::_class_desc_resized() {
|
||||||
// Add extra horizontal margins for better readability.
|
// Add extra horizontal margins for better readability.
|
||||||
// The margins increase as the width of the editor help container increases.
|
// The margins increase as the width of the editor help container increases.
|
||||||
const int display_margin = MAX(30 * EDSCALE, get_parent_anchorable_rect().size.width - 900 * EDSCALE) * 0.5;
|
Ref<Font> doc_code_font = get_font("doc_source", "EditorFonts");
|
||||||
|
real_t char_width = doc_code_font->get_char_size('x').width;
|
||||||
|
const int display_margin = MAX(30 * EDSCALE, get_parent_anchorable_rect().size.width - char_width * 120 * EDSCALE) * 0.5;
|
||||||
|
|
||||||
Ref<StyleBox> class_desc_stylebox = EditorNode::get_singleton()->get_theme_base()->get_stylebox("normal", "RichTextLabel")->duplicate();
|
Ref<StyleBox> class_desc_stylebox = EditorNode::get_singleton()->get_theme_base()->get_stylebox("normal", "RichTextLabel")->duplicate();
|
||||||
class_desc_stylebox->set_default_margin(MARGIN_LEFT, display_margin);
|
class_desc_stylebox->set_default_margin(MARGIN_LEFT, display_margin);
|
||||||
|
|
Loading…
Reference in a new issue