pandemonium_engine_easy_charts/addons/easy_charts/Utilities/Point/PointData.gd

49 lines
1.3 KiB
GDScript3
Raw Normal View History

2020-08-04 15:22:30 +02:00
tool
2020-05-14 02:36:45 +02:00
extends PanelContainer
class_name PointData
2020-05-14 02:36:45 +02:00
var value : String = ""
var position : Vector2 = Vector2()
var OFFSET : Vector2 = Vector2(15,35)
var GAP : Vector2 = Vector2(0,15)
onready var Data : Label = $PointData/Value/x
onready var Value : Label = $PointData/Value/y
onready var Function : Label = $PointData/Function
func _ready():
2020-08-04 15:22:30 +02:00
pass
2020-05-14 02:36:45 +02:00
func _process(delta):
2020-08-04 15:22:30 +02:00
if get_global_mouse_position().y > OFFSET.y + GAP.y:
rect_position = get_global_mouse_position() - OFFSET - GAP
else:
rect_position = get_global_mouse_position() + GAP*5 - OFFSET
2020-05-14 02:36:45 +02:00
func update_datas(point : Control):
2020-08-04 15:22:30 +02:00
update_size()
get("custom_styles/panel").set("bg_color",point.color)
var font_color : Color
if point.color.g < 0.75:
font_color = Color(1,1,1,1)
else:
font_color = Color(0,0,0,1)
Data.set("custom_colors/font_color",font_color)
Value.set("custom_colors/font_color",font_color)
Function.set("custom_colors/font_color",font_color)
get("custom_styles/panel").set("border_color",font_color)
Data.set_text(point.point_value[0]+":")
Value.set_text(point.point_value[1])
Function.set_text(point.function)
update()
show()
2020-05-14 02:36:45 +02:00
func update_size():
2020-08-04 15:22:30 +02:00
OFFSET.x = get_size().x/2
OFFSET.y = get_size().y
GAP.y = OFFSET.y/3