UNPKG

@jbrowse/plugin-wiggle

Version:

JBrowse 2 wiggle adapters, tracks, etc.

20 lines (19 loc) 1.16 kB
"use strict"; 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 util_1 = require("@jbrowse/core/util"); const mobx_react_1 = require("mobx-react"); const RectBg_1 = __importDefault(require("./RectBg")); const ScoreLegend = (0, mobx_react_1.observer)(({ model }) => { const { ticks, scaleType } = model; const { width } = (0, util_1.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 = (0, util_1.measureText)(legend, 14); const padding = 25; const xpos = width - len - padding; return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(RectBg_1.default, { y: 0, x: xpos, width: len + 6, height: 16 }), (0, jsx_runtime_1.jsx)("text", { y: 13, x: xpos, children: legend })] })); }); exports.default = ScoreLegend;