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,53 @@
using System;
using System.Globalization;
using System.Windows.Controls;
using System.Windows.Data;
namespace Nodify.Playground
{
public class FlowToConnectorPositionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is ConnectionViewModel connection)
{
var connector = parameter is "Input" ? connection.Input : connection.Output;
if (connector.Node is KnotNodeViewModel)
{
var otherConnector = connection.Input == connector ? connection.Output : connection.Input;
if (otherConnector.Node is KnotNodeViewModel)
{
return ToPosition(connector == connection.Input ? ConnectorFlow.Input : ConnectorFlow.Output, connector.Node.Orientation);
}
return ToPosition(otherConnector.Flow == ConnectorFlow.Output ? ConnectorFlow.Input : ConnectorFlow.Output, connector.Node.Orientation);
}
return ToPosition(connector.Flow, connector.Node.Orientation);
}
return value;
}
private ConnectorPosition ToPosition(ConnectorFlow flow, Orientation orientation)
{
if (orientation == Orientation.Horizontal)
{
return flow == ConnectorFlow.Output
? ConnectorPosition.Right
: ConnectorPosition.Left;
}
return flow == ConnectorFlow.Output
? ConnectorPosition.Bottom
: ConnectorPosition.Top;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,29 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace Nodify.Playground
{
public class FlowToDirectionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is ConnectorFlow flow)
{
return flow == ConnectorFlow.Output ? ConnectionDirection.Forward : ConnectionDirection.Backward;
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is ConnectionDirection dir)
{
return dir == ConnectionDirection.Forward ? ConnectorFlow.Output : ConnectorFlow.Input;
}
return value;
}
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;
namespace Nodify.Playground
{
public class UIntToRectConverter : MarkupExtension, IValueConverter
{
public uint Multiplier { get; set; } = 1;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
uint size = System.Convert.ToUInt32(value) * Multiplier;
return new Rect(0d, 0d, size, size);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
public override object ProvideValue(IServiceProvider serviceProvider)
=> this;
}
}