Added movement to DSL nodes to allow repositioning.
This commit is contained in:
@@ -87,6 +87,15 @@ public partial class CodingWindow : PanelContainer
|
||||
editorWindow.RemoveChild(editorDisplay);
|
||||
editorDisplay.QueueFree();
|
||||
};
|
||||
editorDisplay.OnMoveNode += (int direction) =>
|
||||
{
|
||||
int targetIndex = Mathf.Clamp(
|
||||
editorDisplay.GetIndex() + direction,
|
||||
0,
|
||||
editorWindow.GetChildCount() - 1
|
||||
);
|
||||
editorWindow.MoveChild(editorDisplay, targetIndex);
|
||||
};
|
||||
}
|
||||
|
||||
public void ClearWindow()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Godot;
|
||||
|
||||
public partial class NodeDisplay : PanelContainer
|
||||
{
|
||||
[Export] PanelContainer editorDisplay;
|
||||
@@ -10,6 +9,8 @@ public partial class NodeDisplay : PanelContainer
|
||||
|
||||
[Signal]
|
||||
public delegate void OnDeleteNodeEventHandler();
|
||||
[Signal]
|
||||
public delegate void OnMoveNodeEventHandler(int direction);
|
||||
|
||||
public void SetNode(ProgramNode node)
|
||||
{
|
||||
@@ -217,4 +218,14 @@ public partial class NodeDisplay : PanelContainer
|
||||
string amountString = parts[2].Replace("Amount:", "").Trim();
|
||||
valueContainer.GetNode<SpinBox>("./Amount").Value = int.Parse(amountString);
|
||||
}
|
||||
|
||||
public void MoveNodeUp()
|
||||
{
|
||||
EmitSignal(SignalName.OnMoveNode, -1);
|
||||
}
|
||||
|
||||
public void MoveNodeDown()
|
||||
{
|
||||
EmitSignal(SignalName.OnMoveNode, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user