add rounded corner to popup panel

This commit is contained in:
Fabien Freling 2020-05-29 16:55:20 +02:00
parent 42c1b2b9f5
commit e758168757
3 changed files with 18 additions and 5 deletions

View file

@ -12,13 +12,25 @@ var preferences = ConfigFile.new()
var fade_duration = 0.2
var fade_scale_factor = 0.9
onready var popup = $"."
onready var panel = $Panel
onready var tween = $Tween
func _init():
var err = preferences.load(pref_path)
func _ready():
pass
assert(popup.theme != null)
var popup_style : = popup.get_stylebox("panel", "PopupPanel") as StyleBoxFlat
assert(popup_style != null)
var panel_style := panel.get_stylebox("panel", "Panel") as StyleBoxFlat
assert(panel_style != null)
var modified_panel_style = panel_style.duplicate()
modified_panel_style.corner_radius_bottom_left = popup_style.corner_radius_bottom_left
modified_panel_style.corner_radius_bottom_right = popup_style.corner_radius_bottom_right
modified_panel_style.corner_radius_top_left = popup_style.corner_radius_top_left
modified_panel_style.corner_radius_top_right = popup_style.corner_radius_top_right
panel.set("custom_styles/panel", modified_panel_style)
func fade_out():
tween.remove_all()