UNPKG

@jbrowse/plugin-wiggle

Version:

JBrowse 2 wiggle adapters, tracks, etc.

15 lines (14 loc) 786 B
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import { getContainingView, measureText } from '@jbrowse/core/util'; import { observer } from 'mobx-react'; import RectBg from "./RectBg.js"; const ScoreLegend = observer(function ScoreLegend({ model, }) { const { ticks, scaleType } = model; const { width } = getContainingView(model); const legend = `[${ticks?.values[0]}-${ticks?.values[1]}]${scaleType === 'log' ? ' (log scale)' : ''}`; const len = measureText(legend, 14); const padding = 25; const xpos = width - len - padding; return (_jsxs(_Fragment, { children: [_jsx(RectBg, { y: 0, x: xpos, width: len + 6, height: 16 }), _jsx("text", { y: 13, x: xpos, children: legend })] })); }); export default ScoreLegend;