@jbrowse/plugin-dotplot-view 2.14.0 → 2.15.1
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/DotplotDisplay/stateModelFactory.d.ts +6 -1
- package/dist/DotplotRenderer/DotplotRenderer.d.ts +1 -9
- package/dist/DotplotRenderer/DotplotRenderer.js +25 -214
- package/dist/DotplotRenderer/drawDotplot.d.ts +21 -0
- package/dist/DotplotRenderer/drawDotplot.js +216 -0
- package/dist/DotplotView/components/{DotplotTooltip.d.ts → DotplotTooltipClick.d.ts} +2 -8
- package/dist/DotplotView/components/DotplotTooltipClick.js +21 -0
- package/dist/DotplotView/components/DotplotTooltipMouseover.d.ts +10 -0
- package/dist/DotplotView/components/DotplotTooltipMouseover.js +20 -0
- package/dist/DotplotView/components/DotplotView.js +6 -3
- package/dist/DotplotView/model.d.ts +1 -0
- package/esm/DotplotDisplay/stateModelFactory.d.ts +6 -1
- package/esm/DotplotRenderer/DotplotRenderer.d.ts +1 -9
- package/esm/DotplotRenderer/DotplotRenderer.js +2 -214
- package/esm/DotplotRenderer/drawDotplot.d.ts +21 -0
- package/esm/DotplotRenderer/drawDotplot.js +213 -0
- package/esm/DotplotView/components/{DotplotTooltip.d.ts → DotplotTooltipClick.d.ts} +2 -8
- package/esm/DotplotView/components/DotplotTooltipClick.js +15 -0
- package/esm/DotplotView/components/DotplotTooltipMouseover.d.ts +10 -0
- package/esm/DotplotView/components/DotplotTooltipMouseover.js +15 -0
- package/esm/DotplotView/components/DotplotView.js +7 -4
- package/esm/DotplotView/model.d.ts +1 -0
- package/package.json +4 -4
- package/dist/DotplotView/components/DotplotTooltip.js +0 -84
- package/esm/DotplotView/components/DotplotTooltip.js +0 -78
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TooltipWhereClicked = exports.TooltipWhereMouseovered = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const mobx_react_1 = require("mobx-react");
|
|
9
|
-
const mui_1 = require("tss-react/mui");
|
|
10
|
-
const util_1 = require("./util");
|
|
11
|
-
const material_1 = require("@mui/material");
|
|
12
|
-
const react_2 = require("@floating-ui/react");
|
|
13
|
-
function round(value) {
|
|
14
|
-
return Math.round(value * 1e5) / 1e5;
|
|
15
|
-
}
|
|
16
|
-
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
17
|
-
// these styles come from
|
|
18
|
-
// https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Tooltip/Tooltip.js
|
|
19
|
-
tooltip: {
|
|
20
|
-
position: 'absolute',
|
|
21
|
-
pointerEvents: 'none',
|
|
22
|
-
backgroundColor: (0, material_1.alpha)(theme.palette.grey[700], 0.9),
|
|
23
|
-
borderRadius: theme.shape.borderRadius,
|
|
24
|
-
color: theme.palette.common.white,
|
|
25
|
-
fontFamily: theme.typography.fontFamily,
|
|
26
|
-
padding: '4px 8px',
|
|
27
|
-
fontSize: theme.typography.pxToRem(12),
|
|
28
|
-
lineHeight: `${round(14 / 10)}em`,
|
|
29
|
-
maxWidth: 300,
|
|
30
|
-
wordWrap: 'break-word',
|
|
31
|
-
},
|
|
32
|
-
}));
|
|
33
|
-
exports.TooltipWhereMouseovered = (0, mobx_react_1.observer)(function ({ model, mouserect, mouserectClient, xdistance, }) {
|
|
34
|
-
var _a, _b;
|
|
35
|
-
const { classes } = useStyles();
|
|
36
|
-
const { hview, vview, viewHeight } = model;
|
|
37
|
-
const theme = (0, material_1.useTheme)();
|
|
38
|
-
const { refs, floatingStyles, context } = (0, react_2.useFloating)({
|
|
39
|
-
placement: xdistance < 0 ? 'left' : 'right',
|
|
40
|
-
strategy: 'fixed',
|
|
41
|
-
});
|
|
42
|
-
const clientPoint = (0, react_2.useClientPoint)(context, mouserectClient
|
|
43
|
-
? {
|
|
44
|
-
x: mouserectClient[0],
|
|
45
|
-
y: mouserectClient[1],
|
|
46
|
-
}
|
|
47
|
-
: undefined);
|
|
48
|
-
const { getFloatingProps } = (0, react_2.useInteractions)([clientPoint]);
|
|
49
|
-
const popperTheme = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
|
|
50
|
-
return mouserect ? (react_1.default.createElement(material_1.Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
|
|
51
|
-
react_1.default.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
|
|
52
|
-
...floatingStyles,
|
|
53
|
-
zIndex: 100000,
|
|
54
|
-
pointerEvents: 'none',
|
|
55
|
-
}, ...getFloatingProps() },
|
|
56
|
-
`x - ${(0, util_1.locstr)(mouserect[0], hview)}`,
|
|
57
|
-
react_1.default.createElement("br", null),
|
|
58
|
-
`y - ${(0, util_1.locstr)(viewHeight - mouserect[1], vview)}`,
|
|
59
|
-
react_1.default.createElement("br", null)))) : null;
|
|
60
|
-
});
|
|
61
|
-
exports.TooltipWhereClicked = (0, mobx_react_1.observer)(function ({ model, mousedown, mousedownClient, xdistance, ydistance, }) {
|
|
62
|
-
var _a, _b;
|
|
63
|
-
const { classes } = useStyles();
|
|
64
|
-
const { hview, vview, viewHeight } = model;
|
|
65
|
-
const theme = (0, material_1.useTheme)();
|
|
66
|
-
const x = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[0]) || 0) - (xdistance < 0 ? 0 : 0);
|
|
67
|
-
const y = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[1]) || 0) - (ydistance < 0 ? 0 : 0);
|
|
68
|
-
const { refs, floatingStyles, context } = (0, react_2.useFloating)({
|
|
69
|
-
placement: xdistance < 0 ? 'right' : 'left',
|
|
70
|
-
});
|
|
71
|
-
const clientPoint = (0, react_2.useClientPoint)(context, { x, y });
|
|
72
|
-
const { getFloatingProps } = (0, react_2.useInteractions)([clientPoint]);
|
|
73
|
-
const popperTheme = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
|
|
74
|
-
return mousedown && Math.abs(xdistance) > 3 && Math.abs(ydistance) > 3 ? (react_1.default.createElement(material_1.Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
|
|
75
|
-
react_1.default.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
|
|
76
|
-
...floatingStyles,
|
|
77
|
-
zIndex: 100000,
|
|
78
|
-
pointerEvents: 'none',
|
|
79
|
-
}, ...getFloatingProps() },
|
|
80
|
-
`x - ${(0, util_1.locstr)(mousedown[0], hview)}`,
|
|
81
|
-
react_1.default.createElement("br", null),
|
|
82
|
-
`y - ${(0, util_1.locstr)(viewHeight - mousedown[1], vview)}`,
|
|
83
|
-
react_1.default.createElement("br", null)))) : null;
|
|
84
|
-
});
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { observer } from 'mobx-react';
|
|
3
|
-
import { makeStyles } from 'tss-react/mui';
|
|
4
|
-
import { locstr } from './util';
|
|
5
|
-
import { Portal, alpha, useTheme } from '@mui/material';
|
|
6
|
-
import { useFloating, useClientPoint, useInteractions, } from '@floating-ui/react';
|
|
7
|
-
function round(value) {
|
|
8
|
-
return Math.round(value * 1e5) / 1e5;
|
|
9
|
-
}
|
|
10
|
-
const useStyles = makeStyles()(theme => ({
|
|
11
|
-
// these styles come from
|
|
12
|
-
// https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Tooltip/Tooltip.js
|
|
13
|
-
tooltip: {
|
|
14
|
-
position: 'absolute',
|
|
15
|
-
pointerEvents: 'none',
|
|
16
|
-
backgroundColor: alpha(theme.palette.grey[700], 0.9),
|
|
17
|
-
borderRadius: theme.shape.borderRadius,
|
|
18
|
-
color: theme.palette.common.white,
|
|
19
|
-
fontFamily: theme.typography.fontFamily,
|
|
20
|
-
padding: '4px 8px',
|
|
21
|
-
fontSize: theme.typography.pxToRem(12),
|
|
22
|
-
lineHeight: `${round(14 / 10)}em`,
|
|
23
|
-
maxWidth: 300,
|
|
24
|
-
wordWrap: 'break-word',
|
|
25
|
-
},
|
|
26
|
-
}));
|
|
27
|
-
export const TooltipWhereMouseovered = observer(function ({ model, mouserect, mouserectClient, xdistance, }) {
|
|
28
|
-
var _a, _b;
|
|
29
|
-
const { classes } = useStyles();
|
|
30
|
-
const { hview, vview, viewHeight } = model;
|
|
31
|
-
const theme = useTheme();
|
|
32
|
-
const { refs, floatingStyles, context } = useFloating({
|
|
33
|
-
placement: xdistance < 0 ? 'left' : 'right',
|
|
34
|
-
strategy: 'fixed',
|
|
35
|
-
});
|
|
36
|
-
const clientPoint = useClientPoint(context, mouserectClient
|
|
37
|
-
? {
|
|
38
|
-
x: mouserectClient[0],
|
|
39
|
-
y: mouserectClient[1],
|
|
40
|
-
}
|
|
41
|
-
: undefined);
|
|
42
|
-
const { getFloatingProps } = useInteractions([clientPoint]);
|
|
43
|
-
const popperTheme = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
|
|
44
|
-
return mouserect ? (React.createElement(Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
|
|
45
|
-
React.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
|
|
46
|
-
...floatingStyles,
|
|
47
|
-
zIndex: 100000,
|
|
48
|
-
pointerEvents: 'none',
|
|
49
|
-
}, ...getFloatingProps() },
|
|
50
|
-
`x - ${locstr(mouserect[0], hview)}`,
|
|
51
|
-
React.createElement("br", null),
|
|
52
|
-
`y - ${locstr(viewHeight - mouserect[1], vview)}`,
|
|
53
|
-
React.createElement("br", null)))) : null;
|
|
54
|
-
});
|
|
55
|
-
export const TooltipWhereClicked = observer(function ({ model, mousedown, mousedownClient, xdistance, ydistance, }) {
|
|
56
|
-
var _a, _b;
|
|
57
|
-
const { classes } = useStyles();
|
|
58
|
-
const { hview, vview, viewHeight } = model;
|
|
59
|
-
const theme = useTheme();
|
|
60
|
-
const x = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[0]) || 0) - (xdistance < 0 ? 0 : 0);
|
|
61
|
-
const y = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[1]) || 0) - (ydistance < 0 ? 0 : 0);
|
|
62
|
-
const { refs, floatingStyles, context } = useFloating({
|
|
63
|
-
placement: xdistance < 0 ? 'right' : 'left',
|
|
64
|
-
});
|
|
65
|
-
const clientPoint = useClientPoint(context, { x, y });
|
|
66
|
-
const { getFloatingProps } = useInteractions([clientPoint]);
|
|
67
|
-
const popperTheme = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
|
|
68
|
-
return mousedown && Math.abs(xdistance) > 3 && Math.abs(ydistance) > 3 ? (React.createElement(Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
|
|
69
|
-
React.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
|
|
70
|
-
...floatingStyles,
|
|
71
|
-
zIndex: 100000,
|
|
72
|
-
pointerEvents: 'none',
|
|
73
|
-
}, ...getFloatingProps() },
|
|
74
|
-
`x - ${locstr(mousedown[0], hview)}`,
|
|
75
|
-
React.createElement("br", null),
|
|
76
|
-
`y - ${locstr(viewHeight - mousedown[1], vview)}`,
|
|
77
|
-
React.createElement("br", null)))) : null;
|
|
78
|
-
});
|