0 votes

Here is picture:
enter image description here

  1. white background is a panel
  2. other is buttons, label, and 2 progressbar's

Im trying to check when mouse is on the panel, I made simple connection "mouseenter" and "mouseexit" and its kind'a working. If mouse is on white space its true (mouse is on the panel), but if mouse is on buttons, label, or progressbar return false (mouse is not on the panel). On other engines will return true on all children's as well, so do I need to make "mouse_enter" to all children separately?
sorry for my english :)

in Engine by (111 points)

Try unchecking "Stop mouse" on the children.

thanks, but by unchecking Stop Mouse still same , but check Ignore Mouse helped :)

1 Answer

0 votes

Here is how I would solve the problem. I'm checking on every mouse exit event if the mouse is still inside the global rectangle of the control node. This will however fail if the Button is directly on the edge of the control nodes rectangle.
Un- checking the "Stop mouse" parameter of the children did not work as far as I can tell.


"replaced global_mouse_pos with get_tree().get_root().get_mouse_pos()"

extends Control

var mouse_inside = false

func _ready():

func out_():
    if( get_global_rect().has_point(  get_tree().get_root().get_mouse_pos()  )):
        print("mouse over button")
        print("mouse outside")
        mouse_inside = false

func in_():
    mouse_inside = true
by (176 points)
edited by

Ignore Mouse worked just for label and progressbar's, cannot ignore mouse on buttons :)

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.