@@ -1893,8 +1893,8 @@ void EditorInspectorSection::_notification(int p_what) {
1893
1893
Rect2 header_rect = Rect2 (Vector2 (header_offset_x, 0.0 ), Vector2 (header_width, header_height));
1894
1894
Color c = bg_color;
1895
1895
c.a *= 0.4 ;
1896
- if (foldable && header_rect. has_point ( get_local_mouse_position ()) ) {
1897
- c = c.lightened ((can_click_unfold && Input::get_singleton ()->is_mouse_button_pressed (MouseButton::LEFT) ) ? -0.05 : 0.2 );
1896
+ if (header_hover ) {
1897
+ c = c.lightened (Input::get_singleton ()->is_mouse_button_pressed (MouseButton::LEFT) ? -0.05 : 0.2 );
1898
1898
}
1899
1899
draw_rect (header_rect, c);
1900
1900
@@ -2059,14 +2059,18 @@ void EditorInspectorSection::_notification(int p_what) {
2059
2059
queue_redraw ();
2060
2060
} break ;
2061
2061
2062
+ case NOTIFICATION_MOUSE_EXIT_SELF:
2062
2063
case NOTIFICATION_MOUSE_EXIT: {
2063
2064
if (dropping_for_unfold) {
2064
2065
dropping_unfold_timer->stop ();
2065
2066
}
2066
2067
2067
- check_hover = false ;
2068
- keying_hover = false ;
2069
- queue_redraw ();
2068
+ if (header_hover || check_hover || keying_hover) {
2069
+ header_hover = false ;
2070
+ check_hover = false ;
2071
+ keying_hover = false ;
2072
+ queue_redraw ();
2073
+ }
2070
2074
} break ;
2071
2075
}
2072
2076
}
@@ -2166,11 +2170,11 @@ void EditorInspectorSection::setup(const String &p_section, const String &p_labe
2166
2170
2167
2171
void EditorInspectorSection::gui_input (const Ref<InputEvent> &p_event) {
2168
2172
ERR_FAIL_COND (p_event.is_null ());
2169
- bool has_children_to_show = vbox->get_child_count (false ) != 0 ;
2173
+ bool can_click_unfold = vbox->get_child_count (false ) != 0 && !(!checkbox_only && checkable && !checked) ;
2170
2174
2171
- Ref<InputEventMouse> me = p_event;
2172
- if (me .is_valid ()) {
2173
- Vector2 mpos = me ->get_position ();
2175
+ Ref<InputEventMouseMotion> mm = p_event;
2176
+ if (mm .is_valid ()) {
2177
+ Vector2 mpos = mm ->get_position ();
2174
2178
2175
2179
bool new_check_hover = check_rect.has_point (mpos);
2176
2180
if (new_check_hover != check_hover) {
@@ -2183,11 +2187,17 @@ void EditorInspectorSection::gui_input(const Ref<InputEvent> &p_event) {
2183
2187
keying_hover = new_keying_hover;
2184
2188
queue_redraw ();
2185
2189
}
2190
+
2191
+ bool new_header_hover = foldable && can_click_unfold && (get_local_mouse_position ().y < _get_header_height ());
2192
+ if (new_header_hover != header_hover) {
2193
+ header_hover = new_header_hover;
2194
+ queue_redraw ();
2195
+ }
2186
2196
}
2187
2197
2188
2198
Ref<InputEventKey> k = p_event;
2189
2199
if (k.is_valid () && k->is_pressed ()) {
2190
- if (foldable && has_children_to_show && !(checkable && !checked && !checkbox_only) && k->is_action (" ui_accept" , true )) {
2200
+ if (foldable && can_click_unfold && k->is_action (" ui_accept" , true )) {
2191
2201
accept_event ();
2192
2202
2193
2203
bool should_unfold = !object->editor_is_section_unfolded (section);
@@ -2224,7 +2234,7 @@ void EditorInspectorSection::gui_input(const Ref<InputEvent> &p_event) {
2224
2234
} else if (keying && keying_rect.has_point (pos)) {
2225
2235
emit_signal (SNAME (" property_keyed" ), related_enable_property, false );
2226
2236
} else if (foldable) {
2227
- bool should_unfold = has_children_to_show && !(checkable && !checked && !checkbox_only) && !object->editor_is_section_unfolded (section);
2237
+ bool should_unfold = can_click_unfold && !object->editor_is_section_unfolded (section);
2228
2238
if (should_unfold) {
2229
2239
unfold ();
2230
2240
} else {
@@ -2234,15 +2244,6 @@ void EditorInspectorSection::gui_input(const Ref<InputEvent> &p_event) {
2234
2244
} else if (mb.is_valid () && !mb->is_pressed ()) {
2235
2245
queue_redraw ();
2236
2246
}
2237
-
2238
- Ref<InputEventMouseMotion> mm = p_event;
2239
- if (mm.is_valid ()) {
2240
- int header_height = _get_header_height ();
2241
- Vector2 previous = mm->get_position () - mm->get_relative ();
2242
- if (has_children_to_show && ((mm->get_position ().y >= header_height) != (previous.y >= header_height))) {
2243
- queue_redraw ();
2244
- }
2245
- }
2246
2247
}
2247
2248
2248
2249
String EditorInspectorSection::get_section () const {
0 commit comments