@@ -414,6 +414,9 @@ void EditorProperty::_notification(int p_what) {
414414
415415 int ofs = get_theme_constant (SNAME (" font_offset" ));
416416 int text_limit = text_size - ofs;
417+ int base_spacing = EDITOR_GET (" interface/theme/base_spacing" );
418+ int padding = base_spacing * EDSCALE;
419+ int half_padding = padding / 2 ;
417420
418421 if (checkable) {
419422 Ref<Texture2D> checkbox;
@@ -444,19 +447,31 @@ void EditorProperty::_notification(int p_what) {
444447
445448 if (can_revert && !is_read_only ()) {
446449 Ref<Texture2D> reload_icon = get_editor_theme_icon (SNAME (" ReloadSmall" ));
447- text_limit -= reload_icon->get_width () + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
448- revert_rect = Rect2 (ofs + text_limit, (size.height - reload_icon->get_height ()) / 2 , reload_icon->get_width (), reload_icon->get_height ());
450+ text_limit -= reload_icon->get_width () + half_padding + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
451+ revert_rect = Rect2 (ofs + text_limit, 0 , reload_icon->get_width () + padding + (1 * EDSCALE), size.height );
452+
453+ Point2 rtl_pos = Point2 ();
454+ if (rtl) {
455+ rtl_pos = Point2 (size.width - revert_rect.position .x - (reload_icon->get_width () + padding + (1 * EDSCALE)), revert_rect.position .y );
456+ }
449457
450458 Color color2 (1 , 1 , 1 );
451459 if (revert_hover) {
452460 color2.r *= 1.2 ;
453461 color2.g *= 1.2 ;
454462 color2.b *= 1.2 ;
463+
464+ Ref<StyleBox> sb_hover = get_theme_stylebox (SceneStringName (hover), " Button" );
465+ if (rtl) {
466+ draw_style_box (sb_hover, Rect2 (rtl_pos, revert_rect.size ));
467+ } else {
468+ draw_style_box (sb_hover, revert_rect);
469+ }
455470 }
456471 if (rtl) {
457- draw_texture (reload_icon, Vector2 ( size.width - revert_rect. position . x - reload_icon->get_width (), revert_rect. position . y ) , color2);
472+ draw_texture (reload_icon, rtl_pos + Point2 (padding, size.height - reload_icon->get_height ()) / 2 , color2);
458473 } else {
459- draw_texture (reload_icon, revert_rect.position , color2);
474+ draw_texture (reload_icon, revert_rect.position + Point2 (padding, size. height - reload_icon-> get_height ()) / 2 , color2);
460475 }
461476 } else {
462477 revert_rect = Rect2 ();
@@ -494,19 +509,32 @@ void EditorProperty::_notification(int p_what) {
494509 key = get_editor_theme_icon (SNAME (" Key" ));
495510 }
496511
497- ofs -= key->get_width () + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
512+ ofs -= key->get_width () + half_padding + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
513+ keying_rect = Rect2 (ofs, 0 , key->get_width () + padding, size.height );
514+
515+ Point2 rtl_pos = Point2 ();
516+ if (rtl) {
517+ rtl_pos = Point2 (size.width - keying_rect.position .x - (key->get_width () + padding), keying_rect.position .y );
518+ }
498519
499520 Color color2 (1 , 1 , 1 );
500521 if (keying_hover) {
501522 color2.r *= 1.2 ;
502523 color2.g *= 1.2 ;
503524 color2.b *= 1.2 ;
525+
526+ Ref<StyleBox> sb_hover = get_theme_stylebox (SceneStringName (hover), " Button" );
527+ if (rtl) {
528+ draw_style_box (sb_hover, Rect2 (rtl_pos, keying_rect.size ));
529+ } else {
530+ draw_style_box (sb_hover, keying_rect);
531+ }
504532 }
505- keying_rect = Rect2 (ofs, ((size. height - key-> get_height ()) / 2 ), key-> get_width (), key-> get_height ());
533+
506534 if (rtl) {
507- draw_texture (key, Vector2 ( size.width - keying_rect. position . x - key->get_width (), keying_rect. position . y ) , color2);
535+ draw_texture (key, rtl_pos + Point2 (padding, size.height - key->get_height ()) / 2 , color2);
508536 } else {
509- draw_texture (key, keying_rect.position , color2);
537+ draw_texture (key, keying_rect.position + Point2 (padding, size. height - key-> get_height ()) / 2 , color2);
510538 }
511539
512540 } else {
@@ -518,19 +546,32 @@ void EditorProperty::_notification(int p_what) {
518546
519547 close = get_editor_theme_icon (SNAME (" Close" ));
520548
521- ofs -= close->get_width () + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
549+ ofs -= close->get_width () + half_padding + get_theme_constant (SNAME (" h_separation" ), SNAME (" Tree" ));
550+ delete_rect = Rect2 (ofs, 0 , close->get_width () + padding, size.height );
551+
552+ Point2 rtl_pos = Point2 ();
553+ if (rtl) {
554+ rtl_pos = Point2 (size.width - delete_rect.position .x - (close->get_width () + padding), delete_rect.position .y );
555+ }
522556
523557 Color color2 (1 , 1 , 1 );
524558 if (delete_hover) {
525559 color2.r *= 1.2 ;
526560 color2.g *= 1.2 ;
527561 color2.b *= 1.2 ;
562+
563+ Ref<StyleBox> sb_hover = get_theme_stylebox (SceneStringName (hover), " Button" );
564+ if (rtl) {
565+ draw_style_box (sb_hover, Rect2 (rtl_pos, delete_rect.size ));
566+ } else {
567+ draw_style_box (sb_hover, delete_rect);
568+ }
528569 }
529- delete_rect = Rect2 (ofs, ((size. height - close-> get_height ()) / 2 ), close-> get_width (), close-> get_height ());
570+
530571 if (rtl) {
531- draw_texture (close, Vector2 ( size.width - delete_rect. position . x - close->get_width (), delete_rect. position . y ) , color2);
572+ draw_texture (close, rtl_pos + Point2 (padding, size.height - close->get_height ()) / 2 , color2);
532573 } else {
533- draw_texture (close, delete_rect.position , color2);
574+ draw_texture (close, delete_rect.position + Point2 (padding, size. height - close-> get_height ()) / 2 , color2);
534575 }
535576 } else {
536577 delete_rect = Rect2 ();
@@ -547,6 +588,15 @@ void EditorProperty::_notification(int p_what) {
547588 get_parent ()->disconnect (SceneStringName (theme_changed), callable_mp (this , &EditorProperty::_update_property_bg));
548589 }
549590 } break ;
591+ case NOTIFICATION_MOUSE_EXIT: {
592+ if (keying_hover || revert_hover || check_hover || delete_hover) {
593+ keying_hover = false ;
594+ revert_hover = false ;
595+ check_hover = false ;
596+ delete_hover = false ;
597+ queue_redraw ();
598+ }
599+ } break ;
550600 }
551601}
552602
0 commit comments