@jbrowse/plugin-wiggle
Version:
JBrowse 2 wiggle adapters, tracks, etc.
19 lines (18 loc) • 1.41 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const mobx_react_1 = require("mobx-react");
const LegendItem_1 = __importDefault(require("./LegendItem"));
const RectBg_1 = __importDefault(require("./RectBg"));
const ColorLegend = (0, mobx_react_1.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 ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [needsFullHeightScalebar ? ((0, jsx_runtime_1.jsx)(RectBg_1.default, { y: 0, x: extraOffset, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null, sources.map((source, idx) => ((0, jsx_runtime_1.jsx)(LegendItem_1.default, { source: source, idx: idx, model: model, rowHeight: rowHeight, exportSVG: exportSVG, labelWidth: labelWidth }, `${source.name}-${idx}`)))] })) : null;
});
exports.default = ColorLegend;