Skip to content

Commit cc7863c

Browse files
fix: path drawing problem
1 parent f520c1d commit cc7863c

3 files changed

Lines changed: 39 additions & 35 deletions

File tree

FreeFrame/Components/Shapes/Path/DrawAttribute.cs

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -436,47 +436,43 @@ public override (Vector2i position, Vector2i? controlPosition) Information()
436436

437437
public override void UpdateLast()
438438
{
439-
Console.WriteLine("Update last");
440439
if (IsRelative)
441440
{
442-
Console.WriteLine("relativeee");
443441
if (X > X2)
444-
Last.X1 += X + X2;
442+
Last.X1 = X - X2 + X;
445443
else if (X < X2)
446-
Last.X1 += X - X2;
444+
Last.X1 = X2 - X + X2;
447445
else
448-
Last.X1 += X;
446+
Last.X1 = X2;
449447

450448
if (Y > Y2)
451-
Last.Y1 += Y + Y2;
449+
Last.Y1 = Y - Y2 + Y;
452450
else if (Y < Y2)
453-
Last.Y1 += Y - Y2;
451+
Last.Y1 = Y2 - Y + Y2;
454452
else
455-
Last.Y1 += Y;
456-
453+
Last.Y1 += Y2;
457454

458455
Last.X += X;
459456
Last.Y += Y;
460457
}
461458
else
462459
{
463-
Console.WriteLine("absolute");
464-
//if (X > X2)
465-
// Last.X1 = X + X2;
466-
//else if (X < X2)
467-
// Last.X1 = X - X2;
468-
//else
469-
// Last.X1 = X;
460+
if (X > X2)
461+
Last.X1 = X - X2 + X;
462+
else if (X < X2)
463+
Last.X1 = X2 - X + X2;
464+
else
465+
Last.X1 = X;
470466

471-
//if (Y > Y2)
472-
// Last.Y1 = Y + Y2;
473-
//else if (Y < Y2)
474-
// Last.Y1 = Y - Y2;
475-
//else
476-
// Last.Y1 = Y;
467+
if (Y > Y2)
468+
Last.Y1 = Y - Y2 + Y;
469+
else if (Y < Y2)
470+
Last.Y1 = Y2 - Y + Y2;
471+
else
472+
Last.Y1 = Y;
477473

478-
//Last.X = X;
479-
//Last.Y = Y;
474+
Last.X = X;
475+
Last.Y = Y;
480476
}
481477
}
482478
}
@@ -587,35 +583,37 @@ public override void UpdateLast()
587583
if (IsRelative)
588584
{
589585
if (X > X2)
590-
Last.X1 += X + X2;
586+
{
587+
Last.X1 = X - X2 + X;
588+
}
591589
else if (X < X2)
592-
Last.X1 += X - X2;
590+
Last.X1 = X2 - X + X2;
593591
else
594-
Last.X1 += X;
592+
Last.X1 = X;
595593

596594
if (Y > Y2)
597-
Last.Y1 += Y + Y2;
595+
Last.Y1 = Y - Y2 + Y;
598596
else if (Y < Y2)
599-
Last.Y1 += Y - Y2;
597+
Last.Y1 = Y2 - Y + Y2;
600598
else
601-
Last.Y1 += Y;
599+
Last.Y1 = Y;
602600

603601
Last.X += X;
604602
Last.Y += Y;
605603
}
606604
else
607605
{
608606
if (X > X2)
609-
Last.X1 = X + X2;
607+
Last.X1 = X - X2 + X;
610608
else if (X < X2)
611-
Last.X1 = X - X2;
609+
Last.X1 = X2 - X + X2;
612610
else
613611
Last.X1 = X;
614612

615613
if (Y > Y2)
616-
Last.Y1 = Y + Y2;
614+
Last.Y1 = Y - Y2 + Y;
617615
else if (Y < Y2)
618-
Last.Y1 = Y - Y2;
616+
Last.Y1 = Y2 - Y + Y2;
619617
else
620618
Last.Y1 = Y;
621619

FreeFrame/Components/Shapes/SVGPath.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public SVGPath(XmlReader reader)
5353
case 'm':
5454
DrawAttributes.Add(new MoveTo(match.Groups[1], match.Groups[2], c == 'm')); // 'm' is relative and 'M' absolute
5555
break;
56-
case 'L':
56+
case 'l':
5757
DrawAttributes.Add(new LineTo(match.Groups[1], match.Groups[2], c == 'l')); // 'l' is relative and 'L' absolute
5858
break;
5959
case 'h':

FreeFrame/Window.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
using SixLabors.ImageSharp.Processing;
2727
using AnimatedGif;
2828
using System.Drawing.Drawing2D;
29+
using System.Text.Json;
30+
using System.Text.Json.Serialization;
2931

3032
namespace FreeFrame
3133
{
@@ -1117,6 +1119,10 @@ public void SaveCurrentScreenToMP4()
11171119
w.Write(TakeSnap().ToMat());
11181120
}
11191121
}
1122+
public void SaveFreeFrameWorkspace()
1123+
{
1124+
string jsonString = JsonSerializer.Serialize(weatherForecast);
1125+
}
11201126
public void SaveCurrentScreenToGIF()
11211127
{
11221128
using (var gif = AnimatedGif.AnimatedGif.Create("output.gif", 1000 / _timeline.Fps))

0 commit comments

Comments
 (0)