You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Task Requirement: "Socket groups must be at least 3 cm from plate edges"
55
+
// Task Requirement: "The anchor point is the bottom-left center of the first socket"
56
+
// Logic: Anchor point is 3.5cm inside the socket (center of 7x7cm socket)
57
+
// For socket edge to be exactly 3cm from plate edge: anchor must be at 3.0 + 3.5 = 6.5cm from plate edges
58
+
constDEFAULT_SOCKET_POSITION_X=MIN_EDGE_DISTANCE+3.5;// 6.5 cm
59
+
constDEFAULT_SOCKET_POSITION_Y=MIN_EDGE_DISTANCE+3.5;// 6.5 cm
60
+
53
61
exportdefaultfunctionSocketGenerator(){
54
62
// Task Requirement: "The app must maintain realistic proportions between plates and sockets, support user input, and be responsive across different screen sizes including mobile."
55
63
// Task Requirement: "On load, generate a default plate with predefined dimensions."
@@ -587,14 +595,14 @@ export default function SocketGenerator() {
587
595
// Logic: Check if the first valid plate is found.
588
596
if(firstValidPlate){
589
597
// Task Requirement: "The app must maintain realistic proportions between plates and sockets, support user input, and be responsive across different screen sizes including mobile."
590
-
// Logic: Create a new socket group.
598
+
// Logic: Create a new socket group with default position that ensures 3cm minimum distance from plate edges.
591
599
constnewSocketGroup: SocketGroup={
592
600
id: Date.now().toString(),
593
601
plateId: firstValidPlate.id,
594
602
count: 1,
595
603
direction: "vertical",
596
-
positionX: MIN_EDGE_DISTANCE,
597
-
positionY: MIN_EDGE_DISTANCE,
604
+
positionX: DEFAULT_SOCKET_POSITION_X,
605
+
positionY: DEFAULT_SOCKET_POSITION_Y,
598
606
};
599
607
// Task Requirement: "The app must maintain realistic proportions between plates and sockets, support user input, and be responsive across different screen sizes including mobile."
600
608
// Logic: Set the socket groups.
@@ -607,8 +615,8 @@ export default function SocketGenerator() {
// Find socket groups that belong to this plate BEFORE deletion
938
+
constdeletedSocketGroups=socketGroups.filter(
939
+
(sg)=>sg.plateId===plateId
940
+
);
941
+
929
942
// Task Requirement: "The app must maintain realistic proportions between plates and sockets, support user input, and be responsive across different screen sizes including mobile."
0 commit comments