You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-08 12:40:44 +00:00
Add rounded corners to the contextual toolbar
- Move contextual toolbar stylebox to the editor theme because it's the same in the 2D and 3D editors
This commit is contained in:
@@ -3777,7 +3777,7 @@ void CanvasItemEditor::_update_editor_settings() {
|
||||
key_auto_insert_button->add_theme_color_override("icon_pressed_color", key_auto_color.lerp(Color(1, 0, 0), 0.55));
|
||||
animation_menu->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons")));
|
||||
|
||||
_update_context_menu_stylebox();
|
||||
context_menu_container->add_theme_style_override("panel", get_theme_stylebox(SNAME("ContextualToolbar"), SNAME("EditorStyles")));
|
||||
|
||||
panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/2d_editor_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning")));
|
||||
pan_speed = int(EditorSettings::get_singleton()->get("editors/panning/2d_editor_pan_speed"));
|
||||
@@ -3913,18 +3913,6 @@ void CanvasItemEditor::edit(CanvasItem *p_canvas_item) {
|
||||
}
|
||||
}
|
||||
|
||||
void CanvasItemEditor::_update_context_menu_stylebox() {
|
||||
// This must be called when the theme changes to follow the new accent color.
|
||||
Ref<StyleBoxFlat> context_menu_stylebox = memnew(StyleBoxFlat);
|
||||
const Color accent_color = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("accent_color"), SNAME("Editor"));
|
||||
context_menu_stylebox->set_bg_color(accent_color * Color(1, 1, 1, 0.1));
|
||||
// Add an underline to the StyleBox, but prevent its minimum vertical size from changing.
|
||||
context_menu_stylebox->set_border_color(accent_color);
|
||||
context_menu_stylebox->set_border_width(SIDE_BOTTOM, Math::round(2 * EDSCALE));
|
||||
context_menu_stylebox->set_default_margin(SIDE_BOTTOM, 0);
|
||||
context_menu_container->add_theme_style_override("panel", context_menu_stylebox);
|
||||
}
|
||||
|
||||
void CanvasItemEditor::_update_scrollbars() {
|
||||
updating_scroll = true;
|
||||
|
||||
@@ -5197,11 +5185,7 @@ CanvasItemEditor::CanvasItemEditor() {
|
||||
context_menu_container = memnew(PanelContainer);
|
||||
hbc_context_menu = memnew(HBoxContainer);
|
||||
context_menu_container->add_child(hbc_context_menu);
|
||||
// Use a custom stylebox to make contextual menu items stand out from the rest.
|
||||
// This helps with editor usability as contextual menu items change when selecting nodes,
|
||||
// even though it may not be immediately obvious at first.
|
||||
hb->add_child(context_menu_container);
|
||||
_update_context_menu_stylebox();
|
||||
|
||||
// Animation controls.
|
||||
animation_hb = memnew(HBoxContainer);
|
||||
|
||||
Reference in New Issue
Block a user