UNPKG

@jbrowse/plugin-linear-genome-view

Version:

JBrowse 2 linear genome view

15 lines (14 loc) 984 B
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import { getBpDisplayStr, stripAlpha } from '@jbrowse/core/util'; import { useTheme } from '@mui/material'; export default function SVGScalebar({ model, fontSize, }) { const { offsetPx, dynamicBlocks: { totalWidthPxWithoutBorders: totalWidthPx, totalBp }, } = model; const theme = useTheme(); const displayBp = getBpDisplayStr(totalBp); const x0 = Math.max(-offsetPx, 0); const x1 = x0 + totalWidthPx; const c = stripAlpha(theme.palette.text.secondary); const x = x0 + (x1 - x0) / 2; const y = fontSize; return (_jsxs(_Fragment, { children: [_jsx("line", { x1: x0, x2: x1, y1: 10, y2: 10, stroke: c }), _jsx("line", { x1: x0, x2: x0, y1: 5, y2: 15, stroke: c }), _jsx("line", { x1: x1, x2: x1, y1: 5, y2: 15, stroke: c }), _jsx("text", { x: x, y: y, textAnchor: "middle", dominantBaseline: "hanging", fontSize: fontSize, fill: c, children: displayBp })] })); }