Просмотр исходного кода

Improve description of mouse_exited signal

(cherry picked from commit 4eec0032ea30dc3b61b9d0b623aa89bcdc40df21)
kobewi 3 лет назад
Родитель
Сommit
8012a48585
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      doc/classes/Control.xml

+ 6 - 0
doc/classes/Control.xml

@@ -846,6 +846,12 @@
 			<description>
 				Emitted when the mouse leaves the control's [code]Rect[/code] area, provided its [member mouse_filter] lets the event reach it.
 				[b]Note:[/b] [signal mouse_exited] will be emitted if the mouse enters a child [Control] node, even if the mouse cursor is still inside the parent's [code]Rect[/code] area.
+				If you want to check whether the mouse truly left the area, ignoring any top nodes, you can use code like this:
+				[codeblock]
+				func _on_mouse_exited():
+				    if not Rect2(Vector2(), rect_size).has_point(get_local_mouse_position()):
+				        # Not hovering over area.
+				[/codeblock]
 			</description>
 		</signal>
 		<signal name="resized">