From 9128b455e6405f8d710f49d1ab224416dace660d Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Fri, 18 Mar 2022 01:05:41 +0200 Subject: [PATCH] Transparent canvas now works properly with scaled UI --- src/UI/UI.gd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/UI/UI.gd b/src/UI/UI.gd index 8bb061e26..bdfc99df1 100644 --- a/src/UI/UI.gd +++ b/src/UI/UI.gd @@ -18,6 +18,9 @@ func _on_main_canvas_visibility_changed() -> void: func update_transparent_shader() -> void: # Works independently of the transparency feature + var canvas_size: Vector2 = (main_canvas_container.rect_size - Vector2.DOWN * 2) * Global.shrink material.set("shader_param/screen_resolution", get_viewport().size) - material.set("shader_param/position", main_canvas_container.rect_global_position) - material.set("shader_param/size", main_canvas_container.rect_size - Vector2.ONE * 2) + material.set( + "shader_param/position", main_canvas_container.rect_global_position * Global.shrink + ) + material.set("shader_param/size", canvas_size)