Merge pull request #57385 from madmiraal/update-mouse-pointer-definitions

Update definitions of get_mouse_position methods
This commit is contained in:
Rémi Verschelde 2022-02-05 16:09:52 +01:00 committed by GitHub
commit feb34dfb2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 14 deletions

View file

@ -334,7 +334,7 @@
<method name="get_global_mouse_position" qualifiers="const"> <method name="get_global_mouse_position" qualifiers="const">
<return type="Vector2" /> <return type="Vector2" />
<description> <description>
Returns the global position of the mouse. Returns the mouse's position in the [CanvasLayer] that this [CanvasItem] is in using the coordinate system of the [CanvasLayer].
</description> </description>
</method> </method>
<method name="get_global_transform" qualifiers="const"> <method name="get_global_transform" qualifiers="const">
@ -352,7 +352,7 @@
<method name="get_local_mouse_position" qualifiers="const"> <method name="get_local_mouse_position" qualifiers="const">
<return type="Vector2" /> <return type="Vector2" />
<description> <description>
Returns the mouse position relative to this item's position. Returns the mouse's position in this [CanvasItem] using the local coordinate system of this [CanvasItem].
</description> </description>
</method> </method>
<method name="get_transform" qualifiers="const"> <method name="get_transform" qualifiers="const">

View file

@ -14,10 +14,12 @@
The mouse button mask identifier, one of or a bitwise combination of the [enum MouseButton] button masks. The mouse button mask identifier, one of or a bitwise combination of the [enum MouseButton] button masks.
</member> </member>
<member name="global_position" type="Vector2" setter="set_global_position" getter="get_global_position" default="Vector2(0, 0)"> <member name="global_position" type="Vector2" setter="set_global_position" getter="get_global_position" default="Vector2(0, 0)">
The global mouse position relative to the current [Viewport]. If used in [method Control._gui_input] and if the current [Control] is not under the mouse, moving it will not update this value. When received in [method Node._input] or [method Node._unhandled_input], returns the mouse's position in the root [Viewport] using the coordinate system of the root [Viewport].
When received in [method Control._gui_input], returns the mouse's position in the [CanvasLayer] that the [Control] is in using the coordinate system of the [CanvasLayer].
</member> </member>
<member name="position" type="Vector2" setter="set_position" getter="get_position" default="Vector2(0, 0)"> <member name="position" type="Vector2" setter="set_position" getter="get_position" default="Vector2(0, 0)">
The local mouse position relative to the [Viewport]. If used in [method Control._gui_input], the position is relative to the current [Control] which is under the mouse. If the current [Control] is not under the mouse, moving it will not update this value. When received in [method Node._input] or [method Node._unhandled_input], returns the mouse's position in the [Viewport] this [Node] is in using the coordinate system of this [Viewport].
When received in [method Control._gui_input], returns the mouse's position in the [Control] using the local coordinate system of the [Control].
</member> </member>
</members> </members>
</class> </class>

View file

@ -52,7 +52,7 @@
It is only called if input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_input]. It is only called if input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_input].
To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called. To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called.
For gameplay input, [method _unhandled_input] and [method _unhandled_key_input] are usually a better fit as they allow the GUI to intercept the events first. For gameplay input, [method _unhandled_input] and [method _unhandled_key_input] are usually a better fit as they allow the GUI to intercept the events first.
[b]Note:[/b] This method is only called if the node is present in the scene tree (i.e. if it's not orphan). [b]Note:[/b] This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
</description> </description>
</method> </method>
<method name="_physics_process" qualifiers="virtual"> <method name="_physics_process" qualifiers="virtual">
@ -62,7 +62,7 @@
Called during the physics processing step of the main loop. Physics processing means that the frame rate is synced to the physics, i.e. the [code]delta[/code] variable should be constant. [code]delta[/code] is in seconds. Called during the physics processing step of the main loop. Physics processing means that the frame rate is synced to the physics, i.e. the [code]delta[/code] variable should be constant. [code]delta[/code] is in seconds.
It is only called if physics processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_physics_process]. It is only called if physics processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_physics_process].
Corresponds to the [constant NOTIFICATION_PHYSICS_PROCESS] notification in [method Object._notification]. Corresponds to the [constant NOTIFICATION_PHYSICS_PROCESS] notification in [method Object._notification].
[b]Note:[/b] This method is only called if the node is present in the scene tree (i.e. if it's not orphan). [b]Note:[/b] This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
</description> </description>
</method> </method>
<method name="_process" qualifiers="virtual"> <method name="_process" qualifiers="virtual">
@ -72,7 +72,7 @@
Called during the processing step of the main loop. Processing happens at every frame and as fast as possible, so the [code]delta[/code] time since the previous frame is not constant. [code]delta[/code] is in seconds. Called during the processing step of the main loop. Processing happens at every frame and as fast as possible, so the [code]delta[/code] time since the previous frame is not constant. [code]delta[/code] is in seconds.
It is only called if processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process]. It is only called if processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process].
Corresponds to the [constant NOTIFICATION_PROCESS] notification in [method Object._notification]. Corresponds to the [constant NOTIFICATION_PROCESS] notification in [method Object._notification].
[b]Note:[/b] This method is only called if the node is present in the scene tree (i.e. if it's not orphan). [b]Note:[/b] This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
</description> </description>
</method> </method>
<method name="_ready" qualifiers="virtual"> <method name="_ready" qualifiers="virtual">
@ -81,29 +81,29 @@
Called when the node is "ready", i.e. when both the node and its children have entered the scene tree. If the node has children, their [method _ready] callbacks get triggered first, and the parent node will receive the ready notification afterwards. Called when the node is "ready", i.e. when both the node and its children have entered the scene tree. If the node has children, their [method _ready] callbacks get triggered first, and the parent node will receive the ready notification afterwards.
Corresponds to the [constant NOTIFICATION_READY] notification in [method Object._notification]. See also the [code]@onready[/code] annotation for variables. Corresponds to the [constant NOTIFICATION_READY] notification in [method Object._notification]. See also the [code]@onready[/code] annotation for variables.
Usually used for initialization. For even earlier initialization, [method Object._init] may be used. See also [method _enter_tree]. Usually used for initialization. For even earlier initialization, [method Object._init] may be used. See also [method _enter_tree].
[b]Note:[/b] [method _ready] may be called only once for each node. After removing a node from the scene tree and adding again, [code]_ready[/code] will not be called for the second time. This can be bypassed with requesting another call with [method request_ready], which may be called anywhere before adding the node again. [b]Note:[/b] [method _ready] may be called only once for each node. After removing a node from the scene tree and adding it again, [code]_ready[/code] will not be called a second time. This can be bypassed by requesting another call with [method request_ready], which may be called anywhere before adding the node again.
</description> </description>
</method> </method>
<method name="_unhandled_input" qualifiers="virtual"> <method name="_unhandled_input" qualifiers="virtual">
<return type="void" /> <return type="void" />
<argument index="0" name="event" type="InputEvent" /> <argument index="0" name="event" type="InputEvent" />
<description> <description>
Called when an [InputEvent] hasn't been consumed by [method _input] or any GUI. The input event propagates up through the node tree until a node consumes it. Called when an [InputEvent] hasn't been consumed by [method _input] or any GUI [Control] item. The input event propagates up through the node tree until a node consumes it.
It is only called if unhandled input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_input]. It is only called if unhandled input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_input].
To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called. To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called.
For gameplay input, this and [method _unhandled_key_input] are usually a better fit than [method _input] as they allow the GUI to intercept the events first. For gameplay input, this and [method _unhandled_key_input] are usually a better fit than [method _input] as they allow the GUI to intercept the events first.
[b]Note:[/b] This method is only called if the node is present in the scene tree (i.e. if it's not orphan). [b]Note:[/b] This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
</description> </description>
</method> </method>
<method name="_unhandled_key_input" qualifiers="virtual"> <method name="_unhandled_key_input" qualifiers="virtual">
<return type="void" /> <return type="void" />
<argument index="0" name="event" type="InputEvent" /> <argument index="0" name="event" type="InputEvent" />
<description> <description>
Called when an [InputEventKey] or [InputEventShortcut] hasn't been consumed by [method _input] or any GUI. The input event propagates up through the node tree until a node consumes it. Called when an [InputEventKey] or [InputEventShortcut] hasn't been consumed by [method _input] or any GUI [Control] item. The input event propagates up through the node tree until a node consumes it.
It is only called if unhandled key input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_key_input]. It is only called if unhandled key input processing is enabled, which is done automatically if this method is overridden, and can be toggled with [method set_process_unhandled_key_input].
To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called. To consume the input event and stop it propagating further to other nodes, [method Viewport.set_input_as_handled] can be called.
For gameplay input, this and [method _unhandled_input] are usually a better fit than [method _input] as they allow the GUI to intercept the events first. For gameplay input, this and [method _unhandled_input] are usually a better fit than [method _input] as they allow the GUI to intercept the events first.
[b]Note:[/b] This method is only called if the node is present in the scene tree (i.e. if it's not orphan). [b]Note:[/b] This method is only called if the node is present in the scene tree (i.e. if it's not an orphan).
</description> </description>
</method> </method>
<method name="add_child"> <method name="add_child">

View file

@ -55,7 +55,7 @@
<method name="get_mouse_position" qualifiers="const"> <method name="get_mouse_position" qualifiers="const">
<return type="Vector2" /> <return type="Vector2" />
<description> <description>
Returns the mouse position relative to the viewport. Returns the mouse's positon in this [Viewport] using the coordinate system of this [Viewport].
</description> </description>
</method> </method>
<method name="get_render_info"> <method name="get_render_info">
@ -180,7 +180,7 @@
<return type="void" /> <return type="void" />
<argument index="0" name="to_position" type="Vector2" /> <argument index="0" name="to_position" type="Vector2" />
<description> <description>
Warps the mouse to a position relative to the viewport. Moves the mouse pointer to the specified position in this [Viewport] using the coordinate system of this [Viewport].
</description> </description>
</method> </method>
</methods> </methods>