Browse Source

Merge pull request #76646 from KoBeWi/acoording_to_screen

Some clarifications on screen-space coordinates
Max Hilbrunner 2 years ago
parent
commit
8c729f0f34
3 changed files with 3 additions and 1 deletions
  1. 1 0
      doc/classes/CanvasItem.xml
  2. 1 1
      doc/classes/DisplayServer.xml
  3. 1 0
      doc/classes/Window.xml

+ 1 - 0
doc/classes/CanvasItem.xml

@@ -423,6 +423,7 @@
 			<return type="Vector2" />
 			<description>
 				Returns the mouse's position in the [CanvasLayer] that this [CanvasItem] is in using the coordinate system of the [CanvasLayer].
+				[b]Note:[/b] For screen-space coordinates (e.g. when using a non-embedded [Popup]), you can use [method DisplayServer.mouse_get_position].
 			</description>
 		</method>
 		<method name="get_global_transform" qualifiers="const">

+ 1 - 1
doc/classes/DisplayServer.xml

@@ -821,7 +821,7 @@
 		<method name="mouse_get_position" qualifiers="const">
 			<return type="Vector2i" />
 			<description>
-				Returns the mouse cursor's current position.
+				Returns the mouse cursor's current position in screen coordinates.
 			</description>
 		</method>
 		<method name="mouse_set_mode">

+ 1 - 0
doc/classes/Window.xml

@@ -563,6 +563,7 @@
 		</member>
 		<member name="position" type="Vector2i" setter="set_position" getter="get_position" default="Vector2i(0, 0)">
 			The window's position in pixels.
+			If [member ProjectSettings.display/window/subwindows/embed_subwindows] is [code]false[/code], the position is in absolute screen coordinates. This typically applies to editor plugins. If the setting is [code]false[/code], the window's position is in the coordinates of its parent [Viewport].
 		</member>
 		<member name="size" type="Vector2i" setter="set_size" getter="get_size" default="Vector2i(100, 100)">
 			The window's size in pixels.