@euphrasiologist/lwphylo 1.2.15 → 1.2.17

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
@@ -1515,8 +1515,10 @@ function drawPhylogeny(
1515
1515
  }
1516
1516
 
1517
1517
  // maps for fast lookup on hover (childId → spoke / arc)
1518
- const spokeByChild = new Map(rad.radii.map((s) => [childIdOf(s), s]));
1519
- const arcByChild = new Map((rad.child_arcs ?? []).map((a) => [a.childId, a]));
1518
+ const key = (x) => (typeof x === "string" ? +x : x);
1519
+ const spokeByChild = new Map(rad.radii.map(s => [key(s.childId ?? s.thisId ?? s.id1), s]));
1520
+ const arcByChild = new Map(rad.child_arcs.map(a => [key(a.childId), a]));
1521
+
1520
1522
 
1521
1523
  // ===== LABELS =====
1522
1524
  // Labels — make them follow the tip position used by the current mode
@@ -1622,13 +1624,17 @@ function drawPhylogeny(
1622
1624
  // ----- half-arc at parent radius (parent.angle → child.angle) -----
1623
1625
  const a = arcByChild.get(cur.thisId);
1624
1626
  if (a) {
1625
- const pathD = (a.sweep == null)
1626
- ? describeArc(centerX, centerY, radiusPx(a.radius), a.start, a.end)
1627
- : describeArcSweep(centerX, centerY, radiusPx(a.radius), a.start, a.end, a.sweep);
1627
+ function pathFromArcRecord(rec) {
1628
+ const R = radiusPx(rec.radius);
1629
+ return rec.sweep == null
1630
+ ? describeArc(centerX, centerY, R, rec.start, rec.end)
1631
+ : describeArcSweep(centerX, centerY, R, rec.start, rec.end, rec.sweep);
1632
+ }
1633
+
1628
1634
 
1629
1635
  arcLayer
1630
1636
  .append("path")
1631
- .attr("d", pathD)
1637
+ .attr("d", pathFromArcRecord(a))
1632
1638
  .attr("fill", "none")
1633
1639
  .attr("stroke", stroke)
1634
1640
  .attr("stroke-width", width);
@@ -1885,6 +1891,7 @@ exports.describeArcSweep = describeArcSweep;
1885
1891
  exports.drawPhylogeny = drawPhylogeny;
1886
1892
  exports.parentFisheye = parentFisheye;
1887
1893
  exports.phisheye = phisheye;
1894
+ exports.polarToCartesian = polarToCartesian;
1888
1895
  exports.radialLayout = radialLayout;
1889
1896
  exports.readTree = readTree;
1890
1897
  exports.rectangleLayout = rectangleLayout;