+2 votes

Hello Everybody,

I've 2 instances of a control with a script that enlarges the control when the mouse is over.

But when i hover over the first control and than i click with left mouse button, if i hover on the second control, the event seems to be intercepted only by the first control.

This is the script:

extends Control


func _ready():
    connect("mouse_enter",self,"mouse_enter")
    connect("mouse_exit",self,"mouse_exit") 
    pass

func mouse_enter():
    self.set_scale(Vector2(1.5,1.5))

func mouse_exit():
    self.set_scale(Vector2(1,1))

I've tested adding a print when a controller catch events:

extends Control


func _ready():
    connect("mouse_enter",self,"mouse_enter")
    connect("mouse_exit",self,"mouse_exit") 
    pass

func mouse_enter():
    self.set_scale(Vector2(1.5,1.5))

func mouse_exit():
    self.set_scale(Vector2(1,1))

func _input_event(event):
    print("movingOver:",get_name())

there is a way (using a control node) to archieve this ? :
Click on a Control1 - > move mouse over Control2 - > catch mouse_enter ( or another event) on Control2

Thanks in advance,
nthrack

in Engine by (22 points)
reshown by

I've made ​​some tests :
the control capture Drag and Drop event when I keep pressed the left mouse button on it and no other events are passed to other controls .

I've changed the control with a Area2D and a collision shape and everything works correctly ,

Some one knows how to disable Drag and Drop on a Control or skip the event grab ?

TY

Same script on Area2D:

extends Area2D

func _ready():
    connect("mouse_enter",self,"mouse_enter")
    connect("mouse_exit",self,"mouse_exit") 
    pass

func mouse_enter():
    self.set_scale(Vector2(1.5,1.5))

func mouse_exit():
    self.set_scale(Vector2(1,1))

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.