@jbrowse/plugin-wiggle
Version:
JBrowse 2 wiggle adapters, tracks, etc.
30 lines (29 loc) • 1.44 kB
JavaScript
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { Suspense } from 'react';
import BaseTooltip from '@jbrowse/core/ui/BaseTooltip';
import { observer } from 'mobx-react';
import { makeStyles } from 'tss-react/mui';
import { YSCALEBAR_LABEL_OFFSET } from './util';
const useStyles = makeStyles()({
hoverVertical: {
background: '#333',
border: 'none',
width: 1,
height: '100%',
top: YSCALEBAR_LABEL_OFFSET,
cursor: 'default',
position: 'absolute',
pointerEvents: 'none',
},
});
const Tooltip = observer(function Tooltip({ model, height, clientMouseCoord, offsetMouseCoord, clientRect, TooltipContents, useClientY, }) {
const { featureUnderMouse } = model;
const { classes } = useStyles();
const x = clientMouseCoord[0] + 5;
const y = useClientY ? clientMouseCoord[1] : (clientRect === null || clientRect === void 0 ? void 0 : clientRect.top) || 0;
return featureUnderMouse ? (_jsxs(_Fragment, { children: [_jsx(Suspense, { fallback: null, children: _jsx(BaseTooltip, { clientPoint: { x, y }, children: _jsx(TooltipContents, { model: model, feature: featureUnderMouse }) }) }), _jsx("div", { className: classes.hoverVertical, style: {
left: offsetMouseCoord[0],
height: height - YSCALEBAR_LABEL_OFFSET * 2,
} })] })) : null;
});
export default Tooltip;