Use NOTIFICATION_MOUSE_EXIT instead of a signal for a few editor plugins

This commit is contained in:
VolTer 2023-05-31 20:03:04 +02:00
parent 6101240231
commit 6566b96b63
4 changed files with 12 additions and 22 deletions

View file

@ -39,13 +39,6 @@
#include "scene/gui/flow_container.h"
#include "scene/gui/separator.h"
void GradientTexture2DEdit::_on_mouse_exited() {
if (hovered != HANDLE_NONE) {
hovered = HANDLE_NONE;
queue_redraw();
}
}
Point2 GradientTexture2DEdit::_get_handle_pos(const Handle p_handle) {
// Get the handle's mouse position in pixels relative to offset.
return (p_handle == HANDLE_FROM ? texture->get_fill_from() : texture->get_fill_to()).clamp(Vector2(), Vector2(1, 1)) * size;
@ -168,9 +161,12 @@ void GradientTexture2DEdit::set_snap_count(int p_snap_count) {
void GradientTexture2DEdit::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE:
connect("mouse_exited", callable_mp(this, &GradientTexture2DEdit::_on_mouse_exited));
[[fallthrough]];
case NOTIFICATION_MOUSE_EXIT: {
if (hovered != HANDLE_NONE) {
hovered = HANDLE_NONE;
queue_redraw();
}
} break;
case NOTIFICATION_THEME_CHANGED: {
checkerboard->set_texture(get_theme_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons")));
} break;