@euphrasiologist/lwphylo 1.2.23 → 1.2.24
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 +16 -21
- package/dist/drawPhylogeny.cjs.map +1 -1
- package/dist/drawPhylogeny.esm.js +16 -21
- 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 +16 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -175,23 +175,21 @@ function describeArc(cx, cy, radius, startAngle, endAngle) {
|
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
// src/radial/describeArcSweep.js
|
|
178
|
-
|
|
179
|
-
const norm$1 = (t) => ((t % TAU$1) + TAU$1) % TAU$1;
|
|
180
|
-
|
|
181
|
-
function describeArcSweep(cx, cy, r, a0, a1, sweep /*0=CCW,1=CW*/) {
|
|
178
|
+
function describeArcSweep(cx, cy, r, a0, a1, sweep = 1, largeArcFlag = 0) {
|
|
182
179
|
console.log("describeArcSweep input:", {
|
|
183
180
|
cx, cy, r,
|
|
184
181
|
a0Deg: (a0 * 180 / Math.PI).toFixed(2),
|
|
185
182
|
a1Deg: (a1 * 180 / Math.PI).toFixed(2),
|
|
186
|
-
sweep
|
|
183
|
+
sweep,
|
|
184
|
+
largeArcFlag
|
|
187
185
|
});
|
|
188
186
|
|
|
189
|
-
|
|
190
|
-
if (!(r > 0) || delta < 1e-9) return "";
|
|
191
|
-
const largeArcFlag = delta > Math.PI ? 1 : 0;
|
|
187
|
+
if (!(r > 0)) return "";
|
|
192
188
|
|
|
193
|
-
const x0 = cx + r * Math.cos(a0)
|
|
194
|
-
const
|
|
189
|
+
const x0 = cx + r * Math.cos(a0);
|
|
190
|
+
const y0 = cy - r * Math.sin(a0);
|
|
191
|
+
const x1 = cx + r * Math.cos(a1);
|
|
192
|
+
const y1 = cy - r * Math.sin(a1);
|
|
195
193
|
|
|
196
194
|
return `M ${x0} ${y0} A ${r} ${r} 0 ${largeArcFlag} ${sweep} ${x1} ${y1}`;
|
|
197
195
|
}
|
|
@@ -593,19 +591,16 @@ function getChildArcsFan(pd) {
|
|
|
593
591
|
const TAU = Math.PI * 2;
|
|
594
592
|
const norm = (t) => ((t % TAU) + TAU) % TAU;
|
|
595
593
|
|
|
596
|
-
// Circular midpoint that travels CCW from a -> b by half the CCW span
|
|
597
594
|
function midCCW(a, b) {
|
|
598
|
-
const d = (b - a + TAU) % TAU;
|
|
595
|
+
const d = (b - a + TAU) % TAU;
|
|
599
596
|
return norm(a + d / 2);
|
|
600
597
|
}
|
|
601
598
|
|
|
602
599
|
const key = (x) => (typeof x === "string" ? +x : x);
|
|
603
|
-
|
|
604
600
|
const byId = new Map(pd.map(d => [key(d.thisId), d]));
|
|
605
601
|
const childrenByParent = new Map(
|
|
606
602
|
pd.map(d => [
|
|
607
603
|
key(d.thisId),
|
|
608
|
-
// normalize children to numeric IDs; drop anything we can't resolve
|
|
609
604
|
(d.children || [])
|
|
610
605
|
.map(ch => (typeof ch === "object" ? ch.thisId : ch))
|
|
611
606
|
.map(key)
|
|
@@ -620,7 +615,6 @@ function getChildArcsFan(pd) {
|
|
|
620
615
|
const kids = childrenByParent.get(pid) || [];
|
|
621
616
|
if (kids.length < 2) continue;
|
|
622
617
|
|
|
623
|
-
// Sort children by angle (normalized) around the circle
|
|
624
618
|
const A = kids
|
|
625
619
|
.map(id => {
|
|
626
620
|
const node = byId.get(id);
|
|
@@ -644,9 +638,9 @@ function getChildArcsFan(pd) {
|
|
|
644
638
|
const start = midCCW(prev.a, cur.a);
|
|
645
639
|
const end = midCCW(cur.a, next.a);
|
|
646
640
|
|
|
647
|
-
|
|
641
|
+
const sweep = 1; // always clockwise
|
|
648
642
|
const delta = (end - start + TAU) % TAU;
|
|
649
|
-
const
|
|
643
|
+
const largeArc = delta > Math.PI ? 1 : 0;
|
|
650
644
|
|
|
651
645
|
child_arcs.push({
|
|
652
646
|
parentId: pid,
|
|
@@ -654,10 +648,10 @@ function getChildArcsFan(pd) {
|
|
|
654
648
|
radius,
|
|
655
649
|
start,
|
|
656
650
|
end,
|
|
657
|
-
sweep
|
|
651
|
+
sweep,
|
|
652
|
+
largeArc
|
|
658
653
|
});
|
|
659
654
|
}
|
|
660
|
-
|
|
661
655
|
}
|
|
662
656
|
|
|
663
657
|
return child_arcs;
|
|
@@ -1472,7 +1466,8 @@ function drawPhylogeny(
|
|
|
1472
1466
|
radiusPx(d.radius),
|
|
1473
1467
|
d.start,
|
|
1474
1468
|
d.end,
|
|
1475
|
-
d.sweep
|
|
1469
|
+
d.sweep,
|
|
1470
|
+
d.largeArc,
|
|
1476
1471
|
)
|
|
1477
1472
|
)
|
|
1478
1473
|
.attr("fill", "none")
|
|
@@ -1661,7 +1656,7 @@ function drawPhylogeny(
|
|
|
1661
1656
|
const R = radiusPx(rec.radius);
|
|
1662
1657
|
return rec.sweep == null
|
|
1663
1658
|
? describeArc(centerX, centerY, R, rec.start, rec.end)
|
|
1664
|
-
: describeArcSweep(centerX, centerY, R, rec.start, rec.end, rec.sweep);
|
|
1659
|
+
: describeArcSweep(centerX, centerY, R, rec.start, rec.end, rec.sweep, a.largeArc);
|
|
1665
1660
|
}
|
|
1666
1661
|
|
|
1667
1662
|
if (a) {
|