Implemente code for the take node and added functionality to take the list or array

This commit is contained in:
Ankitkumar Satapara
2026-04-18 21:27:35 +05:30
parent 5b6af2a76b
commit c14a2a730d
5 changed files with 222 additions and 3 deletions

View File

@@ -83,8 +83,7 @@ namespace Nodify.Calculator
sysOp = SystemOperations.TAKE,
IsFlowNode = false
};
takeNode.Input.Add("");
takeNode.Output.Add("");
takeNode.Input.Add("List");
var authNode = new OperationInfoViewModel()
{
@@ -322,6 +321,39 @@ namespace Nodify.Calculator
return authOp;
}
if (info.sysOp == SystemOperations.TAKE)
{
var takeOp = new TakeOperationViewModel
{
Title = info.Title,
SystemOperationType = SystemOperations.TAKE
};
// List input — accepts any shape but only list/array DataTypes
foreach (var item in input)
{
item.Shape = ConnectorShape.Circle;
item.ConnectorColor = Color.White;
item.IsCopyConnector = true;
item.IsTakeListConnector = true;
item.Title = "List";
takeOp.Input.Add(item);
}
// Nth index input (int type)
var nthConnector = new ConnectorViewModel
{
Title = "Nth",
Shape = ConnectorShape.Circle,
ConnectorColor = ConnectorViewModel.GetColorForType("int"),
DataType = "int"
};
takeOp.NthConnector = nthConnector;
takeOp.Input.Add(nthConnector);
return takeOp;
}
var sysOp = new SystemOperationViewModel
{
Title = info.Title,