Skip to content

InputEventMouse

Inherits: InputEventWithModifiers < InputEventFromWindow < InputEvent < Resource < RefCounted < Object

Inherited by: InputEventMouseButton, InputEventMouseMotion

Base input event type for mouse events.

Stores general information about mouse events.

Type Name Default
BitField[MouseButtonMask] button_mask 0
int device 32 (overrides InputEvent)
Vector2 global_position Vector2(0, 0)
Vector2 position Vector2(0, 0)

button_mask

BitField[MouseButtonMask] button_mask = 0

The mouse button mask identifier, one of or a bitwise combination of the MouseButton button masks.

global_position

Vector2 global_position = Vector2(0, 0)

When received in Entity._input() or Entity._unhandled_input(), returns the mouse’s position in the root Viewport using the coordinate system of the root Viewport.

When received in Control._gui_input(), returns the mouse’s position in the CanvasLayer that the Control is in using the coordinate system of the CanvasLayer.

position

Vector2 position = Vector2(0, 0)

When received in Entity._input() or Entity._unhandled_input(), returns the mouse’s position in the Viewport this Entity is in using the coordinate system of this Viewport.

When received in Control._gui_input(), returns the mouse’s position in the Control using the local coordinate system of the Control.