UNPKG

@jbrowse/plugin-linear-genome-view

Version:

JBrowse 2 linear genome view

29 lines (28 loc) 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const jsx_runtime_1 = require("react/jsx-runtime"); const util_1 = require("@jbrowse/core/util"); const material_1 = require("@mui/material"); const mobx_react_1 = require("mobx-react"); const mui_1 = require("tss-react/mui"); const useStyles = (0, mui_1.makeStyles)()({ guide: { pointerEvents: 'none', height: '100%', width: 1, position: 'absolute', }, }); const OverviewRubberbandHoverTooltip = (0, mobx_react_1.observer)(function ({ model, open, guideX, overview, }) { var _a; const { classes } = useStyles(); const { cytobandOffset } = model; const { assemblyManager } = (0, util_1.getSession)(model); const px = overview.pxToBp(guideX - cytobandOffset); const assembly = assemblyManager.get(px.assemblyName); const cytoband = (_a = assembly === null || assembly === void 0 ? void 0 : assembly.cytobands) === null || _a === void 0 ? void 0 : _a.find(f => px.coord > f.get('start') && px.coord < f.get('end') && px.refName === assembly.getCanonicalRefName(f.get('refName'))); return ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { open: open, placement: "top", title: [(0, util_1.stringify)(px), cytoband === null || cytoband === void 0 ? void 0 : cytoband.get('name'), cytoband === null || cytoband === void 0 ? void 0 : cytoband.get('type')].join(' '), arrow: true, children: (0, jsx_runtime_1.jsx)("div", { className: classes.guide, style: { left: guideX } }) })); }); exports.default = OverviewRubberbandHoverTooltip;