Add window click-through support.

This commit is contained in:
bruvzg 2020-06-29 12:31:36 +03:00
parent fdfcce1c03
commit 6a14c72b12
No known key found for this signature in database
GPG key ID: FCED35F1CECE0D3A
10 changed files with 142 additions and 0 deletions

View file

@ -901,6 +901,30 @@
<description>
</description>
</method>
<method name="window_set_mouse_passthrough">
<return type="void">
</return>
<argument index="0" name="region" type="PackedVector2Array">
</argument>
<argument index="1" name="window_id" type="int" default="0">
</argument>
<description>
Sets a polygonal region of the window which accepts mouse events. Mouse events outside the region will be passed through.
Passing an empty array will disable passthrough support (all mouse events will be intercepted by the window, which is the default behavior).
[codeblock]
# Set region, using Path2D node.
DisplayServer.window_set_mouse_passthrough($Path2D.curve.get_baked_points())
# Set region, using Polygon2D node.
DisplayServer.window_set_mouse_passthrough($Polygon2D.polygon)
# Reset region to default.
DisplayServer.window_set_mouse_passthrough([])
[/codeblock]
[b]Note:[/b] On Windows, the portion of a window that lies outside the region is not drawn, while on Linux and macOS it is.
[b]Note:[/b] This method is implemented on Linux, macOS and Windows.
</description>
</method>
<method name="window_set_position">
<return type="void">
</return>