@jbrowse/plugin-linear-genome-view
Version:
JBrowse 2 linear genome view
18 lines (17 loc) • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = SVGScalebar;
const jsx_runtime_1 = require("react/jsx-runtime");
const util_1 = require("@jbrowse/core/util");
const material_1 = require("@mui/material");
function SVGScalebar({ model, fontSize, }) {
const { offsetPx, dynamicBlocks: { totalWidthPxWithoutBorders: totalWidthPx, totalBp }, } = model;
const theme = (0, material_1.useTheme)();
const displayBp = (0, util_1.getBpDisplayStr)(totalBp);
const x0 = Math.max(-offsetPx, 0);
const x1 = x0 + totalWidthPx;
const c = (0, util_1.stripAlpha)(theme.palette.text.secondary);
const x = x0 + (x1 - x0) / 2;
const y = fontSize;
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("line", { x1: x0, x2: x1, y1: 10, y2: 10, stroke: c }), (0, jsx_runtime_1.jsx)("line", { x1: x0, x2: x0, y1: 5, y2: 15, stroke: c }), (0, jsx_runtime_1.jsx)("line", { x1: x1, x2: x1, y1: 5, y2: 15, stroke: c }), (0, jsx_runtime_1.jsx)("text", { x: x, y: y, textAnchor: "middle", dominantBaseline: "hanging", fontSize: fontSize, fill: c, children: displayBp })] }));
}