2021-11-22 02:47:41 +00:00
|
|
|
extends AcceptDialog
|
|
|
|
|
2022-10-03 11:43:08 +00:00
|
|
|
onready var slider: ValueSlider = $VBoxContainer/ValueSlider
|
2022-05-28 15:23:52 +00:00
|
|
|
onready var fullscreen_warning: Label = $VBoxContainer/FullscreenWarning
|
2022-08-08 00:21:08 +00:00
|
|
|
onready var main_canvas = Global.control.find_node("Main Canvas")
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
yield(get_tree(), "idle_frame")
|
|
|
|
Global.control.ui.connect("sort_children", self, "_recalculate_opacity")
|
2021-11-22 02:47:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_WindowOpacityDialog_about_to_show() -> void:
|
2022-05-28 14:29:38 +00:00
|
|
|
OS.window_per_pixel_transparency_enabled = true
|
2022-10-03 11:43:08 +00:00
|
|
|
slider.editable = !OS.window_fullscreen
|
|
|
|
fullscreen_warning.visible = !slider.editable
|
2021-11-22 02:47:41 +00:00
|
|
|
|
|
|
|
|
2022-10-03 11:43:08 +00:00
|
|
|
func _recalculate_opacity() -> void:
|
|
|
|
set_window_opacity(slider.value)
|
2021-11-25 12:48:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
func set_window_opacity(value: float) -> void:
|
2021-11-22 02:47:41 +00:00
|
|
|
if OS.window_fullscreen:
|
|
|
|
value = 100.0
|
2022-10-03 11:43:08 +00:00
|
|
|
slider.value = value
|
2021-11-22 02:47:41 +00:00
|
|
|
|
|
|
|
value = value / 100.0
|
2022-01-29 22:47:25 +00:00
|
|
|
for container in Global.control.ui._panel_container.get_children():
|
2022-10-03 11:43:08 +00:00
|
|
|
if container is TabContainer:
|
2022-08-08 00:21:08 +00:00
|
|
|
var point = container.get_rect().position + (container.get_rect().size / 2.0)
|
|
|
|
if main_canvas.get_rect().has_point(point):
|
|
|
|
container.self_modulate.a = value
|
|
|
|
else:
|
|
|
|
container.self_modulate.a = 1.0
|
2022-10-03 11:43:08 +00:00
|
|
|
Global.transparent_checker.update_transparency(value)
|
2021-11-22 02:47:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_WindowOpacityDialog_popup_hide() -> void:
|
|
|
|
Global.dialog_open(false)
|