2022-01-31 00:18:04 +00:00
|
|
|
extends Panel
|
|
|
|
|
|
|
|
onready var main_canvas_container = Global.main_canvas_container
|
|
|
|
|
|
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
|
|
func _ready() -> void:
|
|
|
|
update_transparent_shader()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_main_canvas_item_rect_changed() -> void:
|
|
|
|
update_transparent_shader()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_main_canvas_visibility_changed() -> void:
|
|
|
|
update_transparent_shader()
|
|
|
|
|
|
|
|
|
2022-03-05 22:15:25 +00:00
|
|
|
func update_transparent_shader() -> void:
|
|
|
|
# Works independently of the transparency feature
|
2022-03-17 23:05:41 +00:00
|
|
|
var canvas_size: Vector2 = (main_canvas_container.rect_size - Vector2.DOWN * 2) * Global.shrink
|
2022-01-31 00:18:04 +00:00
|
|
|
material.set("shader_param/screen_resolution", get_viewport().size)
|
2022-03-17 23:05:41 +00:00
|
|
|
material.set(
|
|
|
|
"shader_param/position", main_canvas_container.rect_global_position * Global.shrink
|
|
|
|
)
|
|
|
|
material.set("shader_param/size", canvas_size)
|