Skip to content

Commit d20aff7

Browse files
authored
Add support for mini triangles (#204)
* Add support for mini triangles * Update version
1 parent 58599c3 commit d20aff7

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

Winleafs.Api/Endpoints/LayoutEndpoint.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using RestSharp;
1+
using Newtonsoft.Json;
2+
using RestSharp;
23
using System.Threading.Tasks;
34
using Winleafs.Api.Endpoints.Interfaces;
45
using Winleafs.Models.Models.Layouts;
@@ -27,8 +28,8 @@ public async Task<GlobalOrientation> GetGlobalOrientationAsync()
2728

2829
/// <inheritdoc />
2930
public Layout GetLayout()
30-
{
31-
return SendRequest<Layout>($"{BaseEndpoint}/layout", Method.GET);
31+
{
32+
return SendRequest<Layout>($"{BaseEndpoint}/layout", Method.GET);
3233
}
3334

3435
/// <inheritdoc />
@@ -45,6 +46,10 @@ public async Task<Layout> GetLayoutAsync()
4546
4647
return JsonConvert.DeserializeObject<Layout>("{\"numPanels\":10,\"sideLength\":0,\"positionData\":[{\"panelId\":17587,\"x\":201,\"y\":348,\"o\":0,\"shapeType\":8},{\"panelId\":24027,\"x\":134,\"y\":270,\"o\":300,\"shapeType\":8},{\"panelId\":48590,\"x\":100,\"y\":174,\"o\":360,\"shapeType\":8},{\"panelId\":614,\"x\":33,\"y\":96,\"o\":540,\"shapeType\":8},{\"panelId\":31646,\"x\":0,\"y\":0,\"o\":840,\"shapeType\":8},{\"panelId\":34370,\"x\":234,\"y\":444,\"o\":300,\"shapeType\":8},{\"panelId\":10501,\"x\":301,\"y\":522,\"o\":600,\"shapeType\":8},{\"panelId\":62516,\"x\":335,\"y\":618,\"o\":780,\"shapeType\":8},{\"panelId\":57725,\"x\":402,\"y\":696,\"o\":960,\"shapeType\":8},{\"panelId\":0,\"x\":234,\"y\":299,\"o\":180,\"shapeType\":12}]}");
4748
49+
Shape Mini Triangles (#203):
50+
51+
return JsonConvert.DeserializeObject<Layout>("{\"numPanels\":29,\"sideLength\":0,\"positionData\":[{\"panelId\":34842,\"x\":636,\"y\":348,\"o\":0,\"shapeType\":9},{\"panelId\":36029,\"x\":569,\"y\":387,\"o\":300,\"shapeType\":7},{\"panelId\":6201,\"x\":536,\"y\":290,\"o\":60,\"shapeType\":8},{\"panelId\":14320,\"x\":569,\"y\":193,\"o\":240,\"shapeType\":8},{\"panelId\":21152,\"x\":603,\"y\":135,\"o\":300,\"shapeType\":9},{\"panelId\":39145,\"x\":569,\"y\":77,\"o\":240,\"shapeType\":8},{\"panelId\":51617,\"x\":670,\"y\":58,\"o\":300,\"shapeType\":8},{\"panelId\":34715,\"x\":770,\"y\":77,\"o\":240,\"shapeType\":8},{\"panelId\":30460,\"x\":837,\"y\":116,\"o\":300,\"shapeType\":8},{\"panelId\":10658,\"x\":569,\"y\":0,\"o\":300,\"shapeType\":8},{\"panelId\":3094,\"x\":469,\"y\":406,\"o\":60,\"shapeType\":8},{\"panelId\":31138,\"x\":502,\"y\":464,\"o\":240,\"shapeType\":9},{\"panelId\":50952,\"x\":469,\"y\":484,\"o\":180,\"shapeType\":9},{\"panelId\":27007,\"x\":469,\"y\":522,\"o\":0,\"shapeType\":9},{\"panelId\":52562,\"x\":402,\"y\":561,\"o\":60,\"shapeType\":7},{\"panelId\":17027,\"x\":335,\"y\":638,\"o\":300,\"shapeType\":8},{\"panelId\":29479,\"x\":301,\"y\":696,\"o\":240,\"shapeType\":9},{\"panelId\":29503,\"x\":268,\"y\":754,\"o\":60,\"shapeType\":8},{\"panelId\":47039,\"x\":167,\"y\":774,\"o\":120,\"shapeType\":8},{\"panelId\":32578,\"x\":100,\"y\":851,\"o\":120,\"shapeType\":7},{\"panelId\":18316,\"x\":33,\"y\":774,\"o\":120,\"shapeType\":8},{\"panelId\":37457,\"x\":100,\"y\":696,\"o\":60,\"shapeType\":8},{\"panelId\":36123,\"x\":0,\"y\":832,\"o\":60,\"shapeType\":9},{\"panelId\":10210,\"x\":201,\"y\":870,\"o\":180,\"shapeType\":8},{\"panelId\":13224,\"x\":268,\"y\":870,\"o\":0,\"shapeType\":9},{\"panelId\":13021,\"x\":402,\"y\":638,\"o\":0,\"shapeType\":9},{\"panelId\":7419,\"x\":670,\"y\":406,\"o\":60,\"shapeType\":8},{\"panelId\":8799,\"x\":703,\"y\":464,\"o\":240,\"shapeType\":9},{\"panelId\":0,\"x\":636,\"y\":319,\"o\":180,\"shapeType\":12}]}");
52+
4853
Hexagons:
4954
return JsonConvert.DeserializeObject<Layout>(@"{
5055
""numPanels"": 4,

Winleafs.Models/Enums/ShapeType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public enum ShapeType
1010
PowerSupply = 5,
1111
ShapeHexagon = 7,
1212
ShapeTriangle = 8,
13+
ShapeMiniTriangle = 9,
1314
ULPController = 12
1415
}
1516
}

Winleafs.Models/Models/UserSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace Winleafs.Models.Models
1616
public class UserSettings
1717
{
1818
public static readonly string APPLICATIONNAME = "Winleafs";
19-
public static readonly string APPLICATIONVERSION = "v1.1.8";
19+
public static readonly string APPLICATIONVERSION = "v1.1.9";
2020

2121
public static readonly string SettingsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), APPLICATIONNAME);
2222

Winleafs.Wpf/Api/Layouts/PanelLayout.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public void GetLayout()
6262
break;
6363
case ShapeType.ShapeHexagon:
6464
case ShapeType.ShapeTriangle:
65+
case ShapeType.ShapeMiniTriangle:
6566
DeviceType = DeviceType.Shapes;
6667
break;
6768
default:
@@ -143,7 +144,12 @@ private void CreatePolygon(double x, double y, double rotation, int panelId,
143144
polygon = CreateRotatedTriangle(x, y, rotateTransform, globalRotationTransform, 135);
144145
break;
145146
}
146-
case ShapeType.ControlSquarePrimary:
147+
case ShapeType.ShapeMiniTriangle:
148+
{
149+
polygon = CreateRotatedTriangle(x, y, rotateTransform, globalRotationTransform, 68);
150+
break;
151+
}
152+
case ShapeType.ControlSquarePrimary:
147153
case ShapeType.ContolSquarePassive:
148154
case ShapeType.Square:
149155
{

0 commit comments

Comments
 (0)