mirror of
https://github.com/godotengine/godot.git
synced 2024-11-10 06:03:09 +00:00
Editor: Fix EditorHelpBitTooltip
for Signals dock
This commit is contained in:
parent
20ba2f00bd
commit
ec2f9355f5
@ -3761,6 +3761,12 @@ EditorHelpBit::EditorHelpBit(const String &p_symbol) {
|
|||||||
|
|
||||||
/// EditorHelpBitTooltip ///
|
/// EditorHelpBitTooltip ///
|
||||||
|
|
||||||
|
void EditorHelpBitTooltip::_start_timer() {
|
||||||
|
if (timer->is_inside_tree() && timer->is_stopped()) {
|
||||||
|
timer->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EditorHelpBitTooltip::_safe_queue_free() {
|
void EditorHelpBitTooltip::_safe_queue_free() {
|
||||||
if (_pushing_input > 0) {
|
if (_pushing_input > 0) {
|
||||||
_need_free = true;
|
_need_free = true;
|
||||||
@ -3769,13 +3775,20 @@ void EditorHelpBitTooltip::_safe_queue_free() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorHelpBitTooltip::_target_gui_input(const Ref<InputEvent> &p_event) {
|
||||||
|
const Ref<InputEventMouse> mouse_event = p_event;
|
||||||
|
if (mouse_event.is_valid()) {
|
||||||
|
_start_timer();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EditorHelpBitTooltip::_notification(int p_what) {
|
void EditorHelpBitTooltip::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_WM_MOUSE_ENTER:
|
case NOTIFICATION_WM_MOUSE_ENTER:
|
||||||
timer->stop();
|
timer->stop();
|
||||||
break;
|
break;
|
||||||
case NOTIFICATION_WM_MOUSE_EXIT:
|
case NOTIFICATION_WM_MOUSE_EXIT:
|
||||||
timer->start();
|
_start_timer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3783,7 +3796,7 @@ void EditorHelpBitTooltip::_notification(int p_what) {
|
|||||||
// Forwards non-mouse input to the parent viewport.
|
// Forwards non-mouse input to the parent viewport.
|
||||||
void EditorHelpBitTooltip::_input_from_window(const Ref<InputEvent> &p_event) {
|
void EditorHelpBitTooltip::_input_from_window(const Ref<InputEvent> &p_event) {
|
||||||
if (p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) {
|
if (p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) {
|
||||||
hide(); // Will be deleted on its timer.
|
_safe_queue_free();
|
||||||
} else {
|
} else {
|
||||||
const Ref<InputEventMouse> mouse_event = p_event;
|
const Ref<InputEventMouse> mouse_event = p_event;
|
||||||
if (mouse_event.is_null()) {
|
if (mouse_event.is_null()) {
|
||||||
@ -3801,7 +3814,7 @@ void EditorHelpBitTooltip::_input_from_window(const Ref<InputEvent> &p_event) {
|
|||||||
void EditorHelpBitTooltip::show_tooltip(EditorHelpBit *p_help_bit, Control *p_target) {
|
void EditorHelpBitTooltip::show_tooltip(EditorHelpBit *p_help_bit, Control *p_target) {
|
||||||
ERR_FAIL_NULL(p_help_bit);
|
ERR_FAIL_NULL(p_help_bit);
|
||||||
EditorHelpBitTooltip *tooltip = memnew(EditorHelpBitTooltip(p_target));
|
EditorHelpBitTooltip *tooltip = memnew(EditorHelpBitTooltip(p_target));
|
||||||
p_help_bit->connect("request_hide", callable_mp(static_cast<Window *>(tooltip), &Window::hide)); // Will be deleted on its timer.
|
p_help_bit->connect("request_hide", callable_mp(tooltip, &EditorHelpBitTooltip::_safe_queue_free));
|
||||||
tooltip->add_child(p_help_bit);
|
tooltip->add_child(p_help_bit);
|
||||||
p_target->get_viewport()->add_child(tooltip);
|
p_target->get_viewport()->add_child(tooltip);
|
||||||
p_help_bit->update_content_height();
|
p_help_bit->update_content_height();
|
||||||
@ -3858,8 +3871,8 @@ EditorHelpBitTooltip::EditorHelpBitTooltip(Control *p_target) {
|
|||||||
add_child(timer);
|
add_child(timer);
|
||||||
|
|
||||||
ERR_FAIL_NULL(p_target);
|
ERR_FAIL_NULL(p_target);
|
||||||
p_target->connect(SceneStringName(mouse_entered), callable_mp(timer, &Timer::stop));
|
p_target->connect(SceneStringName(mouse_exited), callable_mp(this, &EditorHelpBitTooltip::_start_timer));
|
||||||
p_target->connect(SceneStringName(mouse_exited), callable_mp(timer, &Timer::start).bind(-1));
|
p_target->connect(SceneStringName(gui_input), callable_mp(this, &EditorHelpBitTooltip::_target_gui_input));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)
|
#if defined(MODULE_GDSCRIPT_ENABLED) || defined(MODULE_MONO_ENABLED)
|
||||||
|
@ -329,7 +329,9 @@ class EditorHelpBitTooltip : public PopupPanel {
|
|||||||
int _pushing_input = 0;
|
int _pushing_input = 0;
|
||||||
bool _need_free = false;
|
bool _need_free = false;
|
||||||
|
|
||||||
|
void _start_timer();
|
||||||
void _safe_queue_free();
|
void _safe_queue_free();
|
||||||
|
void _target_gui_input(const Ref<InputEvent> &p_event);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _notification(int p_what);
|
void _notification(int p_what);
|
||||||
|
Loading…
Reference in New Issue
Block a user