taqin/src/Styles.gd

27 lines
540 B
GDScript

extends Node
enum CornerType {
SINGLE,
LEFT,
MIDDLE,
RIGHT
}
var _rounded_styles = {}
func _ready():
pass # Replace with function body.
func get_key(name: String, corner_type) -> String:
return "%s_%s" % [name, CornerType.keys()[corner_type]]
func get_stylebox_flat(original: StyleBoxFlat, name: String, corner_type) -> StyleBoxFlat:
var key = get_key(name, corner_type)
if _rounded_styles.has(key):
return _rounded_styles[key]
if original != null:
return original.duplicate() as StyleBoxFlat
return StyleBoxFlat.new()