Reduce size of paths

This commit is contained in:
Dean Herbert 2019-06-13 18:06:24 +09:00
parent eb0f0aefba
commit 89c68c78d1
1 changed files with 10 additions and 1 deletions

View File

@ -25,6 +25,7 @@ public ProgressionPath(DrawableMatchPairing source, DrawableMatchPairing destina
protected override void LoadComplete()
{
base.LoadComplete();
Vector2 getCenteredVector(Vector2 top, Vector2 bottom) => new Vector2(top.X, top.Y + (bottom.Y - top.Y) / 2);
var q1 = Source.ScreenSpaceDrawQuad;
@ -56,7 +57,15 @@ protected override void LoadComplete()
var p3 = new Vector2(p2.X, c2.Y);
var p4 = new Vector2(c2.X, p3.Y);
Vertices = new[] { p1, p2, p3, p4 }.Select(ToLocalSpace).ToList();
var points = new[] { p1, p2, p3, p4 };
float minX = points.Min(p => p.X);
float minY = points.Min(p => p.Y);
var topLeft = new Vector2(minX, minY);
Position = Parent.ToLocalSpace(topLeft);
Vertices = points.Select(p => Parent.ToLocalSpace(p) - Parent.ToLocalSpace(topLeft)).ToList();
}
}
}