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

70 lines
1.7 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():
hide()
2020-05-14 02:36:45 +02:00
func _process(delta):
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):
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()
func update_slice_datas(slice : Slice):
update_size()
get("custom_styles/panel").set("bg_color",slice.color)
var font_color : Color
if slice.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(slice.x_value+":")
Value.set_text(slice.y_value)
Function.set_text(slice.function)
update()
show()
2020-05-14 02:36:45 +02:00
func update_size():
OFFSET.x = get_size().x/2
OFFSET.y = get_size().y
GAP.y = OFFSET.y/3