@euphrasiologist/lwphylo 1.2.9 → 1.2.11

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
@@ -1100,7 +1100,7 @@ function drawPhylogeny(
1100
1100
  const byId = new Map(horizontal.map((d) => [d.thisId, d]));
1101
1101
  const tipById = new Map(tips.map((d) => [d.thisId, d]));
1102
1102
  const tipByLabel = new Map(tips.map((d) => [d.thisLabel, d]));
1103
- const rootToTip = makeRootToTipGetter(byId, { prefer: "x1" });
1103
+ const rootToTip = makeRootToTipGetter(byId, { prefer: "x1" });
1104
1104
 
1105
1105
  const maxY = d3.max(horizontal, (d) => d.y1);
1106
1106
  const minY = d3.min(horizontal, (d) => d.y1);
@@ -1262,7 +1262,10 @@ function drawPhylogeny(
1262
1262
  return svg.node();
1263
1263
  } else if (layout === "radial") {
1264
1264
  const parsedTree = readTree(treeText);
1265
- const rad = radialLayout(parsedTree);
1265
+ const rad = radialLayout(parsedTree, {
1266
+ angleStrategy: "fan",
1267
+ arcsStyle: "fan"
1268
+ });
1266
1269
 
1267
1270
  // ===== MODE =====
1268
1271
  const TIP_MODE = radialMode; // "phylo" (shorten to original tips) or "outer" (project to one circle)
@@ -1288,6 +1291,7 @@ function drawPhylogeny(
1288
1291
  .scaleLinear()
1289
1292
  .domain([-scaleRadial, scaleRadial])
1290
1293
  .range([h, 0]);
1294
+
1291
1295
  const radiusPx = (r) => r * (w / (2 * scaleRadial));
1292
1296
 
1293
1297
  // ===== INDEXES / HELPERS =====
@@ -1472,7 +1476,7 @@ function drawPhylogeny(
1472
1476
 
1473
1477
  // label hover
1474
1478
  labels
1475
- .on("mouseenter", function(event, d) {
1479
+ .on("mouseenter", function(_event, d) {
1476
1480
  drawRadialPath(d, hoverLines, hoverArcs, hoverStroke, hoverWidth);
1477
1481
  d3.select(this).select("text").attr("font-weight", 600);
1478
1482
  })
@@ -1529,15 +1533,23 @@ function drawPhylogeny(
1529
1533
  if (a) {
1530
1534
  arcLayer
1531
1535
  .append("path")
1532
- .attr(
1533
- "d",
1534
- describeArc(
1535
- centerX,
1536
- centerY,
1537
- Math.max(0, radiusPx(a.radius)),
1538
- a.start,
1539
- a.end
1540
- )
1536
+ .attr("d", (d) =>
1537
+ d.sweep == null
1538
+ ? describeArc(
1539
+ centerX,
1540
+ centerY,
1541
+ radiusPx(d.radius),
1542
+ d.start,
1543
+ d.end
1544
+ )
1545
+ : describeArcSweep(
1546
+ centerX,
1547
+ centerY,
1548
+ radiusPx(d.radius),
1549
+ d.start,
1550
+ d.end,
1551
+ d.sweep
1552
+ )
1541
1553
  )
1542
1554
  .attr("fill", "none")
1543
1555
  .attr("stroke", stroke)