@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.
@@ -66,6 +66,13 @@ const TAU$1 = Math.PI * 2;
66
66
  const norm$1 = (t) => ((t % TAU$1) + TAU$1) % TAU$1;
67
67
 
68
68
  function describeArcSweep(cx, cy, r, a0, a1, sweep /*0=CCW,1=CW*/) {
69
+ console.log("describeArcSweep input:", {
70
+ cx, cy, r,
71
+ a0Deg: (a0 * 180 / Math.PI).toFixed(2),
72
+ a1Deg: (a1 * 180 / Math.PI).toFixed(2),
73
+ sweep
74
+ });
75
+
69
76
  const delta = sweep === 0 ? norm$1(a1 - a0) : norm$1(a0 - a1);
70
77
  if (!(r > 0) || delta < 1e-9) return "";
71
78
  const largeArcFlag = delta > Math.PI ? 1 : 0;
@@ -473,9 +480,6 @@ function getChildArcsFan(pd) {
473
480
  const TAU = Math.PI * 2;
474
481
  const norm = (t) => ((t % TAU) + TAU) % TAU;
475
482
 
476
- const ccwDelta = (a0, a1) => (a1 - a0 + TAU) % TAU;
477
- const cwDelta = (a0, a1) => (a0 - a1 + TAU) % TAU;
478
-
479
483
  // Circular midpoint that travels CCW from a -> b by half the CCW span
480
484
  function midCCW(a, b) {
481
485
  const d = (b - a + TAU) % TAU; // CCW delta in [0, 2π)
@@ -524,14 +528,12 @@ function getChildArcsFan(pd) {
524
528
  const cur = A[i];
525
529
  const next = A[(i + 1) % N];
526
530
 
527
- // “fan” wedge around the child: midpoint(prev→cur) .. midpoint(cur→next), CCW
528
531
  const start = midCCW(prev.a, cur.a);
529
532
  const end = midCCW(cur.a, next.a);
530
533
 
531
- // Choose the **shorter** sweep (0 = CCW, 1 = CW in our math-angle convention)
532
- const ccw = ccwDelta(start, end);
533
- const cw = cwDelta(start, end);
534
- const sweep = ccw <= cw ? 0 : 1;
534
+ // Use SVG-conforming sweep logic
535
+ const delta = (end - start + TAU) % TAU;
536
+ const sweep = delta > Math.PI ? 0 : 1;
535
537
 
536
538
  child_arcs.push({
537
539
  parentId: pid,
@@ -542,6 +544,7 @@ function getChildArcsFan(pd) {
542
544
  sweep
543
545
  });
544
546
  }
547
+
545
548
  }
546
549
 
547
550
  return child_arcs;
@@ -1495,6 +1498,14 @@ function drawPhylogeny(
1495
1498
  }
1496
1499
 
1497
1500
  if (a) {
1501
+ console.log("Drawing arc:", {
1502
+ childId: cur.thisId,
1503
+ startDeg: (a.start * 180 / Math.PI).toFixed(2),
1504
+ endDeg: (a.end * 180 / Math.PI).toFixed(2),
1505
+ sweep: a.sweep,
1506
+ radius: a.radius
1507
+ });
1508
+
1498
1509
  arcLayer
1499
1510
  .append("path")
1500
1511
  .attr("d", pathFromArcRecord(a))