@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.
package/dist/index.cjs CHANGED
@@ -179,6 +179,13 @@ const TAU$1 = Math.PI * 2;
179
179
  const norm$1 = (t) => ((t % TAU$1) + TAU$1) % TAU$1;
180
180
 
181
181
  function describeArcSweep(cx, cy, r, a0, a1, sweep /*0=CCW,1=CW*/) {
182
+ console.log("describeArcSweep input:", {
183
+ cx, cy, r,
184
+ a0Deg: (a0 * 180 / Math.PI).toFixed(2),
185
+ a1Deg: (a1 * 180 / Math.PI).toFixed(2),
186
+ sweep
187
+ });
188
+
182
189
  const delta = sweep === 0 ? norm$1(a1 - a0) : norm$1(a0 - a1);
183
190
  if (!(r > 0) || delta < 1e-9) return "";
184
191
  const largeArcFlag = delta > Math.PI ? 1 : 0;
@@ -586,9 +593,6 @@ function getChildArcsFan(pd) {
586
593
  const TAU = Math.PI * 2;
587
594
  const norm = (t) => ((t % TAU) + TAU) % TAU;
588
595
 
589
- const ccwDelta = (a0, a1) => (a1 - a0 + TAU) % TAU;
590
- const cwDelta = (a0, a1) => (a0 - a1 + TAU) % TAU;
591
-
592
596
  // Circular midpoint that travels CCW from a -> b by half the CCW span
593
597
  function midCCW(a, b) {
594
598
  const d = (b - a + TAU) % TAU; // CCW delta in [0, 2π)
@@ -637,14 +641,12 @@ function getChildArcsFan(pd) {
637
641
  const cur = A[i];
638
642
  const next = A[(i + 1) % N];
639
643
 
640
- // “fan” wedge around the child: midpoint(prev→cur) .. midpoint(cur→next), CCW
641
644
  const start = midCCW(prev.a, cur.a);
642
645
  const end = midCCW(cur.a, next.a);
643
646
 
644
- // Choose the **shorter** sweep (0 = CCW, 1 = CW in our math-angle convention)
645
- const ccw = ccwDelta(start, end);
646
- const cw = cwDelta(start, end);
647
- const sweep = ccw <= cw ? 0 : 1;
647
+ // Use SVG-conforming sweep logic
648
+ const delta = (end - start + TAU) % TAU;
649
+ const sweep = delta > Math.PI ? 0 : 1;
648
650
 
649
651
  child_arcs.push({
650
652
  parentId: pid,
@@ -655,6 +657,7 @@ function getChildArcsFan(pd) {
655
657
  sweep
656
658
  });
657
659
  }
660
+
658
661
  }
659
662
 
660
663
  return child_arcs;
@@ -1662,6 +1665,14 @@ function drawPhylogeny(
1662
1665
  }
1663
1666
 
1664
1667
  if (a) {
1668
+ console.log("Drawing arc:", {
1669
+ childId: cur.thisId,
1670
+ startDeg: (a.start * 180 / Math.PI).toFixed(2),
1671
+ endDeg: (a.end * 180 / Math.PI).toFixed(2),
1672
+ sweep: a.sweep,
1673
+ radius: a.radius
1674
+ });
1675
+
1665
1676
  arcLayer
1666
1677
  .append("path")
1667
1678
  .attr("d", pathFromArcRecord(a))