2020-08-04 15:22:30 +02:00
|
|
|
tool
|
2020-05-14 02:36:45 +02:00
|
|
|
extends VBoxContainer
|
2020-11-09 18:16:36 +01:00
|
|
|
class_name LegendElement
|
2020-05-14 02:36:45 +02:00
|
|
|
|
|
|
|
onready var Function : Label = $Function
|
|
|
|
onready var FunctionColor : ColorRect = $Color
|
|
|
|
|
2020-05-14 13:55:30 +02:00
|
|
|
var function : String setget set_function, get_function
|
|
|
|
var color : Color setget set_function_color, get_function_color
|
2020-05-14 02:36:45 +02:00
|
|
|
var font_color : Color
|
|
|
|
var font : Font
|
|
|
|
|
|
|
|
func _ready():
|
2020-11-09 18:16:36 +01:00
|
|
|
Function.set("custom_fonts/font",font)
|
|
|
|
Function.set("custom_colors/font_color",font_color)
|
|
|
|
Function.set_text(function)
|
|
|
|
FunctionColor.set_frame_color(color)
|
2020-05-14 02:36:45 +02:00
|
|
|
|
|
|
|
func create_legend(text : String, color : Color, font : Font, font_color : Color):
|
2020-11-09 18:16:36 +01:00
|
|
|
self.function = text
|
|
|
|
self.color = color
|
|
|
|
self.font_color = font_color
|
|
|
|
self.font = font
|
2020-05-14 13:55:30 +02:00
|
|
|
|
|
|
|
func set_function( t : String ):
|
2020-11-09 18:16:36 +01:00
|
|
|
function = t
|
2020-05-14 13:55:30 +02:00
|
|
|
|
|
|
|
func get_function() -> String:
|
2020-11-09 18:16:36 +01:00
|
|
|
return function
|
2020-05-14 13:55:30 +02:00
|
|
|
|
|
|
|
func set_function_color( c : Color ):
|
2020-11-09 18:16:36 +01:00
|
|
|
color = c
|
2020-05-14 13:55:30 +02:00
|
|
|
|
|
|
|
func get_function_color() -> Color:
|
2020-11-09 18:16:36 +01:00
|
|
|
return color
|
|
|
|
|
|
|
|
func get_class() -> String:
|
|
|
|
return "Legend Element"
|
|
|
|
|
|
|
|
func _to_string() -> String:
|
|
|
|
return "%s (%s, %s) " % [get_class(), get_function(), get_function_color().to_html(true)]
|