UNPKG

@jbrowse/plugin-wiggle

Version:

JBrowse 2 wiggle adapters, tracks, etc.

13 lines (12 loc) 1.01 kB
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import RectBg from './RectBg'; const LegendItem = function ({ source, idx, rowHeight, labelWidth, model, exportSVG, }) { const boxHeight = Math.min(20, rowHeight); const { needsCustomLegend, graphType, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, } = model; const colorBoxWidth = renderColorBoxes ? 15 : 0; const legendWidth = labelWidth + colorBoxWidth + 5; const svgOffset = exportSVG ? 10 : 0; const extraOffset = svgOffset || (graphType && !rowHeightTooSmallForScalebar ? 50 : 0); return (_jsxs(_Fragment, { children: [needsFullHeightScalebar ? null : (_jsx(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: legendWidth, height: boxHeight })), source.color ? (_jsx(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: colorBoxWidth, height: needsCustomLegend ? rowHeight : boxHeight, color: source.color })) : null] })); }; export default LegendItem;