Fix Snake for new lengths in LineCanvas (#2548)

This commit is contained in:
Thomas Nind
2023-04-16 01:17:58 +01:00
committed by GitHub
parent 9aaf84f96e
commit 889e66a7c4

View File

@@ -87,10 +87,10 @@ namespace UICatalog.Scenarios {
var canvas = new LineCanvas ();
canvas.AddLine (new Point (0, 0), State.Width - 1, Orientation.Horizontal, LineStyle.Double);
canvas.AddLine (new Point (0, 0), State.Height - 1, Orientation.Vertical, LineStyle.Double);
canvas.AddLine (new Point (0, State.Height - 1), State.Width - 1, Orientation.Horizontal, LineStyle.Double);
canvas.AddLine (new Point (State.Width - 1, 0), State.Height - 1, Orientation.Vertical, LineStyle.Double);
canvas.AddLine (new Point (0, 0), State.Width, Orientation.Horizontal, LineStyle.Double);
canvas.AddLine (new Point (0, 0), State.Height, Orientation.Vertical, LineStyle.Double);
canvas.AddLine (new Point (0, State.Height - 1), State.Width, Orientation.Horizontal, LineStyle.Double);
canvas.AddLine (new Point (State.Width - 1, 0), State.Height, Orientation.Vertical, LineStyle.Double);
for (int i = 1; i < State.Snake.Count; i++) {
@@ -99,8 +99,8 @@ namespace UICatalog.Scenarios {
var orientation = pt1.X == pt2.X ? Orientation.Vertical : Orientation.Horizontal;
var length = orientation == Orientation.Horizontal
? pt1.X > pt2.X ? 1 : -1
: pt1.Y > pt2.Y ? 1 : -1;
? pt1.X > pt2.X ? 2 : -2
: pt1.Y > pt2.Y ? 2 : -2;
canvas.AddLine (
pt2,