アンカー座標の絶対設定とtrack個数正規化を追加

このコミットが含まれているのは:
routersys committed 2026-07-04 16:25:06 +09:00
1 親 8428057eb4
コミット 36b2ada16a
1ファイル変更
+36
+36
ファイルの表示
@@ -9,6 +9,13 @@ namespace LuaScript.Anchor
public static int ClampCount(int count) => Math.Clamp(count, 0, MaxAnchors);
public static int NormalizeCount(string group, int count)
{
if (count <= 0 && string.Equals(group, TrackGroup, StringComparison.Ordinal))
return 1;
return ClampCount(count);
}
public static void ApplyOption(string option, ref AnchorConnection connection, ref bool is3D)
{
switch (option)
@@ -52,6 +59,35 @@ namespace LuaScript.Anchor
z = 0d;
}
public static ImmutableList<LuaAnchorPoint> SetPosition(
ImmutableList<LuaAnchorPoint> source, string group, int index, double x, double y, double z)
{
for (int i = 0; i < source.Count; i++)
{
var a = source[i];
if (a.Index == index && string.Equals(a.Group, group, StringComparison.Ordinal))
{
return source.SetItem(i, new LuaAnchorPoint
{
Group = group,
Index = index,
X = x,
Y = y,
Z = z,
});
}
}
return source.Add(new LuaAnchorPoint
{
Group = group,
Index = index,
X = x,
Y = y,
Z = z,
});
}
public static ImmutableList<LuaAnchorPoint> ApplyDrag(
ImmutableList<LuaAnchorPoint> source, string group, int index, double dx, double dy, double dz)
{