From 0a017aee9f291f4e96ef72bf6080d34f29161ab1 Mon Sep 17 00:00:00 2001 From: Enis Pekedis Date: Thu, 7 Aug 2025 16:40:18 +0200 Subject: [PATCH] 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 --- src/Moryx.Factory/MachineLocation.cs | 80 ++++++++++++++-------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/Moryx.Factory/MachineLocation.cs b/src/Moryx.Factory/MachineLocation.cs index a5aff79..a9d545c 100644 --- a/src/Moryx.Factory/MachineLocation.cs +++ b/src/Moryx.Factory/MachineLocation.cs @@ -11,48 +11,48 @@ namespace Moryx.Factory { - /// - /// Class for MachineLocation in the factory - /// - public class MachineLocation : PublicResource, IMachineLocation - { - public IPublicResource Machine => Children.OfType().FirstOrDefault(); - - [DataMember, EntrySerialize] - public string SpecificIcon { get; set; } - - [DataMember, EntrySerialize] - public string Image { get; set; } - - /// - /// X position of the location - /// - [DataMember, EntrySerialize, DefaultValue(10)] - public double PositionX { get; set; } - /// - /// Y position of the location + /// Class for MachineLocation in the factory /// - [DataMember, EntrySerialize, DefaultValue(10)] - public double PositionY { get; set; } - - public Position Position + public class MachineLocation : PublicResource, IMachineLocation { - get => new() { PositionX = PositionX, PositionY = PositionY }; - set - { - PositionX = value.PositionX; - PositionY = value.PositionY; - } + public IPublicResource Machine => Children.OfType().FirstOrDefault(); + + [DataMember, EntrySerialize] + public string SpecificIcon { get; set; } + + [DataMember, EntrySerialize] + public string Image { get; set; } + + /// + /// X position of the location + /// + [DataMember, EntrySerialize, DefaultValue(0.5)] + public double PositionX { get; set; } + + /// + /// Y position of the location + /// + [DataMember, EntrySerialize, DefaultValue(0.5)] + public double PositionY { get; set; } + + public Position Position + { + get => new() { PositionX = PositionX, PositionY = PositionY }; + set + { + PositionX = value.PositionX; + PositionY = value.PositionY; + } + } + + [ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Source)] + public IReferences Origins { get; set; } + + [ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Target)] + public IReferences Destinations { get; set; } + + IEnumerable ILocation.Origins => Origins; + IEnumerable ILocation.Destinations => Destinations; } - - [ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Source)] - public IReferences Origins { get; set; } - - [ResourceReference(ResourceRelationType.TransportRoute, ResourceReferenceRole.Target)] - public IReferences Destinations { get; set; } - - IEnumerable ILocation.Origins => Origins; - IEnumerable ILocation.Destinations => Destinations; - } }