prishasinghai commited on
Commit
d532f03
Β·
verified Β·
1 Parent(s): 32ce94b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +64 -77
index.html CHANGED
@@ -486,6 +486,21 @@
486
  };
487
  }
488
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
489
  // -------------------------------------------------------------
490
  // A. DRAW F1 CIRCUIT TRACK
491
  // -------------------------------------------------------------
@@ -521,107 +536,79 @@
521
 
522
  // -------------------------------------------------------------
523
  // B. DEFINE MAP NODES (Grandstands, Food, Hubs, Gates)
524
- // Coordinates adjusted outward to clear the track loop entirely
525
  // -------------------------------------------------------------
526
  const nodes = {
527
  // Grandstands
528
- "Hamilton GS": { pos: toCanvas(-2.2, -0.5), type: "gs", label: `Hamilton (${hamilton})` },
529
- "Becketts GS": { pos: toCanvas(1, 3.5), type: "gs", label: `Becketts (${becketts})` },
530
- "Stowe GS": { pos: toCanvas(3.5, 2), type: "gs", label: `Stowe (${stowe})` },
531
- "Village GS": { pos: toCanvas(-3.2, 1.8), type: "gs", label: `Village (${village})` },
532
- "Club GS": { pos: toCanvas(1.5, -3), type: "gs", label: `Club (${club})` },
533
 
534
  // Food Stalls & Arenas
535
- "Main Fan Zone": { pos: toCanvas(-2.2, 0.8), type: "food", label: "πŸ” Main Fan Zone" },
536
- "Becketts Food": { pos: toCanvas(1.8, 2.8), type: "food", label: "🌭 Becketts Food" },
537
- "Village Plaza": { pos: toCanvas(-2.8, 2.8), type: "food", label: "πŸ• Village Plaza" },
538
- "Club Eats": { pos: toCanvas(0.2, -2.2), type: "food", label: "🍦 Club Eats" },
539
 
540
  // Intermediate Junction Hubs
541
- "Arena Crossroad": { pos: toCanvas(-2.8, 0.2), type: "hub", label: "πŸ“ Arena Hub" },
542
- "Becketts Interchange": { pos: toCanvas(0.5, 2.2), type: "hub", label: "πŸ“ Becketts Hub" },
543
- "South Bypass": { pos: toCanvas(-0.8, -1.5), type: "hub", label: "πŸ“ South Hub" },
544
 
545
  // Gates
546
- "Main Gate 1": { pos: toCanvas(-3.8, -0.5), type: "gate", label: "πŸšͺ Main Gate 1" },
547
- "South Gate 2": { pos: toCanvas(1, -4.2), type: "gate", label: "πŸšͺ South Gate 2" },
548
- "East Gate 3": { pos: toCanvas(4.5, -1), type: "gate", label: "πŸšͺ East Gate 3" },
549
- "West Gate 4": { pos: toCanvas(-4.2, 2.8), type: "gate", label: "πŸšͺ West Gate 4" }
550
  };
551
 
552
  // -------------------------------------------------------------
553
  // C. INTERCONNECTED STANDARD PEDESTRIAN PATHS (GREEN / RED)
 
554
  // -------------------------------------------------------------
555
- const paths = [
556
- // Network towards Gate 1 (Turns Red on Gate 1 Bottleneck)
557
- { start: "Hamilton GS", end: "Arena Crossroad", color: isGate1Bottleneck ? "#ff4444" : "#00cc66" },
558
- { start: "Arena Crossroad", end: "Main Fan Zone", color: isGate1Bottleneck ? "#ff4444" : "#00cc66" },
559
- { start: "Main Fan Zone", end: "Main Gate 1", color: isGate1Bottleneck ? "#ff4444" : "#00cc66" },
560
- { start: "Village GS", end: "Arena Crossroad", color: isGate1Bottleneck ? "#ff4444" : "#00cc66" },
561
-
562
- // Network towards Becketts & Gate 3
563
- { start: "Becketts GS", end: "Becketts Interchange", color: isGate3Bottleneck ? "#ff4444" : "#00cc66" },
564
- { start: "Becketts Interchange", end: "Becketts Food", color: isGate3Bottleneck ? "#ff4444" : "#00cc66" },
565
- { start: "Becketts Interchange", end: "Main Fan Zone", color: isGate1Bottleneck ? "#ff4444" : "#00cc66" },
566
- { start: "Becketts Food", end: "Stowe GS", color: isGate3Bottleneck ? "#ff4444" : "#00cc66" },
567
- { start: "Stowe GS", end: "East Gate 3", color: isGate3Bottleneck ? "#ff4444" : "#00cc66" },
568
-
569
- // West & South Paths
570
- { start: "Village GS", end: "Village Plaza", color: "#00cc66" },
571
- { start: "Village Plaza", end: "West Gate 4", color: "#00cc66" },
572
- { start: "Hamilton GS", end: "South Bypass", color: "#00cc66" },
573
- { start: "South Bypass", end: "Club Eats", color: "#00cc66" },
574
- { start: "Club GS", end: "Club Eats", color: "#00cc66" },
575
- { start: "Club Eats", end: "South Gate 2", color: "#00cc66" }
576
- ];
577
 
578
- paths.forEach(p => {
579
- ctx.beginPath();
580
- ctx.moveTo(nodes[p.start].pos.x, nodes[p.start].pos.y);
581
- ctx.lineTo(nodes[p.end].pos.x, nodes[p.end].pos.y);
582
- ctx.strokeStyle = p.color;
583
- ctx.lineWidth = 4;
584
- ctx.stroke();
585
- });
586
 
587
  // -------------------------------------------------------------
588
  // D. EXPANDED GOOGLE MAPS MULTI-NODE DETOURS (PURPLE)
 
589
  // -------------------------------------------------------------
590
  if (isGate1Bottleneck) {
591
- // Multi-leg Detour 1: Fan Zone -> South Bypass -> Club Eats -> South Gate 2
592
- ctx.beginPath();
593
- ctx.setLineDash([8, 6]);
594
- ctx.moveTo(nodes["Main Fan Zone"].pos.x, nodes["Main Fan Zone"].pos.y);
595
- ctx.lineTo(nodes["South Bypass"].pos.x, nodes["South Bypass"].pos.y);
596
- ctx.lineTo(nodes["Club Eats"].pos.x, nodes["Club Eats"].pos.y);
597
- ctx.lineTo(nodes["South Gate 2"].pos.x, nodes["South Gate 2"].pos.y);
598
- ctx.strokeStyle = "#a020f0";
599
- ctx.lineWidth = 5;
600
- ctx.stroke();
601
 
602
- // Multi-leg Detour 2: Arena Hub -> Village Plaza -> West Gate 4
603
- ctx.beginPath();
604
- ctx.moveTo(nodes["Arena Crossroad"].pos.x, nodes["Arena Crossroad"].pos.y);
605
- ctx.lineTo(nodes["Village Plaza"].pos.x, nodes["Village Plaza"].pos.y);
606
- ctx.lineTo(nodes["West Gate 4"].pos.x, nodes["West Gate 4"].pos.y);
607
- ctx.strokeStyle = "#a020f0";
608
- ctx.lineWidth = 5;
609
- ctx.stroke();
610
- ctx.setLineDash([]);
611
  }
612
 
613
  if (isGate3Bottleneck) {
614
- // Detour 3: Becketts Interchange -> Arena Hub -> South Bypass -> South Gate 2
615
- ctx.beginPath();
616
- ctx.setLineDash([8, 6]);
617
- ctx.moveTo(nodes["Becketts Interchange"].pos.x, nodes["Becketts Interchange"].pos.y);
618
- ctx.lineTo(nodes["Arena Crossroad"].pos.x, nodes["Arena Crossroad"].pos.y);
619
- ctx.lineTo(nodes["South Bypass"].pos.x, nodes["South Bypass"].pos.y);
620
- ctx.lineTo(nodes["South Gate 2"].pos.x, nodes["South Gate 2"].pos.y);
621
- ctx.strokeStyle = "#a020f0";
622
- ctx.lineWidth = 5;
623
- ctx.stroke();
624
- ctx.setLineDash([]);
625
  }
626
 
627
  // -------------------------------------------------------------
 
486
  };
487
  }
488
 
489
+ // Helper function to draw multi-point paths
490
+ function drawPath(points, color, isDashed = false) {
491
+ ctx.beginPath();
492
+ if (isDashed) ctx.setLineDash([8, 6]);
493
+ points.forEach((ptKey, idx) => {
494
+ const pos = typeof ptKey === 'string' ? nodes[ptKey].pos : toCanvas(ptKey.x, ptKey.y);
495
+ if (idx === 0) ctx.moveTo(pos.x, pos.y);
496
+ else ctx.lineTo(pos.x, pos.y);
497
+ });
498
+ ctx.strokeStyle = color;
499
+ ctx.lineWidth = isDashed ? 5 : 4;
500
+ ctx.stroke();
501
+ if (isDashed) ctx.setLineDash([]);
502
+ }
503
+
504
  // -------------------------------------------------------------
505
  // A. DRAW F1 CIRCUIT TRACK
506
  // -------------------------------------------------------------
 
536
 
537
  // -------------------------------------------------------------
538
  // B. DEFINE MAP NODES (Grandstands, Food, Hubs, Gates)
539
+ // Shifted safely outside the track boundary
540
  // -------------------------------------------------------------
541
  const nodes = {
542
  // Grandstands
543
+ "Hamilton GS": { pos: toCanvas(-2.2, -2.5), type: "gs", label: `Hamilton (${hamilton})` },
544
+ "Becketts GS": { pos: toCanvas(1, 4.8), type: "gs", label: `Becketts (${becketts})` },
545
+ "Stowe GS": { pos: toCanvas(4.8, 1.5), type: "gs", label: `Stowe (${stowe})` },
546
+ "Village GS": { pos: toCanvas(-4.2, 1.2), type: "gs", label: `Village (${village})` },
547
+ "Club GS": { pos: toCanvas(2.8, -4.5), type: "gs", label: `Club (${club})` },
548
 
549
  // Food Stalls & Arenas
550
+ "Main Fan Zone": { pos: toCanvas(-4.2, -1.0), type: "food", label: "πŸ” Main Fan Zone" },
551
+ "Becketts Food": { pos: toCanvas(2.8, 4.2), type: "food", label: "🌭 Becketts Food" },
552
+ "Village Plaza": { pos: toCanvas(-3.2, 3.2), type: "food", label: "πŸ• Village Plaza" },
553
+ "Club Eats": { pos: toCanvas(-0.5, -4.5), type: "food", label: "🍦 Club Eats" },
554
 
555
  // Intermediate Junction Hubs
556
+ "Arena Crossroad": { pos: toCanvas(-3.5, -2.2), type: "hub", label: "πŸ“ Arena Hub" },
557
+ "Becketts Interchange": { pos: toCanvas(-1.0, 4.2), type: "hub", label: "πŸ“ Becketts Hub" },
558
+ "South Bypass": { pos: toCanvas(-2.2, -3.8), type: "hub", label: "πŸ“ South Hub" },
559
 
560
  // Gates
561
+ "Main Gate 1": { pos: toCanvas(-4.8, -2.2), type: "gate", label: "πŸšͺ Main Gate 1" },
562
+ "South Gate 2": { pos: toCanvas(1.5, -4.8), type: "gate", label: "πŸšͺ South Gate 2" },
563
+ "East Gate 3": { pos: toCanvas(5.2, -1.5), type: "gate", label: "πŸšͺ East Gate 3" },
564
+ "West Gate 4": { pos: toCanvas(-4.8, 3.2), type: "gate", label: "πŸšͺ West Gate 4" }
565
  };
566
 
567
  // -------------------------------------------------------------
568
  // C. INTERCONNECTED STANDARD PEDESTRIAN PATHS (GREEN / RED)
569
+ // Explicit waypoint routing around track perimeter
570
  // -------------------------------------------------------------
571
+ const pathColorG1 = isGate1Bottleneck ? "#ff4444" : "#00cc66";
572
+ const pathColorG3 = isGate3Bottleneck ? "#ff4444" : "#00cc66";
573
+
574
+ // Gate 1 Network
575
+ drawPath(["Hamilton GS", "Arena Crossroad"], pathColorG1);
576
+ drawPath(["Arena Crossroad", "Main Fan Zone"], pathColorG1);
577
+ drawPath(["Main Fan Zone", "Main Gate 1"], pathColorG1);
578
+ drawPath(["Village GS", "Main Fan Zone"], pathColorG1);
579
+
580
+ // Gate 3 & Becketts Network
581
+ drawPath(["Becketts GS", "Becketts Interchange"], pathColorG3);
582
+ drawPath(["Becketts GS", "Becketts Food"], pathColorG3);
583
+ drawPath(["Becketts Food", "Stowe GS"], pathColorG3);
584
+ drawPath(["Stowe GS", "East Gate 3"], pathColorG3);
585
+
586
+ // Outer Northern Connection (Becketts Hub <-> Village Plaza <-> Fan Zone around top/left)
587
+ drawPath(["Becketts Interchange", "Village Plaza"], pathColorG1);
588
+ drawPath(["Village Plaza", "Village GS"], "#00cc66");
589
+ drawPath(["Village Plaza", "West Gate 4"], "#00cc66");
 
 
 
590
 
591
+ // Outer Southern Connection (Hamilton <-> South Bypass <-> Club Eats <-> South Gate 2 around bottom)
592
+ drawPath(["Hamilton GS", "South Bypass"], "#00cc66");
593
+ drawPath(["South Bypass", "Club Eats"], "#00cc66");
594
+ drawPath(["Club GS", "Club Eats"], "#00cc66");
595
+ drawPath(["Club Eats", "South Gate 2"], "#00cc66");
 
 
 
596
 
597
  // -------------------------------------------------------------
598
  // D. EXPANDED GOOGLE MAPS MULTI-NODE DETOURS (PURPLE)
599
+ // Detours routed cleanly along the outer perimeter
600
  // -------------------------------------------------------------
601
  if (isGate1Bottleneck) {
602
+ // Fan Zone -> South Hub -> Club Eats -> South Gate 2
603
+ drawPath(["Main Fan Zone", "Arena Crossroad", "South Bypass", "Club Eats", "South Gate 2"], "#a020f0", true);
 
 
 
 
 
 
 
 
604
 
605
+ // Arena Hub -> West Gate 4
606
+ drawPath(["Arena Crossroad", "Village GS", "West Gate 4"], "#a020f0", true);
 
 
 
 
 
 
 
607
  }
608
 
609
  if (isGate3Bottleneck) {
610
+ // Becketts Hub -> Village Plaza -> Main Fan Zone -> South Hub -> South Gate 2
611
+ drawPath(["Becketts Interchange", "Village Plaza", "Main Fan Zone", "South Bypass", "South Gate 2"], "#a020f0", true);
 
 
 
 
 
 
 
 
 
612
  }
613
 
614
  // -------------------------------------------------------------