From bcf13dc1756d3668478204eaace47db77942346a Mon Sep 17 00:00:00 2001 From: kobewi Date: Sun, 13 Mar 2022 16:02:24 +0100 Subject: Expose methods for screen-space transforms --- doc/classes/CanvasItem.xml | 7 +++++++ doc/classes/Control.xml | 13 +++++++++++++ doc/classes/Viewport.xml | 1 + 3 files changed, 21 insertions(+) (limited to 'doc/classes') diff --git a/doc/classes/CanvasItem.xml b/doc/classes/CanvasItem.xml index d71762801c..c7451509f3 100644 --- a/doc/classes/CanvasItem.xml +++ b/doc/classes/CanvasItem.xml @@ -355,6 +355,13 @@ Returns the mouse's position in this [CanvasItem] using the local coordinate system of this [CanvasItem]. + + + + Returns the transform of this [CanvasItem] in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins. + Equals to [method get_global_transform] if the window is embedded (see [member Viewport.gui_embed_subwindows]). + + diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 97fd584ed1..3163ac5610 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -417,6 +417,19 @@ Returns the position and size of the control relative to the top-left corner of the parent Control. See [member position] and [member size]. + + + + Returns the position of this [Control] in global screen coordinates (i.e. taking window position into account). Mostly useful for editor plugins. + Equals to [member global_position] if the window is embedded (see [member Viewport.gui_embed_subwindows]). + Example usage for showing a popup: + [codeblock] + popup_menu.position = get_screen_position() + get_local_mouse_position() + popup_menu.reset_size() + popup_menu.popup() + [/codeblock] + + diff --git a/doc/classes/Viewport.xml b/doc/classes/Viewport.xml index ce61f51b9a..825fbd108b 100644 --- a/doc/classes/Viewport.xml +++ b/doc/classes/Viewport.xml @@ -220,6 +220,7 @@ If [code]true[/code], the viewport will not receive input events. + If [code]true[/code], sub-windows (popups and dialogs) will be embedded inside application window as control-like nodes. If [code]false[/code], they will appear as separate windows handled by the operating system. If [code]true[/code], the GUI controls on the viewport will lay pixel perfectly. -- cgit v1.2.3