Call text_to_pixels() when clicking again, instead of enter

Newline still does not work though
This commit is contained in:
OverloadedOrama 2020-10-13 14:24:37 +03:00
parent 1897c62eb4
commit fdd1833bd7
2 changed files with 7 additions and 11 deletions

View file

@ -429,11 +429,6 @@ cut={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":88,"unicode":0,"echo":false,"script":null)
]
}
enter={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777221,"unicode":0,"echo":false,"script":null)
]
}
[locale]

View file

@ -14,14 +14,10 @@ func _ready() -> void:
font.size = text_size
func _input(event : InputEvent) -> void:
if event.is_action_pressed("enter"):
text_to_pixels()
func draw_start(position : Vector2) -> void:
if text_edit:
return
text_to_pixels()
text_edit = TextEdit.new()
text_edit.text = ""
text_edit.rect_position = get_viewport().get_mouse_position()
@ -41,6 +37,11 @@ func draw_end(_position : Vector2) -> void:
func text_to_pixels() -> void:
if !text_edit:
return
if !text_edit.text:
text_edit.queue_free()
text_edit = null
return
var project : Project = Global.current_project
var size : Vector2 = project.size
var current_cel = project.frames[project.current_frame].cels[project.current_layer].image