Add project files.

This commit is contained in:
Ankitkumar Satapara
2026-04-17 22:31:58 +05:30
commit 21aaef6776
473 changed files with 50152 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
namespace Nodify.Interactivity
{
public static partial class ConnectionState
{
internal static void RegisterDefaultHandlers()
{
InputProcessor.Shared<BaseConnection>.RegisterHandlerFactory(elem => new Disconnect(elem));
InputProcessor.Shared<BaseConnection>.RegisterHandlerFactory(elem => new Split(elem));
}
}
}

View File

@@ -0,0 +1,41 @@
using System.Windows.Input;
namespace Nodify.Interactivity
{
public static partial class ConnectionState
{
/// <summary>
/// Represents a state in which a connection can be disconnected from its connectors based on specific gestures.
/// </summary>
public class Disconnect : InputElementState<BaseConnection>
{
/// <summary>
/// Initializes a new instance of the <see cref="Disconnect"/> class.
/// </summary>
/// <param name="connection">The <see cref="BaseConnection"/> element associated with this state.</param>
public Disconnect(BaseConnection connection) : base(connection)
{
}
protected override void OnMouseDown(MouseButtonEventArgs e)
{
EditorGestures.ConnectionGestures gestures = EditorGestures.Mappings.Connection;
if (gestures.Disconnect.Matches(e.Source, e))
{
Element.Focus();
e.Handled = true; // prevent interacting with the editor
}
}
protected override void OnMouseUp(MouseButtonEventArgs e)
{
EditorGestures.ConnectionGestures gestures = EditorGestures.Mappings.Connection;
if (gestures.Disconnect.Matches(e.Source, e))
{
Element.Remove();
e.Handled = true; // prevent opening context menu
}
}
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Windows.Input;
namespace Nodify.Interactivity
{
public static partial class ConnectionState
{
/// <summary>
/// Represents a state in which a connection can be split.
/// </summary>
public class Split : InputElementState<BaseConnection>
{
/// <summary>
/// Initializes a new instance of the <see cref="Split"/> class.
/// </summary>
/// <param name="connection">The <see cref="BaseConnection"/> element associated with this state.</param>
public Split(BaseConnection connection) : base(connection)
{
}
protected override void OnMouseDown(MouseButtonEventArgs e)
{
EditorGestures.ConnectionGestures gestures = EditorGestures.Mappings.Connection;
if (gestures.Split.Matches(e.Source, e))
{
Element.Focus();
Element.SplitAtLocation(e.GetPosition(Element));
e.Handled = true; // prevent interacting with the editor
}
}
}
}
}