port from perforce
This commit is contained in:
25
intromat/Intromat/Nodes/Code/IntLiteralValue.cs
Normal file
25
intromat/Intromat/Nodes/Code/IntLiteralValue.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
|
||||
namespace Intromat.Nodes.Code
|
||||
{
|
||||
public class IntLiteralValue : LiteralValueBase<int>
|
||||
{
|
||||
public int EvaluateDimension()
|
||||
{
|
||||
var relativeDimension = RelativeSource switch
|
||||
{
|
||||
ERelativeSource.Parent => 1 << ParentValue,
|
||||
ERelativeSource.Input => InputValue,
|
||||
_ => 1
|
||||
};
|
||||
|
||||
var result = Value switch
|
||||
{
|
||||
< 0 => relativeDimension >> -Value,
|
||||
> 0 => relativeDimension << Value,
|
||||
_ => relativeDimension
|
||||
};
|
||||
return Math.Max(1, Math.Min(8192, result));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user