Skip to content

Commit 0a017ae

Browse files
committed
Set default machine location to visible coordinates
- Previously, new machines were intialized at position (10,10), placing them outside the visible are of the factory monitor - Updated the default location to (0.5, 0.5) to ensure newly created resources are always visible and interactable
1 parent 57410dd commit 0a017ae

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

src/Moryx.Factory/MachineLocation.cs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -11,48 +11,48 @@
1111

1212
namespace Moryx.Factory
1313
{
14-
/// <summary>
15-
/// Class for MachineLocation in the factory
16-
/// </summary>
17-
public class MachineLocation : PublicResource, IMachineLocation
18-
{
19-
public IPublicResource Machine => Children.OfType<ICell>().FirstOrDefault();
20-
21-
[DataMember, EntrySerialize]
22-
public string SpecificIcon { get; set; }
23-
24-
[DataMember, EntrySerialize]
25-
public string Image { get; set; }
26-
27-
/// <summary>
28-
/// X position of the location
29-
/// </summary>
30-
[DataMember, EntrySerialize, DefaultValue(10)]
31-
public double PositionX { get; set; }
32-
3314
/// <summary>
34-
/// Y position of the location
15+
/// Class for MachineLocation in the factory
3516
/// </summary>
36-
[DataMember, EntrySerialize, DefaultValue(10)]
37-
public double PositionY { get; set; }
38-
39-
public Position Position
17+
public class MachineLocation : PublicResource, IMachineLocation
4018
{
41-
get => new() { PositionX = PositionX, PositionY = PositionY };
42-
set
43-
{
44-
PositionX = value.PositionX;
45-
PositionY = value.PositionY;
46-
}
19+
public IPublicResource Machine => Children.OfType<ICell>().FirstOrDefault();
20+
21+
[DataMember, EntrySerialize]
22+
public string SpecificIcon { get; set; }
23+
24+
[DataMember, EntrySerialize]
25+
public string Image { get; set; }
26+
27+
/// <summary>
28+
/// X position of the location
29+
/// </summary>
30+
[DataMember, EntrySerialize, DefaultValue(0.5)]
31+
public double PositionX { get; set; }
32+
33+
/// <summary>
34+
/// Y position of the location
35+
/// </summary>
36+
[DataMember, EntrySerialize, DefaultValue(0.5)]
37+
public double PositionY { get; set; }
38+
39+
public Position Position
40+
{
41+
get => new() { PositionX = PositionX, PositionY = PositionY };
42+
set
43+
{
44+
PositionX = value.PositionX;
45+
PositionY = value.PositionY;
46+
}
47+
}
48+
49+
[ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Source)]
50+
public IReferences<ITransportPath> Origins { get; set; }
51+
52+
[ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Target)]
53+
public IReferences<ITransportPath> Destinations { get; set; }
54+
55+
IEnumerable<ITransportPath> ILocation.Origins => Origins;
56+
IEnumerable<ITransportPath> ILocation.Destinations => Destinations;
4757
}
48-
49-
[ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Source)]
50-
public IReferences<ITransportPath> Origins { get; set; }
51-
52-
[ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Target)]
53-
public IReferences<ITransportPath> Destinations { get; set; }
54-
55-
IEnumerable<ITransportPath> ILocation.Origins => Origins;
56-
IEnumerable<ITransportPath> ILocation.Destinations => Destinations;
57-
}
5858
}

0 commit comments

Comments
 (0)