@vitessce/tooltip 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Tooltip2D.js +13 -2
- package/package.json +2 -2
package/dist/Tooltip2D.js
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
3
4
|
import Tooltip from './Tooltip';
|
|
5
|
+
const useStyles = makeStyles(theme => ({
|
|
6
|
+
cellEmphasisCrosshair: {
|
|
7
|
+
zIndex: 50,
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
pointerEvents: 'none',
|
|
10
|
+
boxSizing: 'border-box',
|
|
11
|
+
backgroundColor: theme.palette.secondaryForeground,
|
|
12
|
+
},
|
|
13
|
+
}));
|
|
4
14
|
/**
|
|
5
15
|
* A tooltip component that also incorporates a crosshair element.
|
|
6
16
|
* @param {object} props
|
|
@@ -16,6 +26,7 @@ import Tooltip from './Tooltip';
|
|
|
16
26
|
*/
|
|
17
27
|
export default function Tooltip2D(props) {
|
|
18
28
|
const { parentUuid, sourceUuid, x, y, parentWidth, parentHeight, children, } = props;
|
|
29
|
+
const classes = useStyles();
|
|
19
30
|
// Check if out of bounds.
|
|
20
31
|
if (x < 0 || x > parentWidth || y < 0 || y > parentHeight) {
|
|
21
32
|
return null;
|
|
@@ -23,12 +34,12 @@ export default function Tooltip2D(props) {
|
|
|
23
34
|
// Show tooltip or crosshair?
|
|
24
35
|
const isTooltipVisible = (parentUuid === sourceUuid);
|
|
25
36
|
const crosshairWidth = 1;
|
|
26
|
-
return (_jsx(_Fragment, { children: isTooltipVisible ? (_jsx(Tooltip, { x: x, y: y, parentWidth: parentWidth, parentHeight: parentHeight, children: children })) : (_jsxs(_Fragment, { children: [x !== null ? (_jsx("div", { className:
|
|
37
|
+
return (_jsx(_Fragment, { children: isTooltipVisible ? (_jsx(Tooltip, { x: x, y: y, parentWidth: parentWidth, parentHeight: parentHeight, children: children })) : (_jsxs(_Fragment, { children: [x !== null ? (_jsx("div", { className: classes.cellEmphasisCrosshair, style: {
|
|
27
38
|
left: `${x - crosshairWidth / 2}px`,
|
|
28
39
|
top: 0,
|
|
29
40
|
width: `${crosshairWidth}px`,
|
|
30
41
|
height: `${parentHeight}px`,
|
|
31
|
-
} })) : null, y !== null ? (_jsx("div", { className:
|
|
42
|
+
} })) : null, y !== null ? (_jsx("div", { className: classes.cellEmphasisCrosshair, style: {
|
|
32
43
|
left: 0,
|
|
33
44
|
top: `${y - crosshairWidth / 2}px`,
|
|
34
45
|
width: `${parentWidth}px`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/tooltip",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
],
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@material-ui/core": "~4.12.3",
|
|
17
|
-
"@vitessce/vit-s": "2.0.
|
|
17
|
+
"@vitessce/vit-s": "2.0.2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"react": "^18.0.0",
|