@jbrowse/plugin-linear-genome-view
Version:
JBrowse 2 linear genome view
27 lines (26 loc) • 1.41 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { getSession, stringify } from '@jbrowse/core/util';
import { Tooltip } from '@mui/material';
import { observer } from 'mobx-react';
import { makeStyles } from 'tss-react/mui';
const useStyles = makeStyles()({
guide: {
pointerEvents: 'none',
height: '100%',
width: 1,
position: 'absolute',
},
});
const OverviewRubberbandHoverTooltip = observer(function ({ model, open, guideX, overview, }) {
var _a;
const { classes } = useStyles();
const { cytobandOffset } = model;
const { assemblyManager } = 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 (_jsx(Tooltip, { open: open, placement: "top", title: [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: _jsx("div", { className: classes.guide, style: { left: guideX } }) }));
});
export default OverviewRubberbandHoverTooltip;