@@ -217,7 +217,9 @@ Size2 EditorProperty::get_minimum_size() const {
217217 Size2 ms;
218218 Ref<Font> font = get_theme_font (SceneStringName (font), SNAME (" Tree" ));
219219 int font_size = get_theme_font_size (SceneStringName (font_size), SNAME (" Tree" ));
220- ms.height = label.is_empty () ? 0 : font->get_height (font_size) + 4 * EDSCALE;
220+ int separation = 4 * EDSCALE;
221+ ms.height = label.is_empty () ? 0 : font->get_height (font_size) + separation;
222+ int padding = int (EDITOR_GET (" interface/theme/base_spacing" )) * 2 ;
221223
222224 for (int i = 0 ; i < get_child_count (); i++) {
223225 Control *c = as_sortable_control (get_child (i));
@@ -234,23 +236,22 @@ Size2 EditorProperty::get_minimum_size() const {
234236
235237 if (keying) {
236238 Ref<Texture2D> key = get_editor_theme_icon (SNAME (" Key" ));
237- ms.width += key->get_width () + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
239+ ms.width += key->get_width () + padding + separation + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
238240 }
239241
240242 if (deletable) {
241243 Ref<Texture2D> key = get_editor_theme_icon (SNAME (" Close" ));
242- ms.width += key->get_width () + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
244+ ms.width += key->get_width () + padding + separation + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
243245 }
244246
245247 if (checkable) {
246248 Ref<Texture2D> check = get_theme_icon (SNAME (" checked" ), SNAME (" CheckBox" ));
247- ms.width += check->get_width () + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
249+ ms.width += check->get_width () + padding + separation + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
248250 }
249251
250252 if (bottom_editor != nullptr && bottom_editor->is_visible ()) {
251253 ms.height += label.is_empty () ? 0 : get_theme_constant (SNAME (" v_separation" ));
252254 Size2 bems = bottom_editor->get_combined_minimum_size ();
253- // bems.width += get_constant("item_margin", "Tree");
254255 ms.height += bems.height ;
255256 ms.width = MAX (ms.width , bems.width );
256257 }
@@ -299,7 +300,9 @@ void EditorProperty::_notification(int p_what) {
299300 int child_room = size.width * (1.0 - split_ratio);
300301 Ref<Font> font = get_theme_font (SceneStringName (font), SNAME (" Tree" ));
301302 int font_size = get_theme_font_size (SceneStringName (font_size), SNAME (" Tree" ));
302- int height = label.is_empty () ? 0 : font->get_height (font_size) + 4 * EDSCALE;
303+ int separation = 4 * EDSCALE;
304+ int height = label.is_empty () ? 0 : font->get_height (font_size) + separation;
305+ int half_padding = EDITOR_GET (" interface/theme/base_spacing" );
303306 bool no_children = true ;
304307
305308 // compute room needed
@@ -317,6 +320,7 @@ void EditorProperty::_notification(int p_what) {
317320 height = MAX (height, minsize.height );
318321 no_children = false ;
319322 }
323+ child_room = MAX (child_room, get_minimum_size ().width );
320324
321325 if (no_children) {
322326 text_size = size.width ;
@@ -325,7 +329,7 @@ void EditorProperty::_notification(int p_what) {
325329 text_size = 0 ;
326330 rect = Rect2 (1 , 0 , size.width - 1 , height);
327331 } else {
328- text_size = MAX (0 , size.width - (child_room + 4 * EDSCALE ));
332+ text_size = MAX (0 , size.width - (child_room + separation ));
329333 if (is_layout_rtl ()) {
330334 rect = Rect2 (1 , 0 , child_room, height);
331335 } else {
@@ -347,13 +351,14 @@ void EditorProperty::_notification(int p_what) {
347351 key = get_editor_theme_icon (SNAME (" Key" ));
348352 }
349353
350- rect.size .x -= key->get_width () + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
354+ rect.size .x -= key->get_width () + half_padding + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
351355 if (is_layout_rtl ()) {
352- rect.position .x += key->get_width () + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
356+ rect.position .x += key->get_width () + half_padding + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
353357 }
354358
355359 if (no_children) {
356- text_size -= key->get_width () + 4 * EDSCALE;
360+ // Use full padding to avoid overlapping with the revert button.
361+ text_size -= key->get_width () + half_padding * 2 + separation;
357362 }
358363 }
359364
@@ -362,21 +367,21 @@ void EditorProperty::_notification(int p_what) {
362367
363368 close = get_editor_theme_icon (SNAME (" Close" ));
364369
365- rect.size .x -= close->get_width () + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
370+ rect.size .x -= close->get_width () + half_padding + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
366371
367372 if (is_layout_rtl ()) {
368- rect.position .x += close->get_width () + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
373+ rect.position .x += close->get_width () + half_padding + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
369374 }
370375
371376 if (no_children) {
372- text_size -= close->get_width () + 4 * EDSCALE ;
377+ text_size -= close->get_width () + half_padding + separation ;
373378 }
374379 }
375380
376381 // Account for the space needed on the outer side
377382 // when any of the icons are visible.
378383 if (keying || deletable) {
379- int separation = get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
384+ separation = get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
380385 rect.size .x -= separation;
381386
382387 if (is_layout_rtl ()) {
@@ -449,9 +454,8 @@ void EditorProperty::_notification(int p_what) {
449454
450455 int ofs = get_theme_constant (SNAME (" font_offset" ));
451456 int text_limit = text_size - ofs;
452- int base_spacing = EDITOR_GET (" interface/theme/base_spacing" );
453- int padding = base_spacing * EDSCALE;
454- int half_padding = padding / 2 ;
457+ int half_padding = EDITOR_GET (" interface/theme/base_spacing" );
458+ int padding = half_padding * 2 ;
455459
456460 if (checkable) {
457461 Ref<Texture2D> checkbox;
@@ -474,7 +478,7 @@ void EditorProperty::_notification(int p_what) {
474478 color2.g *= 1.2 ;
475479 color2.b *= 1.2 ;
476480
477- Ref<StyleBox> sb_hover = get_theme_stylebox (SceneStringName (hover), " Button " );
481+ Ref<StyleBox> sb_hover = get_theme_stylebox (SceneStringName (hover), SceneStringName (FlatButton) );
478482 if (rtl) {
479483 draw_style_box (sb_hover, Rect2 (rtl_pos, check_rect.size ));
480484 } else {
@@ -486,7 +490,7 @@ void EditorProperty::_notification(int p_what) {
486490 } else {
487491 draw_texture (checkbox, check_rect.position + Point2 (padding, size.height - checkbox->get_height ()) / 2 , color2);
488492 }
489- int check_ofs = checkbox->get_width () + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
493+ int check_ofs = checkbox->get_width () + padding + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
490494 ofs += check_ofs;
491495 text_limit -= check_ofs;
492496 } else {
@@ -509,7 +513,7 @@ void EditorProperty::_notification(int p_what) {
509513 color2.g *= 1.2 ;
510514 color2.b *= 1.2 ;
511515
512- Ref<StyleBox> sb_hover = get_theme_stylebox (SceneStringName (hover), " Button " );
516+ Ref<StyleBox> sb_hover = get_theme_stylebox (SceneStringName (hover), SceneStringName (FlatButton) );
513517 if (rtl) {
514518 draw_style_box (sb_hover, Rect2 (rtl_pos, revert_rect.size ));
515519 } else {
@@ -521,6 +525,7 @@ void EditorProperty::_notification(int p_what) {
521525 } else {
522526 draw_texture (reload_icon, revert_rect.position + Point2 (padding, size.height - reload_icon->get_height ()) / 2 , color2);
523527 }
528+ text_limit -= half_padding;
524529 } else {
525530 revert_rect = Rect2 ();
526531 }
@@ -571,7 +576,7 @@ void EditorProperty::_notification(int p_what) {
571576 color2.g *= 1.2 ;
572577 color2.b *= 1.2 ;
573578
574- Ref<StyleBox> sb_hover = get_theme_stylebox (SceneStringName (hover), " Button " );
579+ Ref<StyleBox> sb_hover = get_theme_stylebox (SceneStringName (hover), SceneStringName (FlatButton) );
575580 if (rtl) {
576581 draw_style_box (sb_hover, Rect2 (rtl_pos, keying_rect.size ));
577582 } else {
@@ -608,7 +613,7 @@ void EditorProperty::_notification(int p_what) {
608613 color2.g *= 1.2 ;
609614 color2.b *= 1.2 ;
610615
611- Ref<StyleBox> sb_hover = get_theme_stylebox (SceneStringName (hover), " Button " );
616+ Ref<StyleBox> sb_hover = get_theme_stylebox (SceneStringName (hover), SceneStringName (FlatButton) );
612617 if (rtl) {
613618 draw_style_box (sb_hover, Rect2 (rtl_pos, delete_rect.size ));
614619 } else {
@@ -642,6 +647,7 @@ void EditorProperty::_notification(int p_what) {
642647 get_parent ()->disconnect (SceneStringName (theme_changed), callable_mp (this , &EditorProperty::_update_property_bg));
643648 }
644649 } break ;
650+ case NOTIFICATION_MOUSE_EXIT_SELF:
645651 case NOTIFICATION_MOUSE_EXIT: {
646652 if (keying_hover || revert_hover || check_hover || delete_hover) {
647653 keying_hover = false ;
@@ -1982,8 +1988,8 @@ void EditorInspectorSection::_notification(int p_what) {
19821988 Ref<Texture2D> key = theme_cache.icon_gui_animation_key ;
19831989 if (keying && key.is_valid ()) {
19841990 Point2 key_position;
1985- key_position.x = rtl ? ( margin_end + 2 * EDSCALE) : (get_size ().width - key->get_width () - margin_end - 2 * EDSCALE) ;
1986- keying_rect = Rect2 (key_position.x - 2 * EDSCALE , 0 , key->get_width () + 4 * EDSCALE , header_height);
1991+ key_position.x = ( rtl ? margin_end : (get_size ().width - key->get_width () - margin_end)) - theme_cache. key_padding_size / 2 ;
1992+ keying_rect = Rect2 (key_position.x - theme_cache. key_padding_size / 2 , 0 , key->get_width () + theme_cache. key_padding_size , header_height);
19871993
19881994 Color key_color (1 , 1 , 1 );
19891995 if (keying_hover) {
@@ -1997,7 +2003,7 @@ void EditorInspectorSection::_notification(int p_what) {
19972003 key_position.y = (header_height - key->get_height ()) / 2 ;
19982004
19992005 draw_texture (key, key_position, key_color);
2000- margin_end += key-> get_width () + 6 * EDSCALE ;
2006+ margin_end += keying_rect. size . width + theme_cache. horizontal_separation ;
20012007 } else {
20022008 keying_rect = Rect2 ();
20032009 }
@@ -3462,6 +3468,7 @@ void EditorInspector::initialize_section_theme(EditorInspectorSection::ThemeCach
34623468 p_cache.vertical_separation = p_control->get_theme_constant (SNAME (" v_separation" ), SNAME (" Tree" ));
34633469 p_cache.inspector_margin = p_control->get_theme_constant (SNAME (" inspector_margin" ), EditorStringName (Editor));
34643470 p_cache.indent_size = p_control->get_theme_constant (SNAME (" indent_size" ), SNAME (" EditorInspectorSection" ));
3471+ p_cache.key_padding_size = int (EDITOR_GET (" interface/theme/base_spacing" )) * 2 ;
34653472
34663473 p_cache.warning_color = p_control->get_theme_color (SNAME (" warning_color" ), EditorStringName (Editor));
34673474 p_cache.prop_subsection = p_control->get_theme_color (SNAME (" prop_subsection" ), EditorStringName (Editor));
@@ -3486,7 +3493,7 @@ void EditorInspector::initialize_section_theme(EditorInspectorSection::ThemeCach
34863493 p_cache.icon_gui_animation_key = p_control->get_editor_theme_icon (SNAME (" Key" ));
34873494
34883495 p_cache.indent_box = p_control->get_theme_stylebox (SNAME (" indent_box" ), SNAME (" EditorInspectorSection" ));
3489- p_cache.key_hover = p_control->get_theme_stylebox (SceneStringName (hover), " Button " );
3496+ p_cache.key_hover = p_control->get_theme_stylebox (SceneStringName (hover), SceneStringName (FlatButton) );
34903497}
34913498
34923499void EditorInspector::initialize_category_theme (EditorInspectorCategory::ThemeCache &p_cache, Control *p_control) {
0 commit comments