taxonium-component
Version:
React component for exploring large phylogenetic trees in the browser
41 lines (40 loc) • 1.51 kB
JavaScript
import { ao as u, b7 as h } from "./JBrowsePanel-ClL6pWQW.js";
import { c as m } from "./util-B1Sm35mH.js";
const g = 0.6, e = g / 2;
function p(s, o, i, l, r, c = !0) {
if (s === r)
return c ? "#ccc" : "";
{
let n;
if (o && (n = u.colord(`hsl(200,50%,${80 - o / r * 50}%)`)), i) {
const f = `hsla(0,100%,20%,${i / r})`;
n = n ? n.mix(f) : u.colord(f);
}
if (l) {
const f = `hsl(50,50%,50%,${l / r})`;
n = n ? n.mix(f) : u.colord(f);
}
return (n == null ? void 0 : n.toHex()) || "black";
}
}
function v(s, o, i, l, r, c, n = "", f, t = 1) {
o.fillStyle = t !== 1 ? u.colord(s).alpha(t).toHex() : s, n === "inversion" ? f === 1 ? (o.beginPath(), o.moveTo(i - e, l - e), o.lineTo(i - e, l + c + e), o.lineTo(i + r + e, l + c / 2), o.closePath(), o.fill()) : (o.beginPath(), o.moveTo(i + r + e, l - e), o.lineTo(i + r + e, l + c + e), o.lineTo(i - e, l + c / 2), o.closePath(), o.fill()) : o.fillRect(i - e, l - e, r + e, c + e);
}
function b(s, o, i = !0) {
const l = +s[o];
return l ? h.set1[l - 1] || "black" : i ? "#ccc" : void 0;
}
function C(s, o, i, l = !0) {
return +s[o] ? m(+i) || "black" : l ? "#ccc" : void 0;
}
function k(s, o, i, l, r, c, n, f, t = !0, a = 1) {
const d = f !== void 0 ? C(s, n, f, t) : b(s, n, t);
return d && (o.fillStyle = a !== 1 ? u.colord(d).alpha(a).toHex() : d, o.fillRect(i - e, l - e, r + e, c + e)), d;
}
export {
v as a,
k as d,
e as f,
p as g
};
//# sourceMappingURL=drawPhased-DI7gR5rf.js.map