@euphrasiologist/lwphylo 1.2.21 → 1.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,6 +45,13 @@ const TAU$1 = Math.PI * 2;
45
45
  const norm$1 = (t) => ((t % TAU$1) + TAU$1) % TAU$1;
46
46
 
47
47
  function describeArcSweep(cx, cy, r, a0, a1, sweep /*0=CCW,1=CW*/) {
48
+ console.log("describeArcSweep input:", {
49
+ cx, cy, r,
50
+ a0Deg: (a0 * 180 / Math.PI).toFixed(2),
51
+ a1Deg: (a1 * 180 / Math.PI).toFixed(2),
52
+ sweep
53
+ });
54
+
48
55
  const delta = sweep === 0 ? norm$1(a1 - a0) : norm$1(a0 - a1);
49
56
  if (!(r > 0) || delta < 1e-9) return "";
50
57
  const largeArcFlag = delta > Math.PI ? 1 : 0;
@@ -452,9 +459,6 @@ function getChildArcsFan(pd) {
452
459
  const TAU = Math.PI * 2;
453
460
  const norm = (t) => ((t % TAU) + TAU) % TAU;
454
461
 
455
- const ccwDelta = (a0, a1) => (a1 - a0 + TAU) % TAU;
456
- const cwDelta = (a0, a1) => (a0 - a1 + TAU) % TAU;
457
-
458
462
  // Circular midpoint that travels CCW from a -> b by half the CCW span
459
463
  function midCCW(a, b) {
460
464
  const d = (b - a + TAU) % TAU; // CCW delta in [0, 2π)
@@ -503,14 +507,12 @@ function getChildArcsFan(pd) {
503
507
  const cur = A[i];
504
508
  const next = A[(i + 1) % N];
505
509
 
506
- // “fan” wedge around the child: midpoint(prev→cur) .. midpoint(cur→next), CCW
507
510
  const start = midCCW(prev.a, cur.a);
508
511
  const end = midCCW(cur.a, next.a);
509
512
 
510
- // Choose the **shorter** sweep (0 = CCW, 1 = CW in our math-angle convention)
511
- const ccw = ccwDelta(start, end);
512
- const cw = cwDelta(start, end);
513
- const sweep = ccw <= cw ? 0 : 1;
513
+ // Use SVG-conforming sweep logic
514
+ const delta = (end - start + TAU) % TAU;
515
+ const sweep = delta > Math.PI ? 0 : 1;
514
516
 
515
517
  child_arcs.push({
516
518
  parentId: pid,
@@ -521,6 +523,7 @@ function getChildArcsFan(pd) {
521
523
  sweep
522
524
  });
523
525
  }
526
+
524
527
  }
525
528
 
526
529
  return child_arcs;
@@ -1474,6 +1477,14 @@ function drawPhylogeny(
1474
1477
  }
1475
1478
 
1476
1479
  if (a) {
1480
+ console.log("Drawing arc:", {
1481
+ childId: cur.thisId,
1482
+ startDeg: (a.start * 180 / Math.PI).toFixed(2),
1483
+ endDeg: (a.end * 180 / Math.PI).toFixed(2),
1484
+ sweep: a.sweep,
1485
+ radius: a.radius
1486
+ });
1487
+
1477
1488
  arcLayer
1478
1489
  .append("path")
1479
1490
  .attr("d", pathFromArcRecord(a))