@jbrowse/plugin-wiggle
Version:
JBrowse 2 wiggle adapters, tracks, etc.
15 lines (14 loc) • 855 B
JavaScript
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';
const ScoreLegend = observer(({ model }) => {
const { ticks, scaleType } = model;
const { width } = getContainingView(model);
const legend = `[${ticks === null || ticks === void 0 ? void 0 : ticks.values[0]}-${ticks === null || ticks === void 0 ? void 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;