Skip to content

Commit 894d6ba

Browse files
committed
Merge pull request #76267 from Calinou/editor-theme-extra-borders-tooltip
Add a border to tooltips when using the Draw Extra Borders editor setting
2 parents 5913469 + 7fe3a66 commit 894d6ba

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

editor/themes/editor_theme_manager.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,12 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the
714714
style_tooltip->set_shadow_size(0);
715715
style_tooltip->set_content_margin_all(p_config.base_margin * EDSCALE * 0.5);
716716
style_tooltip->set_bg_color(p_config.dark_color_3 * Color(0.8, 0.8, 0.8, 0.9));
717-
style_tooltip->set_border_width_all(0);
717+
if (p_config.draw_extra_borders) {
718+
style_tooltip->set_border_width_all(Math::round(EDSCALE));
719+
style_tooltip->set_border_color(p_config.extra_border_color_2);
720+
} else {
721+
style_tooltip->set_border_width_all(0);
722+
}
718723
p_theme->set_stylebox(SceneStringName(panel), "TooltipPanel", style_tooltip);
719724
}
720725

@@ -2506,6 +2511,13 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
25062511
Ref<StyleBoxFlat> style = p_config.tree_panel_style->duplicate();
25072512
style->set_bg_color(p_config.dark_theme ? style->get_bg_color().lightened(0.04) : style->get_bg_color().darkened(0.04));
25082513
style->set_border_color(p_config.dark_theme ? style->get_border_color().lightened(0.04) : style->get_border_color().darkened(0.04));
2514+
if (p_config.draw_extra_borders) {
2515+
// A tooltip border is already drawn for all tooltips when Draw Extra Borders is enabled.
2516+
// Hide borders that don't serve in drawing a line between the title and content to prevent the border from being doubled.
2517+
style->set_border_width(SIDE_TOP, 0);
2518+
style->set_border_width(SIDE_LEFT, 0);
2519+
style->set_border_width(SIDE_RIGHT, 0);
2520+
}
25092521
style->set_corner_radius(CORNER_BOTTOM_LEFT, 0);
25102522
style->set_corner_radius(CORNER_BOTTOM_RIGHT, 0);
25112523

@@ -2516,6 +2528,13 @@ void EditorThemeManager::_populate_editor_styles(const Ref<EditorTheme> &p_theme
25162528
// EditorHelpBitContent.
25172529
{
25182530
Ref<StyleBoxFlat> style = p_config.tree_panel_style->duplicate();
2531+
if (p_config.draw_extra_borders) {
2532+
// A tooltip border is already drawn for all tooltips when Draw Extra Borders is enabled.
2533+
// Hide borders that don't serve in drawing a line between the title and content to prevent the border from being doubled.
2534+
style->set_border_width(SIDE_BOTTOM, 0);
2535+
style->set_border_width(SIDE_LEFT, 0);
2536+
style->set_border_width(SIDE_RIGHT, 0);
2537+
}
25192538
style->set_corner_radius(CORNER_TOP_LEFT, 0);
25202539
style->set_corner_radius(CORNER_TOP_RIGHT, 0);
25212540

0 commit comments

Comments
 (0)