From 76167c5d1580b61f0b784bcacd5ce115dcd59427 Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Fri, 4 Sep 2020 15:10:04 +0200 Subject: [PATCH] Add back drag-n-drop for nodes (with left click). Copy ID with right click. --- node.gd | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/node.gd b/node.gd index f69862e..c93715f 100644 --- a/node.gd +++ b/node.gd @@ -7,6 +7,7 @@ var repository: Container var children = {} setget children_set var id_always_visible = false +var held = false var arrow = preload("res://arrow.tscn") @@ -14,6 +15,9 @@ func _ready(): pass func _process(delta): + if held: + global_position = get_global_mouse_position() + for c in children.keys(): if get_node("..").objects.has(c): var other = get_node("..").objects[c] @@ -80,7 +84,11 @@ func _on_unhover(): $ID.visible = false func _input_event(viewport, event, shape_idx): - if event is InputEventMouseButton and event.pressed: - var input = get_tree().get_current_scene().find_node("Terminal").find_node("Control").find_node("Input") - input.text += $ID.text - input.caret_position = input.text.length() + if event is InputEventMouseButton: + if event.button_index == BUTTON_LEFT: + held = event.pressed + if event.button_index == BUTTON_RIGHT: + if event.pressed: + var input = get_tree().get_current_scene().find_node("Terminal").find_node("Control").find_node("Input") + input.text += $ID.text + input.caret_position = input.text.length()