2019-10-12 08:30:46 +02:00
|
|
|
tool
|
2019-10-21 23:58:14 +02:00
|
|
|
extends MMGraphNodeBase
|
2019-10-12 08:30:46 +02:00
|
|
|
|
|
|
|
onready var label = $VBox/Label
|
|
|
|
onready var editor = $VBox/TextEdit
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func set_generator(g) -> void:
|
2019-10-12 08:30:46 +02:00
|
|
|
generator = g
|
|
|
|
label.text = generator.text
|
|
|
|
rect_size = generator.size
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func _on_resize_request(new_size) -> void:
|
2019-10-12 08:30:46 +02:00
|
|
|
rect_size = new_size
|
|
|
|
generator.size = new_size
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func _on_Label_gui_input(ev) -> void:
|
2019-10-12 08:30:46 +02:00
|
|
|
if ev is InputEventMouseButton and ev.doubleclick and ev.button_index == BUTTON_LEFT:
|
|
|
|
editor.rect_min_size = label.rect_size + Vector2(0, rect_size.y - get_minimum_size().y)
|
|
|
|
editor.text = label.text
|
|
|
|
label.visible = false
|
|
|
|
editor.visible = true
|
|
|
|
editor.select_all()
|
|
|
|
editor.grab_focus()
|
|
|
|
|
2019-10-20 16:22:06 +02:00
|
|
|
func _on_TextEdit_focus_exited() -> void:
|
2019-10-12 08:30:46 +02:00
|
|
|
label.text = editor.text
|
|
|
|
generator.text = editor.text
|
|
|
|
label.visible = true
|
|
|
|
editor.visible = false
|
2019-10-21 23:58:14 +02:00
|
|
|
|