mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-12-22 20:32:38 +01:00
Add back drag-n-drop for nodes (with left click). Copy ID with right click.
This commit is contained in:
parent
132d7eea32
commit
76167c5d15
1 changed files with 12 additions and 4 deletions
10
node.gd
10
node.gd
|
@ -7,6 +7,7 @@ var repository: Container
|
||||||
|
|
||||||
var children = {} setget children_set
|
var children = {} setget children_set
|
||||||
var id_always_visible = false
|
var id_always_visible = false
|
||||||
|
var held = false
|
||||||
|
|
||||||
var arrow = preload("res://arrow.tscn")
|
var arrow = preload("res://arrow.tscn")
|
||||||
|
|
||||||
|
@ -14,6 +15,9 @@ func _ready():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
if held:
|
||||||
|
global_position = get_global_mouse_position()
|
||||||
|
|
||||||
for c in children.keys():
|
for c in children.keys():
|
||||||
if get_node("..").objects.has(c):
|
if get_node("..").objects.has(c):
|
||||||
var other = get_node("..").objects[c]
|
var other = get_node("..").objects[c]
|
||||||
|
@ -80,7 +84,11 @@ func _on_unhover():
|
||||||
$ID.visible = false
|
$ID.visible = false
|
||||||
|
|
||||||
func _input_event(viewport, event, shape_idx):
|
func _input_event(viewport, event, shape_idx):
|
||||||
if event is InputEventMouseButton and event.pressed:
|
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")
|
var input = get_tree().get_current_scene().find_node("Terminal").find_node("Control").find_node("Input")
|
||||||
input.text += $ID.text
|
input.text += $ID.text
|
||||||
input.caret_position = input.text.length()
|
input.caret_position = input.text.length()
|
||||||
|
|
Loading…
Reference in a new issue