connection question

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By swipis
:warning: Old Version Published before Godot 3 was released.

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 “mouse_enter” and “mouse_exit” 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 :slight_smile:

Try unchecking “Stop mouse” on the children.

Bojidar Marinov | 2016-04-02 12:53

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

swipis | 2016-04-02 13:22

:bust_in_silhouette: Reply From: ulty

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

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

swipis | 2016-04-02 13:39