@euphrasiologist/lwphylo 1.2.16 → 1.2.18
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/drawPhylogeny.cjs +13 -28
- package/dist/drawPhylogeny.cjs.map +1 -1
- package/dist/drawPhylogeny.esm.js +13 -28
- package/dist/drawPhylogeny.esm.js.map +1 -1
- package/dist/drawPhylogeny.umd.js +1 -1
- package/dist/drawPhylogeny.umd.js.map +1 -1
- package/dist/index.cjs +13 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -622,7 +622,7 @@ function getChildArcsFan(pd) {
|
|
|
622
622
|
radius: parent.r, // IMPORTANT: draw at the PARENT circle
|
|
623
623
|
start,
|
|
624
624
|
end,
|
|
625
|
-
sweep:
|
|
625
|
+
sweep: 1 // CCW (matches describeArcSweep usage)
|
|
626
626
|
});
|
|
627
627
|
}
|
|
628
628
|
}
|
|
@@ -1403,29 +1403,6 @@ function drawPhylogeny(
|
|
|
1403
1403
|
return { X0, Y0, X1s: X0 + dx * t, Y1s: Y0 + dy * t, len };
|
|
1404
1404
|
}
|
|
1405
1405
|
|
|
1406
|
-
// put this next to your other radial helpers (top of file or in your lib)
|
|
1407
|
-
function arcPathCCW(cx, cy, R, a0, a1) {
|
|
1408
|
-
const TAU = Math.PI * 2;
|
|
1409
|
-
const norm = (t) => ((t % TAU) + TAU) % TAU;
|
|
1410
|
-
|
|
1411
|
-
a0 = norm(a0);
|
|
1412
|
-
a1 = norm(a1);
|
|
1413
|
-
|
|
1414
|
-
const delta = (a1 - a0 + TAU) % TAU; // CCW span a0 -> a1 in [0, 2π)
|
|
1415
|
-
if (delta < 1e-9) return ""; // degenerate; draw nothing
|
|
1416
|
-
|
|
1417
|
-
// With your polarToCartesian using y = cy - r*sin(t),
|
|
1418
|
-
// sweepFlag=0 gives a visually CCW arc segment.
|
|
1419
|
-
const largeArcFlag = delta > Math.PI ? 1 : 0;
|
|
1420
|
-
const sweepFlag = 0;
|
|
1421
|
-
|
|
1422
|
-
const p0 = polarToCartesian(cx, cy, R, a0);
|
|
1423
|
-
const p1 = polarToCartesian(cx, cy, R, a1);
|
|
1424
|
-
|
|
1425
|
-
return `M ${p0.x} ${p0.y} A ${R} ${R} 0 ${largeArcFlag} ${sweepFlag} ${p1.x} ${p1.y}`;
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
1406
|
// ===== SVG ROOT =====
|
|
1430
1407
|
const svg = d3__namespace
|
|
1431
1408
|
.create("svg")
|
|
@@ -1538,8 +1515,10 @@ function drawPhylogeny(
|
|
|
1538
1515
|
}
|
|
1539
1516
|
|
|
1540
1517
|
// maps for fast lookup on hover (childId → spoke / arc)
|
|
1541
|
-
const
|
|
1542
|
-
const
|
|
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
|
+
|
|
1543
1522
|
|
|
1544
1523
|
// ===== LABELS =====
|
|
1545
1524
|
// Labels — make them follow the tip position used by the current mode
|
|
@@ -1645,11 +1624,17 @@ function drawPhylogeny(
|
|
|
1645
1624
|
// ----- half-arc at parent radius (parent.angle → child.angle) -----
|
|
1646
1625
|
const a = arcByChild.get(cur.thisId);
|
|
1647
1626
|
if (a) {
|
|
1648
|
-
|
|
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
|
+
|
|
1649
1634
|
|
|
1650
1635
|
arcLayer
|
|
1651
1636
|
.append("path")
|
|
1652
|
-
.attr("d",
|
|
1637
|
+
.attr("d", pathFromArcRecord(a))
|
|
1653
1638
|
.attr("fill", "none")
|
|
1654
1639
|
.attr("stroke", stroke)
|
|
1655
1640
|
.attr("stroke-width", width);
|