|
|
@@ -414,6 +414,9 @@ void EditorProperty::_notification(int p_what) {
|
|
|
|
|
|
int ofs = get_theme_constant(SNAME("font_offset"));
|
|
|
int text_limit = text_size - ofs;
|
|
|
+ int base_spacing = EDITOR_GET("interface/theme/base_spacing");
|
|
|
+ int padding = base_spacing * EDSCALE;
|
|
|
+ int half_padding = padding / 2;
|
|
|
|
|
|
if (checkable) {
|
|
|
Ref<Texture2D> checkbox;
|
|
|
@@ -444,19 +447,31 @@ void EditorProperty::_notification(int p_what) {
|
|
|
|
|
|
if (can_revert && !is_read_only()) {
|
|
|
Ref<Texture2D> reload_icon = get_editor_theme_icon(SNAME("ReloadSmall"));
|
|
|
- text_limit -= reload_icon->get_width() + get_theme_constant(SNAME("h_separation"), SNAME("Tree"));
|
|
|
- revert_rect = Rect2(ofs + text_limit, (size.height - reload_icon->get_height()) / 2, reload_icon->get_width(), reload_icon->get_height());
|
|
|
+ text_limit -= reload_icon->get_width() + half_padding + get_theme_constant(SNAME("h_separation"), SNAME("Tree"));
|
|
|
+ revert_rect = Rect2(ofs + text_limit, 0, reload_icon->get_width() + padding + (1 * EDSCALE), size.height);
|
|
|
+
|
|
|
+ Point2 rtl_pos = Point2();
|
|
|
+ if (rtl) {
|
|
|
+ rtl_pos = Point2(size.width - revert_rect.position.x - (reload_icon->get_width() + padding + (1 * EDSCALE)), revert_rect.position.y);
|
|
|
+ }
|
|
|
|
|
|
Color color2(1, 1, 1);
|
|
|
if (revert_hover) {
|
|
|
color2.r *= 1.2;
|
|
|
color2.g *= 1.2;
|
|
|
color2.b *= 1.2;
|
|
|
+
|
|
|
+ Ref<StyleBox> sb_hover = get_theme_stylebox(SceneStringName(hover), "Button");
|
|
|
+ if (rtl) {
|
|
|
+ draw_style_box(sb_hover, Rect2(rtl_pos, revert_rect.size));
|
|
|
+ } else {
|
|
|
+ draw_style_box(sb_hover, revert_rect);
|
|
|
+ }
|
|
|
}
|
|
|
if (rtl) {
|
|
|
- draw_texture(reload_icon, Vector2(size.width - revert_rect.position.x - reload_icon->get_width(), revert_rect.position.y), color2);
|
|
|
+ draw_texture(reload_icon, rtl_pos + Point2(padding, size.height - reload_icon->get_height()) / 2, color2);
|
|
|
} else {
|
|
|
- draw_texture(reload_icon, revert_rect.position, color2);
|
|
|
+ draw_texture(reload_icon, revert_rect.position + Point2(padding, size.height - reload_icon->get_height()) / 2, color2);
|
|
|
}
|
|
|
} else {
|
|
|
revert_rect = Rect2();
|
|
|
@@ -494,19 +509,32 @@ void EditorProperty::_notification(int p_what) {
|
|
|
key = get_editor_theme_icon(SNAME("Key"));
|
|
|
}
|
|
|
|
|
|
- ofs -= key->get_width() + get_theme_constant(SNAME("h_separation"), SNAME("Tree"));
|
|
|
+ ofs -= key->get_width() + half_padding + get_theme_constant(SNAME("h_separation"), SNAME("Tree"));
|
|
|
+ keying_rect = Rect2(ofs, 0, key->get_width() + padding, size.height);
|
|
|
+
|
|
|
+ Point2 rtl_pos = Point2();
|
|
|
+ if (rtl) {
|
|
|
+ rtl_pos = Point2(size.width - keying_rect.position.x - (key->get_width() + padding), keying_rect.position.y);
|
|
|
+ }
|
|
|
|
|
|
Color color2(1, 1, 1);
|
|
|
if (keying_hover) {
|
|
|
color2.r *= 1.2;
|
|
|
color2.g *= 1.2;
|
|
|
color2.b *= 1.2;
|
|
|
+
|
|
|
+ Ref<StyleBox> sb_hover = get_theme_stylebox(SceneStringName(hover), "Button");
|
|
|
+ if (rtl) {
|
|
|
+ draw_style_box(sb_hover, Rect2(rtl_pos, keying_rect.size));
|
|
|
+ } else {
|
|
|
+ draw_style_box(sb_hover, keying_rect);
|
|
|
+ }
|
|
|
}
|
|
|
- keying_rect = Rect2(ofs, ((size.height - key->get_height()) / 2), key->get_width(), key->get_height());
|
|
|
+
|
|
|
if (rtl) {
|
|
|
- draw_texture(key, Vector2(size.width - keying_rect.position.x - key->get_width(), keying_rect.position.y), color2);
|
|
|
+ draw_texture(key, rtl_pos + Point2(padding, size.height - key->get_height()) / 2, color2);
|
|
|
} else {
|
|
|
- draw_texture(key, keying_rect.position, color2);
|
|
|
+ draw_texture(key, keying_rect.position + Point2(padding, size.height - key->get_height()) / 2, color2);
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
@@ -518,19 +546,32 @@ void EditorProperty::_notification(int p_what) {
|
|
|
|
|
|
close = get_editor_theme_icon(SNAME("Close"));
|
|
|
|
|
|
- ofs -= close->get_width() + get_theme_constant(SNAME("h_separation"), SNAME("Tree"));
|
|
|
+ ofs -= close->get_width() + half_padding + get_theme_constant(SNAME("h_separation"), SNAME("Tree"));
|
|
|
+ delete_rect = Rect2(ofs, 0, close->get_width() + padding, size.height);
|
|
|
+
|
|
|
+ Point2 rtl_pos = Point2();
|
|
|
+ if (rtl) {
|
|
|
+ rtl_pos = Point2(size.width - delete_rect.position.x - (close->get_width() + padding), delete_rect.position.y);
|
|
|
+ }
|
|
|
|
|
|
Color color2(1, 1, 1);
|
|
|
if (delete_hover) {
|
|
|
color2.r *= 1.2;
|
|
|
color2.g *= 1.2;
|
|
|
color2.b *= 1.2;
|
|
|
+
|
|
|
+ Ref<StyleBox> sb_hover = get_theme_stylebox(SceneStringName(hover), "Button");
|
|
|
+ if (rtl) {
|
|
|
+ draw_style_box(sb_hover, Rect2(rtl_pos, delete_rect.size));
|
|
|
+ } else {
|
|
|
+ draw_style_box(sb_hover, delete_rect);
|
|
|
+ }
|
|
|
}
|
|
|
- delete_rect = Rect2(ofs, ((size.height - close->get_height()) / 2), close->get_width(), close->get_height());
|
|
|
+
|
|
|
if (rtl) {
|
|
|
- draw_texture(close, Vector2(size.width - delete_rect.position.x - close->get_width(), delete_rect.position.y), color2);
|
|
|
+ draw_texture(close, rtl_pos + Point2(padding, size.height - close->get_height()) / 2, color2);
|
|
|
} else {
|
|
|
- draw_texture(close, delete_rect.position, color2);
|
|
|
+ draw_texture(close, delete_rect.position + Point2(padding, size.height - close->get_height()) / 2, color2);
|
|
|
}
|
|
|
} else {
|
|
|
delete_rect = Rect2();
|
|
|
@@ -547,6 +588,15 @@ void EditorProperty::_notification(int p_what) {
|
|
|
get_parent()->disconnect(SceneStringName(theme_changed), callable_mp(this, &EditorProperty::_update_property_bg));
|
|
|
}
|
|
|
} break;
|
|
|
+ case NOTIFICATION_MOUSE_EXIT: {
|
|
|
+ if (keying_hover || revert_hover || check_hover || delete_hover) {
|
|
|
+ keying_hover = false;
|
|
|
+ revert_hover = false;
|
|
|
+ check_hover = false;
|
|
|
+ delete_hover = false;
|
|
|
+ queue_redraw();
|
|
|
+ }
|
|
|
+ } break;
|
|
|
}
|
|
|
}
|
|
|
|