@jbrowse/plugin-wiggle
Version:
JBrowse 2 wiggle adapters, tracks, etc.
14 lines (13 loc) • 1.06 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { observer } from 'mobx-react';
import LegendItem from './LegendItem';
import RectBg from './RectBg';
const ColorLegend = observer(function ({ model, rowHeight, exportSVG, }) {
const { graphType, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, sources, labelWidth, } = model;
const colorBoxWidth = renderColorBoxes ? 15 : 0;
const legendWidth = labelWidth + colorBoxWidth + 5;
const svgOffset = exportSVG ? 10 : 0;
const extraOffset = svgOffset || (graphType && !rowHeightTooSmallForScalebar ? 50 : 0);
return sources ? (_jsxs(_Fragment, { children: [needsFullHeightScalebar ? (_jsx(RectBg, { y: 0, x: extraOffset, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null, sources.map((source, idx) => (_jsx(LegendItem, { source: source, idx: idx, model: model, rowHeight: rowHeight, exportSVG: exportSVG, labelWidth: labelWidth }, `${source.name}-${idx}`)))] })) : null;
});
export default ColorLegend;