@euphrasiologist/lwphylo 1.2.16 → 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/drawPhylogeny.cjs +12 -27
- package/dist/drawPhylogeny.cjs.map +1 -1
- package/dist/drawPhylogeny.esm.js +12 -27
- 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 +12 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +12 -27
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/drawPhylogeny.cjs
CHANGED
|
@@ -1236,29 +1236,6 @@ function drawPhylogeny(
|
|
|
1236
1236
|
return { X0, Y0, X1s: X0 + dx * t, Y1s: Y0 + dy * t, len };
|
|
1237
1237
|
}
|
|
1238
1238
|
|
|
1239
|
-
// put this next to your other radial helpers (top of file or in your lib)
|
|
1240
|
-
function arcPathCCW(cx, cy, R, a0, a1) {
|
|
1241
|
-
const TAU = Math.PI * 2;
|
|
1242
|
-
const norm = (t) => ((t % TAU) + TAU) % TAU;
|
|
1243
|
-
|
|
1244
|
-
a0 = norm(a0);
|
|
1245
|
-
a1 = norm(a1);
|
|
1246
|
-
|
|
1247
|
-
const delta = (a1 - a0 + TAU) % TAU; // CCW span a0 -> a1 in [0, 2π)
|
|
1248
|
-
if (delta < 1e-9) return ""; // degenerate; draw nothing
|
|
1249
|
-
|
|
1250
|
-
// With your polarToCartesian using y = cy - r*sin(t),
|
|
1251
|
-
// sweepFlag=0 gives a visually CCW arc segment.
|
|
1252
|
-
const largeArcFlag = delta > Math.PI ? 1 : 0;
|
|
1253
|
-
const sweepFlag = 0;
|
|
1254
|
-
|
|
1255
|
-
const p0 = polarToCartesian(cx, cy, R, a0);
|
|
1256
|
-
const p1 = polarToCartesian(cx, cy, R, a1);
|
|
1257
|
-
|
|
1258
|
-
return `M ${p0.x} ${p0.y} A ${R} ${R} 0 ${largeArcFlag} ${sweepFlag} ${p1.x} ${p1.y}`;
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
1239
|
// ===== SVG ROOT =====
|
|
1263
1240
|
const svg = d3__namespace
|
|
1264
1241
|
.create("svg")
|
|
@@ -1371,8 +1348,10 @@ function drawPhylogeny(
|
|
|
1371
1348
|
}
|
|
1372
1349
|
|
|
1373
1350
|
// maps for fast lookup on hover (childId → spoke / arc)
|
|
1374
|
-
const
|
|
1375
|
-
const
|
|
1351
|
+
const key = (x) => (typeof x === "string" ? +x : x);
|
|
1352
|
+
const spokeByChild = new Map(rad.radii.map(s => [key(s.childId ?? s.thisId ?? s.id1), s]));
|
|
1353
|
+
const arcByChild = new Map(rad.child_arcs.map(a => [key(a.childId), a]));
|
|
1354
|
+
|
|
1376
1355
|
|
|
1377
1356
|
// ===== LABELS =====
|
|
1378
1357
|
// Labels — make them follow the tip position used by the current mode
|
|
@@ -1478,11 +1457,17 @@ function drawPhylogeny(
|
|
|
1478
1457
|
// ----- half-arc at parent radius (parent.angle → child.angle) -----
|
|
1479
1458
|
const a = arcByChild.get(cur.thisId);
|
|
1480
1459
|
if (a) {
|
|
1481
|
-
|
|
1460
|
+
function pathFromArcRecord(rec) {
|
|
1461
|
+
const R = radiusPx(rec.radius);
|
|
1462
|
+
return rec.sweep == null
|
|
1463
|
+
? describeArc(centerX, centerY, R, rec.start, rec.end)
|
|
1464
|
+
: describeArcSweep(centerX, centerY, R, rec.start, rec.end, rec.sweep);
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1482
1467
|
|
|
1483
1468
|
arcLayer
|
|
1484
1469
|
.append("path")
|
|
1485
|
-
.attr("d",
|
|
1470
|
+
.attr("d", pathFromArcRecord(a))
|
|
1486
1471
|
.attr("fill", "none")
|
|
1487
1472
|
.attr("stroke", stroke)
|
|
1488
1473
|
.attr("stroke-width", width);
|