@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.js CHANGED
@@ -158,6 +158,13 @@ const TAU$1 = Math.PI * 2;
158
158
  const norm$1 = (t) => ((t % TAU$1) + TAU$1) % TAU$1;
159
159
 
160
160
  function describeArcSweep(cx, cy, r, a0, a1, sweep /*0=CCW,1=CW*/) {
161
+ console.log("describeArcSweep input:", {
162
+ cx, cy, r,
163
+ a0Deg: (a0 * 180 / Math.PI).toFixed(2),
164
+ a1Deg: (a1 * 180 / Math.PI).toFixed(2),
165
+ sweep
166
+ });
167
+
161
168
  const delta = sweep === 0 ? norm$1(a1 - a0) : norm$1(a0 - a1);
162
169
  if (!(r > 0) || delta < 1e-9) return "";
163
170
  const largeArcFlag = delta > Math.PI ? 1 : 0;
@@ -565,9 +572,6 @@ function getChildArcsFan(pd) {
565
572
  const TAU = Math.PI * 2;
566
573
  const norm = (t) => ((t % TAU) + TAU) % TAU;
567
574
 
568
- const ccwDelta = (a0, a1) => (a1 - a0 + TAU) % TAU;
569
- const cwDelta = (a0, a1) => (a0 - a1 + TAU) % TAU;
570
-
571
575
  // Circular midpoint that travels CCW from a -> b by half the CCW span
572
576
  function midCCW(a, b) {
573
577
  const d = (b - a + TAU) % TAU; // CCW delta in [0, 2π)
@@ -616,14 +620,12 @@ function getChildArcsFan(pd) {
616
620
  const cur = A[i];
617
621
  const next = A[(i + 1) % N];
618
622
 
619
- // “fan” wedge around the child: midpoint(prev→cur) .. midpoint(cur→next), CCW
620
623
  const start = midCCW(prev.a, cur.a);
621
624
  const end = midCCW(cur.a, next.a);
622
625
 
623
- // Choose the **shorter** sweep (0 = CCW, 1 = CW in our math-angle convention)
624
- const ccw = ccwDelta(start, end);
625
- const cw = cwDelta(start, end);
626
- const sweep = ccw <= cw ? 0 : 1;
626
+ // Use SVG-conforming sweep logic
627
+ const delta = (end - start + TAU) % TAU;
628
+ const sweep = delta > Math.PI ? 0 : 1;
627
629
 
628
630
  child_arcs.push({
629
631
  parentId: pid,
@@ -634,6 +636,7 @@ function getChildArcsFan(pd) {
634
636
  sweep
635
637
  });
636
638
  }
639
+
637
640
  }
638
641
 
639
642
  return child_arcs;
@@ -1641,6 +1644,14 @@ function drawPhylogeny(
1641
1644
  }
1642
1645
 
1643
1646
  if (a) {
1647
+ console.log("Drawing arc:", {
1648
+ childId: cur.thisId,
1649
+ startDeg: (a.start * 180 / Math.PI).toFixed(2),
1650
+ endDeg: (a.end * 180 / Math.PI).toFixed(2),
1651
+ sweep: a.sweep,
1652
+ radius: a.radius
1653
+ });
1654
+
1644
1655
  arcLayer
1645
1656
  .append("path")
1646
1657
  .attr("d", pathFromArcRecord(a))